brigzzy

XenServer 6.2 updater

Aug 9th, 2013
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 1.96 KB | None | 0 0
  1. ; Automatic updating script for XenServer 6.2.  Just download and unzip the updates to your local PC,
  2. ; run this script, and it'll take care of the rest. Please send any bugs you find to me!
  3. ; Brigzzy - brigzzy <at> gmail <dot> com
  4.  
  5. HotKeySet ("{ESC}", "quit" )
  6.  
  7. $hostname = InputBox ( "Hostname", "Please enter the hostname or IP of the server or pool master to be updated." )
  8. $username = InputBox ( "Username", "Please enter the username." )
  9. $password = InputBox ( "Password", "Please enter the password.", "", "*" )
  10.  
  11. $updatename = FileOpenDialog("Select you Update", "E:\Citrix\", "XenServer Updates (*.xsupdate)", 1 )
  12.  
  13. $array1 = StringSplit ( $updatename & "", '\')
  14. $ubound = UBound ( $array1 )
  15. $last = $ubound -1
  16. $array2 = StringSplit ( $array1[$last] & "", '.' )
  17. $updatenumber = $array2[1]
  18.  
  19. run( "cmd.exe", "C:\Program Files (x86)\Citrix\XenCenter" )
  20. WinWaitActive ( "Administrator: C:\Windows\system32\cmd.exe" )
  21. send ( "xe.exe patch-upload -s " & $hostname & " -u " & $username & " -pw " & $password & " file-name=" & $updatename & " > C:\tmpcitrix.txt" )
  22. sleep (200)
  23. send ( "{ENTER}" )
  24. sleep (1000)
  25. $tempfile = FileOpen("C:\tmpcitrix.txt", 0)
  26. sleep (500)
  27. $fileread = fileread ( $tempfile )
  28. sleep ( 3000 )
  29.  
  30. send ( "xe -s " &  $hostname & " -u " & $username & " -pw " & $password & " patch-pool-apply uuid=" & $fileread )
  31. sleep (200)
  32. send ("{ENTER}")
  33. sleep (2000)
  34. FileClose ( $fileread )
  35. send ( "xe patch-list -s " & $hostname & " -u " & $username & " -pw " & $password & " name-label=" & $updatenumber )
  36. sleep (200)
  37. send ("{ENTER}")
  38. MsgBox ( 0, "Done", "The patch is applied.  Please check the terminal to verify it, then press OK to exit (The terminal will close automatically")
  39. WinActivate ( "Administrator: C:\Windows\system32\cmd.exe" )
  40. WinWaitActive ( "Administrator: C:\Windows\system32\cmd.exe" )
  41. FileDelete ( "C:\tmpcitrix.txt" )
  42. send ( "exit" )
  43. sleep (200)
  44. send ("{Enter}")
  45.  
  46. Func quit()
  47.    FileDelete ( "C:\tmpcitrix.txt" )
  48.    Exit
  49. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment