Run RSOP in PowerShell to multiple computers

If you have the need to apply any changes on multiple computers via GPO, you may find there’s a single or some computers that were not applied the changes. To start the troubleshooting, you may need to know whether the problematic computers are already GPO-applied or not.

From the GUI, you can check it from the Group Policy result, but you will get the limitation that the GPO result only support for single computer and user. If you need to run it to a single computer, for alternatively you can use this command to get the RSOP from a computer remotely. Change the parameter as you want.

For single Computer.

Get-GPResultantSetOfPolicy -Computer ComputerName -ReportType Html -Path "C:\Install\GPresult.html"

For single Computer and its User

Get-GPResultantSetOfPolicy -Computer ComputerName -User "Domain\user" -ReportType Html -Path "C:\Install\computer.html"


If you have the need to run to the multiple computers, the following script may help you to get the RSOP from the multiple computers, and export it as html.

This is scenario if you have the listed computer and stored in a txt file.

$Serverlist = Get-content "C:\Install\GPResult\list.txt"
$path = "C:\Install\GPResult\"

Foreach ($result in $Serverlist) 
{
Write-Host "Getting RSOP from the" $result "Computer"
Get-GPResultantSetOfPolicy -Computer $result -User "DOMAIN\user" -ReportType html -Path $path\$result.html
}

This is scenario if you want to run the RSOP to any computes on a specified AD group.

$Serverlist = Get-ADGroupMember -Identity RSOPGroup
$path = "C:\Install\GPResult\"

Foreach ($result in $Serverlist.name) 
{
Write-Host "Getting RSOP from the" $result "Computer"
Get-GPResultantSetOfPolicy -Computer $result -User "DOMAIN\user" -ReportType html -Path $path\$result.html
}


Hope this help

Thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *