PowerShell – Users not getting GPO

PowerShell – Users not getting GPO. As simple method – use the group policy modeling wizard to show you which users will receive a group policy.

If this is not helped to you, then use this script (change fot yourself data before use):

$ReportFile = "C:\Temp\GPOApplicationReport.CSV"
$STR = "GPO Name, GPO Status, Domain"
 Add-Content $ReportFile $STR
 $TestText=""
 $TotNo=0
 $ThisDomain = "spiceworks.com"
 $PDCServerToConnect="PDC1.spiceworks.com"
 $TotNotAppliedGPO=Get-GPO -All -Domain $ThisDomain -Server $PDCServerToConnect | %{
 $gpoName = $_.displayName
 $GPOStatusNow = $_.GPOStatus
 [int]$counter = 0
 $security = $_.GetSecurityInfo()
 $security | where{ $_.Permission -eq "GpoApply" } | %{
 $counter += 1
 }}
 if ($counter -eq 0)
 {
 $FinalVal=$Gponame+","+$GPOStatusNow+","+$ThisDomain
 Add-Content $ReportFile $FinalVal
 $TotNo++
 }
 IF ($TotNo -eq 0)
 {
 $TestText = "All GPOs have been configured to apply to required objects."
 }
 else
 {
 $TestText = "Some GPOs are NOT applying to any objects. Please check why these GPOs are not applying to any objects. These GPOs might have some policy settings that you are expecting to apply to users and computers."
 }
 $TestText

You might also like

Leave a Reply

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More