top of page

PowerShell - Get-ADComputer last password change, Find Stale objects

  • Writer: Jon Boyette
    Jon Boyette
  • Jan 11, 2022
  • 1 min read

Populate c:\temp\servers.txt, can copy and paste this or save as a named .ps1, Also information how AD resets the computer password every 30 days, or as long as a machine is online. if you have output that is past 30 days you know the machine has not been on the domain for an auto reset

********For computers, the "pwdlastset/PasswordLastSet" will be the last time the computer account reset its secure channel.********

$computers = get-content C:\temp\servers.txt

ForEach ($comp in $computers)

{

Get-ADComputer $comp -Properties PasswordLastSet | Where {$_.Passwordlastset -ge (Get-date).AddDays(-30)}| Select-Object Name,PasswordLastSet | Export-CSV C:\temp\PasswordLastSet.csv -append -force -NoTypeInformation

}


 
 
 

Recent Posts

See All
PowerShell - List All Domain SPNs

Save as same List_ALL_SPNs.ps1 or similar, this LDap calls the Domain for all Service Principal names and accounts related #Build LDAP...

 
 
 
PowerShell - Start-Monitoring

This is a great script used to Monitor and Email if a server is up or down, once ran, and smtp and from address is set, then run:...

 
 
 

Comments


Post: Blog2 Post
  • Facebook
  • Twitter
  • LinkedIn

©2022 by Boyette Technical Services. Proudly created with Wix.com

bottom of page