Setting up a network in Windows via the command line

To begin, open the command line by clicking on the shortcut in the Start menu or typing the command “cmd” in the “Run” line.

Here is an example of viewing the current configuration:

netsh interface ip show config

View a list of network interfaces:

netsh interface ipv4 show interfaces

An example of configuring static parameters for an interface named Ethernet 2:

netsh interface ip set address name="Ethernet 2" static 192.168.0.101 255.255.255.0 192.168.0.1 1

Or so:

netsh interface ipv4 set address name="Ethernet 2" source=static address=192.168.1.2 mask=255.255.255.0 gateway=192.168.1.1
netsh interface ipv4 add dnsserver name="Local" address=8.8.8.8 index=1

Example of obtaining parameters for the Ethernet 2 interface by DHCP:

netsh interface ip set address name="Ethernet 2" dhcp

Example of obtaining the DNS parameters for the Ethernet 2 interface by DHCP:

netsh interface ip set dns "Ethernet 2" dhcp

Export the current configuration to a file:

netsh -c interface dump > d:cfg1.txt

Importing a configuration from a file:

netsh -f d:cfg1.txt

How to schedule shutdown Windows

There are several ways to schedule a Windows shutdown.

1) You can execute the command shown below in the “Run” window (it can also be opened with the WIN+R keys), also on the command line or the PowerShell, for all variants the command is the same:

shutdown –s –t 3600

Where 3600 is the number of seconds after which Windows will shut down and the computer will shut down.
3600 seconds = 1 hour.

Similarly, you can put the computer into hibernation mode if it is available:

shutdown –h –t 3600

To cancel a command, you must:

shutdown /a

2) The second way is to create a simple task in the task scheduler.
Open the Control Panel\System and Security\Administration\Task Scheduler.
Click “Create a simple task …”.
Enter any name for the new task, for example, “Shutdown.”
In the next window, select “Once.”
In the next window, we indicate the time when we need to complete the task.
In the next window, select “Run the program.”
In the line “Program or script:” we indicate the program:

C:\Windows\System32\shutdown.exe

and in the line “Add arguments (optional):” -s
Create a task.

Similarly, you can create a task such as sleep mode by entering “Program or script:” in the line:

C:\Windows\System32\rundll32.exe powrprof.dll,SetSuspendState Sleep

If you want to delete it, in the Task Scheduler window on the left click “Job Scheduler Library” and clicking the right button on the desired task, click “Delete”.

See also my article – Enable or disable Hibernate mode in Windows

Where is auto startup folder in Windows 10?

It took today on Windows 10 to add a shortcut to the program in startup, started looking in the menu, but there is no it.

Therefore, I will describe a couple of options where to find this folder “Startup”.

Option 1) The folder for each user is located separately, for example, in my case (user admin), the path to it is:

C:\Users\admin\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

admin can be replaced with the correct user name and paste this path into the address bar of the explorer. The AppData folder is hidden, so if you open folders one by one, you will have to type it manually in the address bar of the explorer.

Option 2) Open the line “Run” in the menu or by pressing Win+R and type:

shell:startup

In this case, the “Startup” folder of the current user will be displayed.
To open the shared folder “Startup” which is valid for all users, type:

shell:common startup

To remove something from the startup, you do not have to delete the shortcut from the Startup folder, you can open the Task Manager with the shortcut Ctrl+Shift+Esc and the “Startup” right-click the desired object and select “Disable“. In this tab, you can also disable objects that are added to the startup registry.

Done.

Turning test mode on and off in Windows 7

Sometimes I had to put unsigned drivers to flash different junk, so I included a test mode in which the installation of unsigned drivers is allowed. If the test mode is disabled, the drivers will stop working again.

You can enable the test mode in Windows 7 from the command line (cmd) or from the “Run” line which is opened by the Win+R key combination.
In any of the lines, you need to run the following command to enable the test mode:

bcdedit.exe -set TESTSIGNING ON

To turn off:

bcdedit.exe -set TESTSIGNING OFF

After each command, you must restart the computer.
When the test mode is enabled, the “Test mode” and the version of the Windows assembly are displayed on the desktop in the lower right corner.

Troubleshooting and Error 0x00000005 after Windows Update from 14.08.13

After installing the Windows updates from August 14, 2013 many users stopped running many applications with the output of the error 0x00000005 or even the operating system stopped loading. In particular, Windows 7 x64. The cause was the installation of the update KB2859537. To fix the error, you can remove it by typing the command:

wusa.exe /uninstall /kb:2859537

09/11/2013 one more update has been issued that causes the same symptoms, we also treat with the removal:

wusa.exe /uninstall /kb:2872339

How to enable Ping in Windows Server

