I have created a script to remove AD user from DC , script execute all the time even user exists or does not exists.
Can we handle exception for action status if user does not exist comes as status failed or some message or should not be executed at all??
action parameter query "Identity" with description "Please enter the AD User account" with default value ""
// Enter your action script here
// Disable wow64 redirection on x64 OSes
action uses wow64 redirection {not x64 of operating system}
delete __createfile
// CREATEFILE
createfile until END_OF_FILE
Remove-ADUser -Identity {parameter “Identity”} -Confirm:$false
END_OF_FILE
delete powershell.ps1
move __createfile powershell.ps1
waithidden { pathname of file ((it as string) of value “Path” of key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell” of native registry) } -ExecutionPolicy Bypass -File powershell.ps1