2014-09-07

Command Line: Reset Network card and Firewall settings

Start from elevated prompt



Reset firewall and NIC configuration states.


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
echo Export current active policy of Windows Firewall to a specified file.
netsh advfirewall export c:\temp\advfirewall.wfw


echo Restore the Windows Firewall with Advanced Security policy to the default policy.
echo In a Group Policy object, this command returns all settings to
echo not configured and deletes all connection security and firewall rules.
netsh advfirewall reset


echo Resets the BranchCache service. Flushes the local cache.
echo Every configuration parameter of BranchCache will be reset to its default value.
netsh branchcache reset


echo Resets TCP/IP and related components to a clean state.
netsh int ipv4 reset c:\temp\ipv4_rst.log


echo Resets IPv6 configuration state.
netsh int ipv6 reset c:\temp\ipv6_rst.log


echo Resets Winsock Catalog to a clean state.
echo All Winsock Layered Service Providers which were previously installed must be reinstalled.
echo This command does not affect Winsock Name Space Provider entries.
netsh winsock reset catalog


Enable / Disable network card (NIC) using netsh


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
echo Show network interfaces (interface name to be used to disable / enable network card)
netsh interface show interface


echo Disable network interface by name
netsh interface set interface name="Local Area Connection" admin=disabled


echo Enable network interface by name
netsh interface set interface name="Local Area Connection" admin=enabled


Enable / Disable network card interface using WMIC
echo Get NIC list and index number:
wmic nic get name, index


echo Enable NIC with index number: (eg: 7)
wmic path win32_networkadapter where index=7 call enable


echo Disable NIC with index number: (eg: 7)
wmic path win32_networkadapter where index=7 call disable


echo Enable by name
wmic path win32_networkadapter where NetConnectionID="Wireless Network Connection" call disable


echo Disable by name
wmic path win32_networkadapter where NetConnectionID="Wireless Network Connection" call enable

No comments:

Post a Comment