Get Windows Firewall State on Local or Remote Machine Utilizing Netsh.exe

Displays the Windows Firewall state forĀ Domain, Private, and Public profiles on local or remote computer.

UseĀ Get-FirewallState to show current Firewall state that is presented on the Windows Firewall with Advanced Security Properties page, with the tabs for Domain, Private, and Public profiles.

Specifies the remote or local computer name.
When using HOSTNAME parameter, Windows PowerShell creates a temporary connection that is used only to run the specified command and is then closed.

Get-FirewallState -HOSTNAME SERVER01

The script will establish remote connection to SERVER01 machine and display the Firewall state for all profiles:




Test-AWSEC2 – Detect if a virtual host is running on Amazon EC2

Amazon EC2 Instances have metadata they can access. They get it by accessing a web server on a link-local address
This PowerShell function will attempt to open http connection to the link-local address, and if successful will confirm that the host is running on Amazon Elastic Compute Cloud (Amazon EC2).

Function run on AWS EC2 virtual machine.
Function run on AWS EC2 virtual machine.