Advertisement
Guest User

Try..ing

a guest
Feb 22nd, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. try
  2. {
  3.     Add-PSSnapin "Citrix*"
  4.     function ServerOnline{
  5.         $server = $args[0] # Create a variable named server from the first passed variable
  6.         $isregistered = @(get-brokermachine $server -RegistrationState "Registered")
  7.         foreach ($result in $isregistered){
  8.             return $true}}
  9. }
  10. catch
  11. {
  12.     if ($EnableSMTP -eq $true){$SMTPClient.Send($EmailFrom, $EmailTo, "Unhandled error has occurred in main program: " + $error[0], "")}
  13.     $EventLog.WriteEntry("Unhandled error has occurred in main program: " + $error[0],"Information") # Brute force error handling method to catch all errors
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement