Query Windows Firewall with PowerShell command, switch it on and off

PowerShell Windows FAQ Some time ago we already reported how you can switch the Windows Firewall on and off relatively quickly using the PowerShell command . Today we would like to go into this in more detail and show further possibilities with PowerShell .

Of course, you can also make any changes and status queries via the Windows GUI (Graphical User Interface) , but this is sometimes quite cumbersome and takes a long time. Using Windows PowerShell , this works very easily and quickly. With the following PowerShell command you can query the status of the Windows Firewall, for example .

netsh advfirewall show allprofiles

netsh advfirewall show allprofiles

After issuing the PowerShell command, you can quickly and easily see the status of the firewall in the areas

  • Domain profile
  • Private profile
  • public profile

located. In addition, you will be shown other useful Windows Firewall information. Of course, you can also only display the area that interests you. The appropriate PowerShell commands are then:

netsh advfirewall show domainprofile
netsh advfirewall show privateprofile
netsh advfirewall show publicprofile

If you are currently not quite clear which of the 3 profiles is currently active, you can very easily query this with the following PowerShell command:

netsh advfirewall show currentprofile

You can switch the Windows Firewall off and on again using the following PowerShell commands:

netsh advfirewall set allprofiles state of
netsh advfirewall set allprofiles state on

If you know any other interesting PowerShell commands , we would be very happy to receive a corresponding comment here. We have summarized here below an overview of numerous contributions, in which we have dealt with the topic ” PowerShell ” in more detail.

Read out computer system information with PowerShell – Prepare the Windows client for remote PowerShell commands with WINRM – Edit
local users and groups with
– Determine Windows system runtime with PowerShell – Create Windows 10 system restore point with PowerShell
– Shut down Windows and restart with PowerShell commands
– Repair Windows component stores with DISM and PowerShell commands
– Switch off UAC (user account control ) via PowerShell or registry in Windows 10
– PowerShell command to deactivate the firewall