Windows: disable the firewall remotely with PsExec and netsh
Temporarily disable Windows Firewall on a remote machine with psexec and netsh.
To turn off Windows Firewall on a remote machine (for example to troubleshoot a connectivity problem), you can run netsh remotely with PsExec (Sysinternals).
psexec \ComputerHostname netsh firewall set opmode disable
psexec \ComputerHostnameruns the following command on the remote computer (administrator rights required).netsh firewall set opmode disabledisables the firewall.
Notes
- The
netsh firewallcontext is deprecated; on recent Windows versions the equivalent command isnetsh advfirewall set allprofiles state off. - Disabling the firewall exposes the machine: use it only for a temporary test, then re-enable it (
opmode enableorstate on).