Wednesday, July 26, 2017

Inventory Using AD Module for Powershell



I wanted to go away from so many command shells for fishing information out of AD.

Quest has done well, but I'm in AD PowerShell all the time.


After many modifications, this the refined working method.


Get-ADComputer -Filter * -Property * | Select-Object -Property Name,OperatingSystem,OperatingSystemServicePack,OperatingSystemVersion,LastLogonDate | Sort-Object -Property Name | Export-CSV C:\Apps\Inventory20170726.csv




The properties can be added to, but the "Sort-Object -Property Name" with a chosen value before the "| Export-CSV C:\Apps\Inventory20170726.csv"   seemed to keep the report from becoming a single column of representative numbers.