Thursday, 19 May 2016

Turning on/off Windows firewall on remote PC

While trying to fix one of our user’s IT issue remotely, I had to turn off Windows firewall which was set to Public. Users account does not have appropriate permission to make any changes to the system or run a command prompt. When I tried to make a RDP connection, it failed due to Public firewall is enabled.

I tried below Netsh command to turn off firewall on remote PC but it didn’t work.

Netsh –r –u admin –p Password –c advfirewall set allprofiles state off

Then, I learnt about PsExec command. PsExec is a light-weight telnet replacement that allows users to run programs executable files on remote machines. First, you will have to download PSTools. Click Here to download it.

Once you’ve downloaded PSTools, unzip the file and copy PsExec to executable path. I copied file to C:\.

Run following command to turn off filewall on remote PC using PsExec:

C:\> psexec ComputerName –u username –p password cmd

  • ComputerName  - replace it with the remote computername
  • Username – replace it with your admin user name
  • Password – enter your admin user account password
This will open a command line for that remote PC; enter this command to disable firewall:

C:\Windows\System32>Netsh advfirewall set allprofiles state off

This command will turn off all firewall profiles. If you want to turn off only current profile, replace allprofiles with currentprofile. Type “ON” instead of “OFF” if you want to turn ON firewall.

I hope you find this article informative.

Disclaimer: does not conceal the possibility of error and shortcomings due to human or technical factors. does not bear responsibility upon any loss or damage arising from conduct or activities related to the use of data and information contained in this blog.

1 comment: