Posted On March 29, 2019

Last Logon Dates of List of AD Accounts

kimconnect 0 comments
blog.KimConnect.com >> Codes , Windows >> Last Logon Dates of List of AD Accounts
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

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

Some Common SysAdmin Tools

LAN Speed Test: https://totusoft.com/lanspeedPutty: https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.htmlCutePDF: http://www.cutepdf.com/Products/CutePDF/writer.aspRemote Desktop Manager: WAN IP: https://ipchicken.com/Chrome: https://www.google.com/chrome/Firefox: https://www.mozilla.org/en-US/firefox/download/thanks/?scene=2#download-fxFlash: Java: TextPad:…

Linux: Creating Soft Links as Directories

Optional test: create a soft-link for directory as hard-links are not allowed source=/nfs-share/linux03/docker/containers destinationdirectory=/var/lib/docker sudo…

Veeam: Hyper-V ConfigStoreRootPath Errors

Error Message ---------------------------Veeam Backup and Replication---------------------------ConfigStoreRootPath cluster parameter is not defined. We will not be…