你可以:
- 枚举所有具有
employeeID值的帐户
- 根据使用的值对它们进行比较和分组
Group-Object
# Fetch all user accounts with an employeeID
$employeeAccounts = Get-ADUser -Filter 'employeeID -like "*"' -Properties employeeID
# Group them by value of employeeID attribute, keep any group with more than 1 account
$accountsByEmployeeID = $employeeAccounts |Group-Object employeeID |Where-Object Count -gt 1
foreach($ID in $accountsByEmployeeID){
# $accounts will contain a list of accounts with the same employeeID
# you could send an email, file a ticket, or disable one or more of the accounts here
$accounts = $ID.Group
}