Today, I would like to start new tradition – series of blog posts about useful scripts that you can use to simplify the management and troubleshooting of your PVS environment. To give you some sneak peak, I’m going to talk about automatic replication of your vDisks, I would like to talk about getting balloon notifications when your write cache is running out of space or how you can write event log entries when your targets are exceeding allowed amount of retries.

But that’s for future, so what do I have for you today?

As I’ve explained before, I like to automate and simplify repeating tasks. Patching of PVS servers is quite repetitive, especial the first build when you need to patch everything from scratch.  First script I would like to share with you is used to simplify the patch management for your PVS servers.

First of all, let me set the expectations right and warn you limitations – this script doesn’t updating of target devices. There, I said it, now let’s move to the good news! 🙂

Features

1.)    Archives (.zip) are automatically parsed
2.)    Proper location which files needs to be replaced is automatically detected
3.)    Files are replaced based on version\hash (patcher won’t overwrite newer file)
4.)    Information is stored to event log (replaced file + originating hotfix)
5.)    Original files are backed up automatically
6.)    Detects conflicted patches (same file in multiple patches)
7.)    Platform (32\64bit) is automatically selected
8.)    PVS services are automatically stoped\started
9.)    Supports –WhatIf switch, so you can see in advance what is going to happen

Usage

I tried to keep usage as simple as possible. All you need to do is to download all patches at once, save it to any folder and run patcher. By default, patcher will try to find the patches in CDROM drive, so if you don’t use .iso file with latest patches, you must specify “-Source” argument to show it where you store your patches (folder).

You don’t need to modify or extract the patches – patcher will do it automatically and if patch is platform specific (32\64bit OS), it will automatically choose correct subfolder to use.

Supported arguments

Basic arguments (optional):

–          Source -> folder where you store the patches
–          Verbose -> Used for troubleshooting only
–          WhatIf -> Patcher doesn’t replace any files, just display what it would like to do
–          NoBackup -> Do no create backup copies of replaced files
–          NoSummary -> Skip the summary at the end
–          NoEventLog -> Don’t write any information in the event log

Advanced arguments (even more optional):

–          WorkingDirectory -> Current working directory
–          Filter -> Archive file filter (by default *.zip)
–          ScanLocations -> Folder where PVS is storing all executables

When you run the PVS patcher, you should see similar output to this (notice I haven’t specified -Source, since I’m using mounted .iso)

PVS Patcher in action

At the end of the execution, you will also get a summary where you can see what was done:

PVS Patcher Summary

However, if you’ve got Powershell ISE installed (not installed by default on Windows OS), you will get nice table (ignore the status – I’ve just used my laptop to capture it without PVS installation):

PVS Patcher with Powershell ISE

Status codes

“File updated”                                                   – File successfully updated
“File update failed (file in use?)”                –  Patcher tried to replace file, but operation failed
“Same file (version info)”                             – File in patch is the same version as target file (can be used together with –WhatIf to identify current patch level!)
“Same file (hash)”                                           – Hashes are the same (can be used together with –WhatIf to identify current patch level!)
“Existing file is newer”                                   – File versions are different, but existing file is newer that the one in the patch file
“Client patch”                                                    – Patch is used for target device, not for server
“Multiple destination files, conflict”         – There are multiple files with same name (destination), cannot decide which one is valid. Shouldn’t happen
“Destination not found”                               -Destination was not found

Now, before presenting the download link, please read word by word our popular disclaimer:
“This software application is provided to you “as is” with no representations, warranties or conditions of any kind. You may use and distribute it at your own risk. CITRIX DISCLAIMS ALL WARRANTIES WHATSOEVER, EXPRESS, IMPLIED, WRITTEN, ORAL OR STATUTORY, INCLUDING WITHOUT LIMITATION WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NONINFRINGEMENT. Without limiting the generality of the foregoing, you acknowledge and agree that (a) the software application may exhibit errors, design flaws or other problems, possibly resulting in loss of data or damage to property; (b) it may not be possible to make the software application fully functional; and (c) Citrix may, without notice or liability to you, cease to make available the current version and/or any future versions of the software application. In no event should the code be used to support of ultra-hazardous activities, including but not limited to life support or blasting activities. NEITHER CITRIX NOR ITS AFFILIATES OR AGENTS WILL BE LIABLE, UNDER BREACH OF CONTRACT OR ANY OTHER THEORY OF LIABILITY, FOR ANY DAMAGES WHATSOEVER ARISING FROM USE OF THE SOFTWARE APPLICATION, INCLUDING WITHOUT LIMITATION DIRECT, SPECIAL, INCIDENTAL, PUNITIVE, CONSEQUENTIAL OR OTHER DAMAGES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. You agree to indemnify and defend Citrix against any and all claims arising from your use, modification or distribution of the code.”

And now, promised link to PVS patcher itself:
https://citrix.sharefile.com/d/s64542ae93f94964a

And don’t forget – if you like it, comment, share and spread the word! 🙂

Martin Zugec