Thursday, March 22, 2018

Export AD Computers to CSV file

Import-Module ActiveDirectory
Get-ADComputer -Filter 'OperatingSystem -like "*Server 2008 R2*"' -Properties * |
 Select -Property Name,operatingSystem,@{Name="LastLogon";
Expression={[DateTime]::FromFileTime($_.lastLogon).ToString()}} |
# Export AD Computer Report to CSV file 
Export-CSV "C:\\ADComputers.csv" -NoTypeInformation -Encoding UTF8


We can generate and export all computer details to CSV file by using Export-CSV cmdlet. You can add more attributes in Select -Property field to export more AD attributes. 

No comments:

Post a Comment

SCCM Application Deployment Tool

SCCM Application Deployment Tool Streamlining SCCM Application Deployments: Introducing the SCCM Application Deployment Tool. In the realm o...