Forum Discussion
asif300
Jan 12, 2023Copper Contributor
Start-RSJob PowerShell
# I want to use try catch and is not working Import-Module PoshRSJob $hashtable = [hashtable]::Synchronized(@{}) $hashtable.host = $host $hashtable.mutex = [System.Threading.Mutex]::new() $has...
- Jan 16, 2023So... is the try-catch for checking if the user is in AD or not? You could change "$Res=Get-Aduser $user -Properties Name, EmailAddress | Select Name, EmailAddress" to "$Res=Get-Aduser $user -Properties Name, EmailAddress -Erroraction Stop | Select Name, EmailAddress " to stop processing if the user is not found
Jan 16, 2023
So... is the try-catch for checking if the user is in AD or not? You could change "$Res=Get-Aduser $user -Properties Name, EmailAddress | Select Name, EmailAddress" to "$Res=Get-Aduser $user -Properties Name, EmailAddress -Erroraction Stop | Select Name, EmailAddress " to stop processing if the user is not found