Usage: NETSH [-a AliasFile] [-c Context] [-r RemoteMachine] [-u [DomainName\]UserName] [-p Password | *]
[Command | -f ScriptFile]
The following commands are available:
Commands in this context:
? - Displays a list of commands.
add - Adds a configuration entry to a list of entries.
advfirewall - Changes to the `netsh advfirewall' context.
branchcache - Changes to the `netsh branchcache' context.
bridge - Changes to the `netsh bridge' context.
delete - Deletes a configuration entry from a list of entries.
dhcpclient - Changes to the `netsh dhcpclient' context.
dnsclient - Changes to the `netsh dnsclient' context.
dump - Displays a configuration script.
exec - Runs a script file.
firewall - Changes to the `netsh firewall' context.
help - Displays a list of commands.
http - Changes to the `netsh http' context.
interface - Changes to the `netsh interface' context.
ipsec - Changes to the `netsh ipsec' context.
lan - Changes to the `netsh lan' context.
mbn - Changes to the `netsh mbn' context.
namespace - Changes to the `netsh namespace' context.
nap - Changes to the `netsh nap' context.
netio - Changes to the `netsh netio' context.
p2p - Changes to the `netsh p2p' context.
ras - Changes to the `netsh ras' context.
rpc - Changes to the `netsh rpc' context.
set - Updates configuration settings.
show - Displays information.
trace - Changes to the `netsh trace' context.
wcn - Changes to the `netsh wcn' context.
wfp - Changes to the `netsh wfp' context.
winhttp - Changes to the `netsh winhttp' context.
winsock - Changes to the `netsh winsock' context.
wlan - Changes to the `netsh wlan' context.
The following sub-contexts are available:
advfirewall branchcache bridge dhcpclient dnsclient firewall http interface ipsec lan mbn namespace nap netio
p2p ras rpc trace wcn wfp winhttp winsock wlan
To view help for a command, type the command, followed by a space, and then type ?.
Usage: ?
Remarks:
Displays a list of commands.
The following commands are available:
Commands in this context:
add helper - Installs a helper DLL.
The following commands are available:
Commands in this context:
? - Displays a list of commands.
consec - Changes to the `netsh advfirewall consec' context.
dump - Displays a configuration script.
export - Exports the current policy to a file.
firewall - Changes to the `netsh advfirewall firewall' context.
help - Displays a list of commands.
import - Imports a policy file into the current policy store.
mainmode - Changes to the `netsh advfirewall mainmode' context.
monitor - Changes to the `netsh advfirewall monitor' context.
reset - Resets the policy to the default out-of-box policy.
set - Sets the per-profile or global settings.
show - Displays profile or global properties.
The following sub-contexts are available:
consec firewall mainmode monitor
Usage: ?
Remarks:
Displays a list of commands.
The following commands are available:
Commands in this context:
? - Displays a list of commands.
add - Adds a new connection security rule.
delete - Deletes all matching connection security rules.
dump - Displays a configuration script.
help - Displays a list of commands.
set - Sets new values for properties of an existing rule.
show - Displays a specified connection security rule.
To view help for a command, type the command, followed by a space, and then type ?.
?:
netsh advfirewall consec>?
Usage: ?
Remarks:
Displays a list of commands.
ADD:
netsh advfirewall consec>add
The following commands are available:
Commands inherited from the netsh context:
add helper - Installs a helper DLL.
Commands in this context:
add rule - Adds a new connection security rule.
DELETE: netsh advfirewall consec>delete
The following commands are available:
Commands inherited from the netsh context:
delete helper - Removes a helper DLL.
Commands in this context:
delete rule - Deletes all matching connection security rules.
DUMP:
netsh advfirewall consec>dump
Usage: dump
Remarks:
Creates a script that contains the current configuration. If saved to a
file, this script can be used to restore altered configuration settings.
HELP:
netsh advfirewall consec>help
Usage: help
Remarks:
Displays a list of commands.
SET:
netsh advfirewall consec>set
The following commands are available:
Commands inherited from the netsh context:
set file - Copy the console output to a file.
set machine - Sets the current machine on which to operate.
set mode - Sets the current mode to online or offline.
Commands in this context:
set rule - Sets new values for properties of an existing rule.
SHOW:
netsh advfirewall consec>show
The following commands are available:
Commands inherited from the netsh context:
show alias - Lists all defined aliases.
show helper - Lists all the top-level helpers.
show mode - Shows the current mode.
Commands in this context:
show rule - Displays a specified connection security rule.
netsh advfirewall>dump
Usage: dump
Remarks:
Creates a script that contains the current configuration. If saved to a
file, this script can be used to restore altered configuration settings.
netsh advfirewall>export
Usage: export <path\filename>
Remarks:
- Exports the current policy to the specified file.
Example:
netsh advfirewall export "c:\advfirewallpolicy.wfw"
netsh advfirewall>firewall
The following commands are available:
Commands in this context:
? - Displays a list of commands.
add - Adds a new inbound or outbound firewall rule.
delete - Deletes all matching firewall rules.
dump - Displays a configuration script.
help - Displays a list of commands.
set - Sets new values for properties of a existing rule.
show - Displays a specified firewall rule.
To view help for a command, type the command, followed by a space, and then type ?.
?:
netsh advfirewall firewall>?
Usage: ?
Remarks:
Displays a list of commands.
ADD:
netsh advfirewall firewall>add
The following commands are available:
Commands inherited from the netsh context:
add helper - Installs a helper DLL.
Commands in this context:
add rule - Adds a new inbound or outbound firewall rule.
DELETE:
netsh advfirewall firewall>delete
The following commands are available:
Commands inherited from the netsh context:
delete helper - Removes a helper DLL.
Commands in this context:
delete rule - Deletes all matching firewall rules.
DUMP:
netsh advfirewall firewall>dump
Usage: dump
Remarks:
Creates a script that contains the current configuration. If saved to a
file, this script can be used to restore altered configuration settings.
HELP:
netsh advfirewall firewall>help
Usage: help
Remarks:
Displays a list of commands.
SET:
netsh advfirewall firewall>set
The following commands are available:
Commands inherited from the netsh context:
set file - Copy the console output to a file.
set machine - Sets the current machine on which to operate.
set mode - Sets the current mode to online or offline.
Commands in this context:
set rule - Sets new values for properties of a existing rule.
SHOW:
netsh advfirewall firewall>show
The following commands are available:
Commands inherited from the netsh context:
show alias - Lists all defined aliases.
show helper - Lists all the top-level helpers.
show mode - Shows the current mode.
Commands in this context:
show rule - Displays a specified firewall rule.
netsh advfirewall>help
Usage: help
Remarks:
Displays a list of commands.
netsh advfirewall>import
Usage: import <path\filename>
Remarks:
- Imports policy from the specified file.
Example:
netsh advfirewall import "c:\newpolicy.wfw"
netsh advfirewall>mainmode
The following commands are available:
Commands in this context:
? - Displays a list of commands.
add - Adds a new mainmode rule.
delete - Deletes all matching mainmode rules.
dump - Displays a configuration script.
help - Displays a list of commands.
set - Sets new values for properties of an existing rule.
show - Displays a specified mainmode rule.
To view help for a command, type the command, followed by a space, and then type ?.
?:
netsh advfirewall mainmode>?
Usage: ?
Remarks:
Displays a list of commands.
ADD:
netsh advfirewall mainmode>add
The following commands are available:
Commands inherited from the netsh context:
add helper - Installs a helper DLL.
Commands in this context:
add rule - Adds a new mainmode rule.
DELETE:
netsh advfirewall mainmode>delete
The following commands are available:
Commands inherited from the netsh context:
delete helper - Removes a helper DLL.
Commands in this context:
delete rule - Deletes all matching mainmode rules.
DUMP:
netsh advfirewall mainmode>dump
Usage: dump
Remarks:
Creates a script that contains the current configuration. If saved to a
file, this script can be used to restore altered configuration settings.
HELP:
netsh advfirewall mainmode>help
Usage: help
Remarks:
Displays a list of commands.
SET:
netsh advfirewall mainmode>set
The following commands are available:
Commands inherited from the netsh context:
set file - Copy the console output to a file.
set machine - Sets the current machine on which to operate.
set mode - Sets the current mode to online or offline.
Commands in this context:
set rule - Sets new values for properties of an existing rule.
SHOW:
netsh advfirewall mainmode>show
The following commands are available:
Commands inherited from the netsh context:
show alias - Lists all defined aliases.
show helper - Lists all the top-level helpers.
show mode - Shows the current mode.
Commands in this context:
show rule - Displays a specified mainmode rule.
The following commands are available:
Commands in this context:
? - Displays a list of commands.
delete - Deletes all matching security associations.
dump - Displays a configuration script.
help - Displays a list of commands.
show - Shows the runtime Firewall policy settings.
netsh advfirewall>reset
Usage: reset [export <path\filename>]
Remarks:
- Restores the Windows Firewall with Advanced Security policy to the
default policy. The current active policy can be optionally exported
to a specified file.
- In a Group Policy object, this command returns all settings to
notconfigured and deletes all connection security and firewall
rules.
Examples:
Backup the current policy and restore out-of-box policy:
netsh advfirewall reset export "c:\backuppolicy.wfw"
The following commands are available:
Commands inherited from the netsh context:
set file - Copy the console output to a file.
set machine - Sets the current machine on which to operate.
set mode - Sets the current mode to online or offline.
Commands in this context:
set allprofiles - Sets properties in all profiles.
set currentprofile - Sets properties in the active profile.
set domainprofile - Sets properties in the domain profile.
set global - Sets the global properties.
set privateprofile - Sets properties in the private profile.
set publicprofile - Sets properties in the public profile.
set store - Sets the policy store for the current interactive session.
SET FILE:
netsh advfirewall>set file
Usage: set file [ mode= ] { open [ name= ] <filename> | append [ name = ]
<filename> | close }
Parameters:
Tag Value
mode - One of the following values:
open: Creates a new file or overwrites an existing file and
streams the console output to the file
append: Opens an existing file and streams the console
output to the end of the existing file
close: Stops streaming and closes a file
name - Name of the file (full path optional)
Remarks:
Copy the console output to a file.
Example:
set file open c:\logfiles\logfile.txt
The above command creates a file and logs all output to it.
SET MACHINE:
netsh advfirewall>set machine
Usage: set machine [name=]<string> [user=][[DomainName\]UserName] [pwd=][Password | *]
Parameters:
Tag Value
name - Name of the machine on which to operate
user - User name used to connect to remote machine
pwd - Password used to connect to remote machine
Remarks:
Sets the current machine on which to operate. If a machine name
is not specified, the local machine is used. A username and password
cannot be used to connect to the local machine.
SET MODE:
netsh advfirewall>set mode
Usage: set mode [ mode= ] { online | offline }
Parameters:
Tag Value
mode - One of the following values:
online: Commit changes immediately
offline: Delay commit until explicitly requested
Remarks:
Sets the current mode to online or offline.
SET ALLPROFILES:
netsh advfirewall>set allprofiles
Usage: set allprofiles (parameter) (value)
Parameters:
state - Configure the firewall state.
Usage: state on|off|notconfigured
firewallpolicy - Configures default inbound and outbound behavior.
Usage: firewallpolicy (inbound behavior),(outbound behavior)
Inbound behavior:
blockinbound - Block inbound connections that do not
match an inbound rule.
blockinboundalways - Block all inbound connections even if
the connection matches a rule.
allowinbound - Allow inbound connections that do
not match a rule.
notconfigured - Return the value to its unconfigured state.
Outbound behavior:
allowoutbound - Allow outbound connections that do not
match a rule.
blockoutbound - Block outbound connections that do not
match a rule.
notconfigured - Return the value to its unconfigured state.
settings - Configures firewall settings.
Usage: settings (parameter) enable|disable|notconfigured
Parameters:
localfirewallrules - Merge local firewall rules with Group
Policy rules. Valid when configuring
a Group Policy store.
localconsecrules - Merge local connection security rules
with Group Policy rules. Valid when
configuring a Group Policy store.
inboundusernotification - Notify user when a program listens
for inbound connections.
remotemanagement - Allow remote management of Windows
Firewall.
unicastresponsetomulticast - Control stateful unicast response to
multicast.
logging - Configures logging settings.
Usage: logging (parameter) (value)
Parameters:
allowedconnections - Log allowed connections.
Values: enable|disable|notconfigured
droppedconnections - Log dropped connections.
Values: enable|disable|notconfigured
filename - Name and location of the firewall log.
Values: <string>|notconfigured
maxfilesize - Maximum log file size in kilobytes.
V