| 用途 | 查询计算机对象 |
|---|---|
| 语法 | Get-ADComputer -Filter 'Name -like "PC-*"' -Properties OperatingSystem, LastLogonDate |
| 常用过滤 | Enabled、OperatingSystem、LastLogonDate |
常用示例
常用示例
Get-ADComputer -Filter 'Name -like "APP-*"' -Properties OperatingSystem, LastLogonDate, Description | Select-Object Name, OperatingSystem, LastLogonDate
# 长期未登录(>90 天)
$cut = (Get-Date).AddDays(-90)
Get-ADComputer -Filter 'LastLogonDate -lt $cut' -Properties LastLogonDate | Select-Object Name, LastLogonDateLastLogonDate 来自复制同步的近似值,做清理决策前用多个时间源交叉验证。