Run with Powershell powershell.exe -command "& 'D:\powershell.ps1'" -ExecutionPolicy Bypass
How long script takes?
[datetime]$startDate = Get-Date
[datetime]$endDate = Get-Date
Write-Host $(NEW-TIMESPAN –Start $startDate –End $endDate )
Find duplicate user values
Get-ADUser -Filter { employeeID -like “*” } -SearchBase “OU=yourOU,DC=domain,DC=com” -property employeeID | Group-Object employeeID | Where-Object {$_.Count -ge 2} | select -ExpandProperty group | Select-Object Name, UserPrincipalName, SamAccountName, employeeID