我正在嘗試使用以下代碼從 AD 獲取非活動用戶:
# set the date (the number of days)
$NumberOfDays = 60
# set the timeframe ranging for the amount of days entered
$TimeRange = (Get-Date).Adddays(-($NumberOfDay))
# checks for inactive users within 60 days timeframe
Get-ADUser -Filter {LastLogonTimeStamp -lt $TimeRange } -Properties *
我想添加這個額外的過濾器:
Get-ADUser -Filter {Name -like "f_*"} -Properties * | Format-Table Name,SamAccountName
任何人都可以幫助我如何合并這兩個,我是一個新手和掙扎:) .....
uj5u.com熱心網友回復:
“有關使用 -and/-or 運算子的資訊,請參閱此鏈接。類似于 Get-ADUser -Filter {(Name -like "f_*") -and (LastLogonTimeStamp -lt $TimeRange )} – “
來自評論的 Vivek Kumar Singh
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/535820.html
