Search This Blog

Powershell - Computer Information

import-module ActiveDirectory

$ADComputerParams=@{
'Server' = 'DomainController' 
'Searchbase' = 'OU=Example,DC=DOMAIN,DC=COM'
'Searchscope'= 'Subtree' 
'Filter' = '*' 
'Properties' = '*' 
}

$Computers = get-adcomputer @ADComputerParams | select-object 'name', 'operatingSystem','managedby', @{n='lastLogonTimestamp';e={[DateTime]::FromFileTime($_.lastLogonTimestamp)}}

$Computers | export-csv -delimiter ";" ".\Computers.csv"

No comments:

Post a Comment