$domaindetail = get-addomain $domaincontrollers = $domaindetail.ReplicaDirectoryServers + $domaindetail.ReadOnlyReplicaDirectoryServers foreach ($dc in $domaincontrollers) { invoke-command -computer $dc -scriptblock { $oomads = gwmi -query "select caption from win32_product where identifyingnumber='{3696BAB3 -3B1B-42C3-8D46-1898E59E7C84}'"|select caption if ($oomads -ne $null) { write-output -input ($env:computername + ",INSTALLED") } else { write-output -input ($env:computername + ",NOTINSTALLED") } } -asjob -jobname ("$dc-oomads") } #these queries are slow, so we need to wait on the jobs to finish while ( (get-job |where {$_.name -match "oomad" -and $_.state -eq "Running"}) -ne $null) { sleep 30 } get-job |where {$_.name -match "oomad"} |Receive-Job get-job |where {$_.name -match "oomad"} |Remove-Job
Wednesday, April 15, 2015
(SCOM) Checking to see if AD Helper object has been installed
This script will check all of the domain controllers in the current domain for the presence of oomads (AD Helper Object). It uses jobs to help speed things up as the WMI product query is very slow. Once all jobs finish it will dump the results in csv type format.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment