Get-ADComputers lastlogon date using input file and export a CSV file.

 

$Computer = Import-Csv -path “C:\Temp\computers.csv”

$Computer| foreach{Get-ADComputer -Identity $_.name -Properties * |select name, samaccountname, LastLogonDate} | Export-Csv output.csv -NoTypeInformation


Input csv Header:Name

Comments

Popular posts from this blog

Copy file to multiple remote server using powershell