If I only want to trap an exception when a user already exists, what type of Exception should I trap?
for instance:
[UserAlreadyExistsException]
trap{
#forget about it....
}
[AnyOtherException]
trap{
#PANIC!
}
$newUser = New-QADUser -name $line.UserID -ParentContainer 'OU=Symetra,DC=CI3DOMAIN,DC=local' -samAccountName $line.UserID -UserPassword 'p' -DisplayName $line.APPROVER -Department $line.Department -Description "$approver from $department" -ErrorAction SilentlyContinue
Update!
I was just notified here that the exception thrown is system.DirectoryServices.DirectoryServicesComException