Thursday, May 2, 2013

Powershell - Extract a list of computer accounts as well as Operating system and Service pack levels


You may use the below commands to extract a list of computer accounts as well as Operating system and Service pack levels:

Open Powershell and then run the below cmd to import AD module:

Import-module ActiveDirectory

Once module is imported run the below command to extract a list of the Computer accounts in AD as well as their Operating system and service pack level:

Get-ADComputer -Filter * -Property * | Format-Table Name,OperatingSystem,OperatingSystemServicePack,OperatingSystemVersion -Wrap –Auto >ComputerExtract.txt

This will create a text file with the output.