Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Does anybody know how to get last computer account password change for all servers in a domain via powershell?

share|improve this question
up vote 1 down vote accepted

http://www.rlmueller.net/PwdLastChanged.htm

http://blogs.metcorpconsulting.com/tech/?p=1369
From the above link :

Import-Module activedirectory
[int]$ComputerPasswordAgeDays = 90
IF ((test-path "c:\temp") -eq $False) { md "c:\temp" }
$ExportFile = "c:\temp\InactiveWorkstations.csv"
$ComputerStaleDate = (Get-Date).AddDays(-$ComputerPasswordAgeDays)
$InactiveWorkstations = Get-ADComputer -filter { (passwordLastSet -le $ComputerStaleDate) -and (OperatingSystem -notlike "*Server*") -and (OperatingSystem -like "*Windows*") } -properties Name, DistinguishedName, OperatingSystem,OperatingSystemServicePack, passwordLastSet,LastLogonDate,Description
$InactiveWorkstations | export-csv $ExportFile
share|improve this answer
    
Pretty good! Used the attribute name from the first article in conjunction with dsquery tool to get info about all servers in a domain: dsquery * -scope subtree -attr "cn" "operatingSystem" "operatingSystemServicePack" "pwdLastSet" -filter "(&(objectclass=computer)(objectcategory=computer)(operatingSystem=Windows Server*))" -limit 10000 -uco >C:\output.txt – Volodymyr M. Nov 5 '12 at 14:12
1  
Perhaps, it is worth mentioning what values returned by pwdLastSet attribute are not human readable at all. Here is an article on how to convert these values into human readable Converting LDAP dates – Volodymyr M. Nov 5 '12 at 14:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.