CtxUpdate – a powershell script to download any Citrix updates

Inspired by the AutoCPS update script by http://www.thomaskoetzing.de I created this powershell script to download all hotfixes for Citrix Products by using the hotfix RSS feeds.

This scrip does not install the updates, it just downloads and extracts the files into your hotfix folder.

The script uses Powershell ISE, to install it, run the following powershell commands first:

  • Import-Module ServerManager
  • Add-WindowsFeature PowerShell-ISE

When you run it, you will get a menu to select product to get hotfixes for. You may add the RSS feed for other products in the script to extend the product list.

Select the updates you want to download in the gridview, and hit OK to start the download process.

By default, c:CTXUPDATE folder is used for downloads, this may be modified in the script.

Here is the script: (You may also download the script here: DOWNLOAD)

Write-Host
“Choose Citrix product to update.”

Write-Host
“1. XenApp 6.5”

Write-Host
“2. XenApp 6.0”

Write-Host
“3. XenApp 5.0”

Write-Host
“4. PVS 6.1”

Write-Host
“5. PVS 6.0”

Write-Host
“6. PVS 5.6”

Write-Host
“7. XenDesktop 5.6”

Write-Host
“8. XenDesktop 5.5”

Write-Host
“9. XenDesktop 5.0”

Write-Host
“10. Xenserver 6.1”

Write-Host
“11. Xenserver 6.0”

Write-Host
“12. Xenserver 5.6”

Write-Host
” “

$a
=
Read-Host
“Select 1-12: “

Write-Host
” “

switch ($a)

{


1 {


$url
=
“http://support.citrix.com/product/xa/v6.5_2008r2/hotfix/general/?rss=on”


$path=
“c:CTXUPDATEXA65”

}


2 {


$url
=
“http://support.citrix.com/product/xa/v6.0_2008r2/hotfix/general/?rss=on”


$path=
“c:CTXUPDATEXA60”

}


3 {


$url
=
“http://support.citrix.com/product/xa/v5.0_2008/hotfix/general/?rss=on”


$path=
“c:CTXUPDATEXA50”

}


4 {


$url
=
“http://support.citrix.com/product/provsvr/pvsv6.1/hotfix/general/?rss=on”


$path=
“c:CTXUPDATEPVS61”

}


5 {


$url
=
“http://support.citrix.com/product/provsvr/pvsv6.0/hotfix/general/?rss=on”


$path=
“c:CTXUPDATEPVS60”

}


6 {


$url
=
“http://support.citrix.com/product/provsvr/pvsv5.6/hotfix/general/?rss=on”


$path=
“c:CTXUPDATEPVS56”

}


7 {


$url
=
“http://support.citrix.com/product/xd/v5.6/hotfix/general/?rss=on”


$path=
“c:CTXUPDATEXD56”

}


8 {


$url
=
“http://support.citrix.com/product/xd/v5.5/hotfix/general/?rss=on”


$path=
“c:CTXUPDATEXD55”

}


9 {


$url
=
“http://support.citrix.com/product/xd/v5/hotfix/general/?rss=on”


$path=
“c:CTXUPDATEXD50”

}


9 {


$url
=
“http://support.citrix.com/product/xens/v6.0/hotfix/general/public/?rss=on”


$path=
“c:CTXUPDATEXS60”

}


10 {


$url
=
“http://support.citrix.com/product/xens/v6.1/hotfix/general/public/?rss=on”


$path=
“c:CTXUPDATEXS61”

}


11 {


$url
=
“http://support.citrix.com/product/xens/v6.0/hotfix/general/public/?rss=on”


$path=
“c:CTXUPDATEXS60”

}


12 {


$url
=
“http://support.citrix.com/product/xens/v5.6/hotfix/general/public/?rss=on”


$path=
“c:CTXUPDATEXS56”

}


default {


$url
=
“”


$path=
“”

}

}

Write-Host
“Citrix hotfix update script”

$wc
=
New-Object
net.webclient

[xml]$xml =
$wc.DownloadString($url)

$xml.rdf.item|Select
Title, Description, Link |

out-gridview
-Title
“Select hotfixes to download”
-PassThru
|
% {

$result
=
Invoke-WebRequest
$psitem.link

$link= $result.links |
Where
title
-eq
“Download”|
Select
-First
1
-ExpandProperty
href

$filename=$link.substring(($link.lastindexOf(“/”)+1),($link.Length$link.lastindexOf(“/”)1))

$foldername=$filename.substring(0,($filename.lastindexOf(“.”)))

if (Test-Path ($path
+
“”
+
$filename)){

Write-Host
“Skipping $filename

}

else{

Write-Host
“Downloading $filename

$wc.DownloadFile(“https://support.citrix.com”
+ $link, $path

+
“”
+
$filename)

Write-Host
“Unzipping $filename

md ($Path
+
$foldername)

$shell_app=new-object
-com
shell.application

$zip_file
=
$shell_app.namespace($path
+
$filename)

$destination
=
$shell_app.namespace($Path
+
$foldername)

$destination.Copyhere($zip_file.items())

}

}

12 thoughts on “CtxUpdate – a powershell script to download any Citrix updates

  1. Sounds nice, but the website doesnot like to let the code go. Even after removing most of the cr lf the script does not want to run. Something is wrong around “PassThru”

  2. Hi, the script seems to break around the line
    “-Title “Select hotfixes to download” -PassThru” It errors on the passthru portion.

  3. Pingback: Fastest way to patch Xenserver using a script | Virtual eXperience

  4. Pingback: Fastest way to patch Xenserver using a script | Conde Malagueta

  5. Unfortunately the script does not work anymore. The URLs are borken. Can you please update this script.
    Would be really great!

  6. hello

    thanks for the script
    where/ how can i found the rss link for new versions?

    for example
    xenapp 7.5
    xendesktop 7.6

    thanks

Leave a Reply

Your email address will not be published. Required fields are marked *

*