import-module activedirectory
$output=""
Get-Content C:\Users\kimconnect\Desktop\targetAccounts.txt | Foreach-Object -Process{
# cast an array object as string before using string operations
$output+=$_+": "+([string](Get-ADUser $_ -Properties * | Select lastLogonDate) -replace "@{lastLogonDate=*" -replace "}") + "`n"
}
$output
March 29, 2019March 29, 2019
0 Comments