PowerShell Reference

A growing library of PowerShell tools and patterns I've put together as a sysadmin. Public and open-source for anyone who wants to learn, copy, or contribute.

View on GitHub

๐Ÿ“œ Group Policy Management (PowerShell)

PowerShell commands for managing Group Policy Objects (GPOs). Useful for auditing, deployment, and automation in Active Directory environments.


๐Ÿ“‹ List All GPOs

Get-GPO -All

๐Ÿ” Get GPO Details

Get-GPO -Name "Default Domain Policy"

New-GPLink -Name "IT Policy" -Target "OU=IT,DC=example,DC=com" -LinkEnabled Yes

Remove-GPLink -Name "IT Policy" -Target "OU=IT,DC=example,DC=com"

๐Ÿ’พ Backup a GPO

Backup-GPO -Name "IT Policy" -Path "C:\GPOBackups"

โ™ป๏ธ Restore a GPO

Restore-GPO -Name "IT Policy" -Path "C:\GPOBackups"

๐Ÿ“ฆ Import GPO Settings from Backup

Import-GPO -BackupGpoName "IT Policy" -Path "C:\GPOBackups" -TargetName "Imported IT Policy"

๐Ÿงช Test GPO Application on a Computer

gpresult /S PC-001 /USER domain\username /H report.html

๐Ÿ” Force Group Policy Update Remotely

Invoke-GPUpdate -Computer "PC-001" -Force

๐Ÿ“„ Export GPO Settings to HTML

Get-GPOReport -Name "IT Policy" -ReportType Html -Path "C:\Reports\ITPolicy.html"