Thursday, November 20, 2014

Powershell: How to find your Domain Controllers AND confirm a Hotfix has been installed.

On Nov 18th 2014 Microsoft released the following significant Out-of-band security patch.  (If you haven't already, INSTALL IT!):
https://support.microsoft.com/kb/3011780

I was asked to confirm that all the Domain Controllers have been patched in our region.  I leveraged Powershell to get the information quickly. 

First, get a dump of all the DCs in your environemnt:
Get-ADDomainController -Filter * | select name

After getting the names of the DCs, use get-hotfix against the DC(s):
Get-HotFix -Id KB3011780 -ComputerName mydomaincontroller

Our environment is relatively big.  So, I created a csv file (dcs.csv) which contained the names of the DCs and ran the following:
 Import-csv E:\dcs.csv | ForEach-Object {Get-HotFix -Id kb3011780 -computername $_.computername}
 

No comments:

Post a Comment