Add credit for checking if AD user already exists

This commit is contained in:
Ray 2024-04-12 19:14:03 +10:00 committed by GitHub
parent b4dff5966f
commit 26f0fc6ef3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 0 deletions

View File

@ -42,6 +42,7 @@ ForEach ($user in $fusers) {
}
# Check if user already exists within OU. Skip if so with message stating so. (RAYYAN Contribution)
# Source for code (https://morgantechspace.com/2016/11/check-if-ad-user-exists-with-powershell.html)
if (Get-ADUser -Filter "SamAccountName -eq '$fname.$lname'") {
Write-Host "User $fname.$lname already exists. Skipping."
} else {