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.
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