For Windows Server to respond to PING requests, you must enable them in the firewall.

To do this, open the rule in the firewall “File and Printer Sharing (Echo Request — ICMPv4-In)” and tick the “Enabled(Enabled)“, similarly for the sixth version “File and Printer Sharing (Echo Request — ICMPv6-In)“.

In order for the system to respond to PING requests only for specific IP, there is also a rule in the tab in the settings “Scope“, where “Remote IP Address” pushing “Add” specify the desired IP-addresses.

From the command line, you can configure this rule like this:

netsh advfirewall firewall set rule name= "File and Printer Sharing (Echo Request — ICMPv4-In)" new enable=yes action=allow profile=any remoteip=192.168.5.0/24

Either (on / off):

netsh firewall set icmpsetting 8
netsh firewall set icmpsetting 8 disable

From PowerShell like this:

Set-NetFirewallRule -Name FPS-ICMP-ERQ-In -Enabled True -Profile Any -Action Allow

The solution to the error “Virtual machine could not be started because the hypervisor is not running”

I noticed once on one HP server, after installing Hyper-V, that virtual workstations are not being launched, giving the following error:

Hyper-V Manager
An error occurred while attempting to start the selected virtual machine(s).

Virtual machine could not be started because the hypervisor is not running.

As it turned out, the problem was in the Intel (R) Virualization Tech not activated in BIOS, after changing from “Disabled” to “Enabled” and start the system, the virtual workstations were successfully launched.

Configuring a VPN Server in Windows Server

On the test I give an example of setting up a VPN server in Windows Server 2008 R2.

First of all, install the role:

1) Open the server manager and click on the link “Add role“.

2) Select the Network Policy and Access Services role and click “Next“.

3) Select “Remote Access” and click “Next“.

4) Click “Install” and after the installation is complete, click the “Close” button.

Now go to the setup:

1) Open the server manager, open the “Roles” branch, select the Network Policy and Access Services role, right-click on “Routing and Remote Access“, select “Configure and enable routing and remote access“.

2) In the first window click “Next“, in the next we’ll select “Custom configuration“, click the “Next” button, tick three items: Network Address Translation (NAT) and Local Area Networking (LAN routing), click Next and “Done“.
In the window that appears, click “Launch service“.

3) We’ll add an address pool for clients by opening the “Server Manager” – “Roles” – “Network Policy and Access Services“, right-click on “Routing and Remote Access” and select “Properties“.
In the “IPv4 tab, select” Static address pool “and add any range after clicking the “Add” button.
In order to be able to connect to a VPN server, for example, from the iPhone (via L2TP), in the “Security” tab, tick “Allow custom IPSec policies for L2TP connection” and specify the key .

4) Now configure permissions for users. Go to “Server Manager – Configuration – Local Users and Groups – Users“:
Open “Properties” of the desired user and on the Dial-in tab, where “Network Access permission” select “Allow access“.

5) Add NAT rules, the necessary routes and restart the service by right-clicking on “Routing and Remote Access” – “All Tasks” – “Restart “.

For the VPN to work, ports are used and should be opened:
TCP 1723 (for PPTP)
TCP 1701 and UDP 500 (for L2TP)
TCP 443 (for SSTP)

Done.

Connection logs can be seen in the C:\Windows\System32\LogFiles directory

How to disable Windows 10 updates

I’ll describe several options for disabling Windows 10 updates:

1) Disable the update service.
Open the “ Services ” window through the Control Panel, or press the Win+R key combination and in the “ Run ” window, enter:

services.msc

In the list of services, usually at the end, we find “ Windows Update” , click on it with the left mouse button twice, in the opened window, select “ Startup Type: Disabled “and click the” Stop “button, then click” OK “and close the windows.

2) You can disable the automatic downloading of drivers from the Internet.
Using the Win+R keys, open the “ Run ” window and enter:

rundll32 newdev.dll,DeviceInternetSettingUi

In the window that opens, select “ No, give the option to select “, then for example “ Never install drivers from Windows Update ” and click the “ Save “.

3) You can hide updates by running the official utility Show or hide updates and tapping “Hide updates“.

4) You can also turn on the “ Set as limit connection ” radio button for any network connection by going to “ Settings ” – “ Network and Internet ” and selecting the network connection, after that Windows will not download updates via this network connection.

5) Open the “Local Group Policy Editor” by pressing the Win+R keys and typing:

gpedit.msc

Select “ Computer Configuration ” -> “ Administrative Templates ” -> “ Windows Components ” -> “ Windows Update “, then on the right” Set up automatic updates “. In the window that opens, select “ Enabled ” and the desired option, for example, “ Download notification and Automatic installation “.