![通过 Powershell 更改上次计算机帐户密码](https://linux22.com/image/796569/%E9%80%9A%E8%BF%87%20Powershell%20%E6%9B%B4%E6%94%B9%E4%B8%8A%E6%AC%A1%E8%AE%A1%E7%AE%97%E6%9C%BA%E5%B8%90%E6%88%B7%E5%AF%86%E7%A0%81.png)
有人知道如何通过 powershell 获取域中所有服务器的最后一次计算机帐户密码更改吗?
答案1
http://www.rlmueller.net/PwdLastChanged.htm
http://blogs.metcorpconsulting.com/tech/?p=1369
来自上述链接:
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