我正在计划进行域迁移,我想了解哪些计算机对象已启动并正在运行。已经尝试了命令“dsquery computer domainroot -stalepwd”,但我仍然对输出有些怀疑。有人还有其他建议吗?
提前致谢!
日本足协
答案1
假设 PowerShell 脚本是可以接受的,这是 Matt Vogt 提供的脚本。
https://gallery.technet.microsoft.com/scriptcenter/Get-Inactive-Computer-in-54feafde
# Gets time stamps for all computers in the domain that have NOT logged in since after specified date
# Mod by Tilo 2013-08-27
import-module activedirectory
$domain = "domain.mydom.com"
$DaysInactive = 90
$time = (Get-Date).Adddays(-($DaysInactive))
# Get all AD computers with lastLogonTimestamp less than our time
Get-ADComputer -Filter {LastLogonTimeStamp -lt $time} -Properties LastLogonTimeStamp |
# Output hostname and lastLogonTimestamp into CSV
select-object Name,@{Name="Stamp"; Expression={[DateTime]::FromFileTime($_.lastLogonTimestamp)}} | export-csv OLD_Computer.csv -notypeinformation
将 $domain 值更改为您的域,并将 $DaysInactive 更改为您想要的任意时间长度。