Tag Archives: powershell

Ever created a lot of nice group policy items and come back to them a year or two later and think “Well where did I apply that firewall rule?” or “Where do I set up servers as Remote Desktop Session hosts?” ?

Powershell saves the day once again.

On a Domain Controller, import the AD Group Policy module

Import-Module GroupPolicy


Get-GPO -All | ForEach-Object {Get-GPOReport -Guid $_.Id -Path ($_.DisplayName + ".html") -ReportType HTML}

This gives you a nice collection of HTML files in the folder where you executed the script. They will contain the defined elements of your Group Policy item.

This tip is mostly useful in you have large generic GP items like “Windows Server” or “Customer Server”. I have learnt to keep my GP items simple-stupid, like “Firewall Allow TCP 80 Inbound” or “Allow Remote Desktop Connections”


Sometimes you just want a new firewall rule, you know that it doesn’t conflict with anything else and you want it simple.

The solution ? Powershell. Many other pages explain the powershell commands for managing the firewall in detail. For me, that made it harder to memorize what I was actually looking for, so I had to look it up the next time as well. So I decided to write down the simplest of all on this page.

This command will create a new firewall rule allowing incoming TCP connections on port 80 for all profiles:

New-NetFirewallRule -Name allowTcp80 -DisplayName "Allow Inbound Port 80" –LocalPort 80 -Protocol TCP

If you omit -Name a GUID will be assigned as the rule name. When you create a name yourself, it will be easier if you want to do more management from Powershell.