Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Automatic updating script for XenServer 6.2. Just download and unzip the updates to your local PC,
- ; run this script, and it'll take care of the rest. Please send any bugs you find to me!
- ; Brigzzy - brigzzy <at> gmail <dot> com
- HotKeySet ("{ESC}", "quit" )
- $hostname = InputBox ( "Hostname", "Please enter the hostname or IP of the server or pool master to be updated." )
- $username = InputBox ( "Username", "Please enter the username." )
- $password = InputBox ( "Password", "Please enter the password.", "", "*" )
- $updatename = FileOpenDialog("Select you Update", "E:\Citrix\", "XenServer Updates (*.xsupdate)", 1 )
- $array1 = StringSplit ( $updatename & "", '\')
- $ubound = UBound ( $array1 )
- $last = $ubound -1
- $array2 = StringSplit ( $array1[$last] & "", '.' )
- $updatenumber = $array2[1]
- run( "cmd.exe", "C:\Program Files (x86)\Citrix\XenCenter" )
- WinWaitActive ( "Administrator: C:\Windows\system32\cmd.exe" )
- send ( "xe.exe patch-upload -s " & $hostname & " -u " & $username & " -pw " & $password & " file-name=" & $updatename & " > C:\tmpcitrix.txt" )
- sleep (200)
- send ( "{ENTER}" )
- sleep (1000)
- $tempfile = FileOpen("C:\tmpcitrix.txt", 0)
- sleep (500)
- $fileread = fileread ( $tempfile )
- sleep ( 3000 )
- send ( "xe -s " & $hostname & " -u " & $username & " -pw " & $password & " patch-pool-apply uuid=" & $fileread )
- sleep (200)
- send ("{ENTER}")
- sleep (2000)
- FileClose ( $fileread )
- send ( "xe patch-list -s " & $hostname & " -u " & $username & " -pw " & $password & " name-label=" & $updatenumber )
- sleep (200)
- send ("{ENTER}")
- MsgBox ( 0, "Done", "The patch is applied. Please check the terminal to verify it, then press OK to exit (The terminal will close automatically")
- WinActivate ( "Administrator: C:\Windows\system32\cmd.exe" )
- WinWaitActive ( "Administrator: C:\Windows\system32\cmd.exe" )
- FileDelete ( "C:\tmpcitrix.txt" )
- send ( "exit" )
- sleep (200)
- send ("{Enter}")
- Func quit()
- FileDelete ( "C:\tmpcitrix.txt" )
- Exit
- EndFunc
Advertisement
Add Comment
Please, Sign In to add comment