I'm trying to confirm a certain certificate is installed on all computer in the Trusted Root Certification Authority folder. This is what I have so far:
$Computers = Get-ADComputer -Filter {Enabled -eq $True} -searchbase "OU=xyz,DC=xyz,DC=xyz,DC=com" | select name
foreach($Computer in $Computers){
If (Get-ChildItem -Path Cert:\LocalMachine\Root | Where-Object {$_.Thumbprint -eq "xyz thumbprint"})
{
Write-Host "$computer.Installed"
}
else
{
Write-Host "$computer.Not Installed"
}
}
If I run the if statement on the local machine, it says it's installed. If I run it for the entire OU, it says it's not installed. What am I doing wrong here?