Beat the auditors, be one step ahead with PowerShell! 

Summary: Microsoft PFE, Georges Maheu, opens his security assessment toolbox to discuss a Windows PowerShell script he uses to look at Windows services. This script will make an inventory of all services running on your computers and will identify which ones are using non standard service accounts. The inventory is presented in an Excel spreadsheet.

The first step is to generate a list of targeted computers. This can be accomplished with this command:

 

PowerShell
Edit|Remove
([adsisearcher]"objectCategory=computer").findall() |  
  foreach-object {($_.properties).cn} |  
  out-file -Encoding ascii -FilePath computerList.txt
 The second step is to run the script:

 

PowerShell
Edit|Remove
&".\1 - Get-Services - Simple Version 1.0.ps1"

The third step is to read the “Hey Scripting Guy” blog series and discover how to document service accounts with PowerShell, Excel Office Automation and WMI. The blog series discusses how the original script can be optimized to go from documenting 50 computers in 90 minutes down to 42 seconds.

Blog articles: 

http://blogs.technet.com/b/heyscriptingguy/archive/2012/01/31/beat-the-auditors-be-one-step-ahead-with-powershell.aspx

http://blogs.technet.com/b/heyscriptingguy/archive/2012/02/01/speed-up-excel-automation-with-powershell.aspx 

http://blogs.technet.com/b/heyscriptingguy/archive/2012/02/02/speed-up-excel-automation-with-powershell-jobs.aspx

http://blogs.technet.com/b/heyscriptingguy/archive/2012/02/03/increase-performance-by-slowing-down-your-powershell-script.aspx