{"id":94,"date":"2017-09-11T23:07:49","date_gmt":"2017-09-11T22:07:49","guid":{"rendered":"http:\/\/www.stevenhodson.com\/?p=94"},"modified":"2017-09-11T23:13:29","modified_gmt":"2017-09-11T22:13:29","slug":"powershell-script-to-find-lastlogondate-and-passwordlastset-information-from-active-directory-for-list-of-computers-in-a-text-file","status":"publish","type":"post","link":"https:\/\/www.stevenhodson.com\/?p=94","title":{"rendered":"PowerShell Script to find LastLogonDate and PasswordLastSet information from Active Directory for list of computers in a text file"},"content":{"rendered":"<div class=\"codecolorer-container text default\" style=\"overflow:auto;white-space:nowrap;width:600px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/><\/div><\/td><td><div class=\"text codecolorer\">[Array]$OutList = foreach ($computer in Get-Content -Path C:\\Temp\\InputFile.txt) {<br \/>\nGet-ADComputer -Identity $computer -Property LastLogonDate, PasswordLastSet -ErrorAction SilentlyContinue | select Name, LastLogonDate, PasswordLastSet<br \/>\n}<br \/>\n$OutList | Export-CSV C:\\Temp\\OutputFile.csv -NoTypeInformation<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n","protected":false},"excerpt":{"rendered":"<p>1234[Array]$OutList = foreach ($computer in Get-Content -Path C:\\Temp\\InputFile.txt) { Get-ADComputer -Identity $computer -Property LastLogonDate, PasswordLastSet -ErrorAction SilentlyContinue | select Name, LastLogonDate, PasswordLastSet } $OutList | Export-CSV C:\\Temp\\OutputFile.csv -NoTypeInformation<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-94","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.stevenhodson.com\/index.php?rest_route=\/wp\/v2\/posts\/94","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.stevenhodson.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.stevenhodson.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.stevenhodson.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.stevenhodson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=94"}],"version-history":[{"count":3,"href":"https:\/\/www.stevenhodson.com\/index.php?rest_route=\/wp\/v2\/posts\/94\/revisions"}],"predecessor-version":[{"id":97,"href":"https:\/\/www.stevenhodson.com\/index.php?rest_route=\/wp\/v2\/posts\/94\/revisions\/97"}],"wp:attachment":[{"href":"https:\/\/www.stevenhodson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=94"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.stevenhodson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=94"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.stevenhodson.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=94"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}