-
PVS V4.1 Documentation Script Has Been Updated 3-FEB-2014
In my article for the Provisioning Services (PVS) 4.12 script, I stated “There are two items I have yet to find in the PVS PowerShell Programmers Guide: Boot production devices from version and which version is the current booting version (the one with the green checkmark)”. Thankfully a member of the Citrix Provisioning Services team reached out to offer help. This article explains how the missing items were implemented.
It turns out the property used for the Access column is also used to determine the Boot production devices from version and is part of the puzzle for the current booting version.
The logic goes like this:
Any vDisk that has access property value of “Override” (access=3) is what is used for both Boot production devices from version and is the current booting version since it was manually selected.
Otherwise, the vDisk with the highest version number is the current booting version IF the IsPending property is False (IsPending=0).
I asked programming super genius Remko Weijnen for help and he told me to use Where-Object and Measure-Object but neither of those worked with the vomit inducing PVS “PowerShell” implementation.
Here is the code I created to see if the booting version was manually selected and what the highest version number with IsPending of False.
#get the current booting version #by default, the $DiskVersions object is in version number order lowest to highest #the initial or base version is 0 and always exists [string]$BootingVersion = "0" [bool]$BootOverride = $False ForEach($DiskVersion in $DiskVersions) { If($DiskVersion.access -eq "3") { #override i.e. manually selected boot version $BootingVersion = $DiskVersion.version $BootOverride = $True Break } ElseIf($DiskVersion.access -eq "0" -and $DiskVersion.IsPending -eq "0" ) { $BootingVersion = $DiskVersion.version $BootOverride = $False } }
I then added a few lines to show the Boot production devices from version and also which vDisk version id the current booting version).
WriteWordLine 0 2 "Boot production devices from version`t: " -NoNewLine If($BootOverride) { WriteWordLine 0 0 $BootingVersion } Else { WriteWordLine 0 0 "Newest released" } WriteWordLine 0 0 "" <snip> WriteWordLine 0 2 "Version`t`t`t`t`t: " -NoNewLine If($DiskVersion.version -eq $BootingVersion) { WriteWordLine 0 0 "$($DiskVersion.version) (Current booting version)" } Else { WriteWordLine 0 0 $DiskVersion.version }
To test I first used the defaults.
vDisk Versions Defaults Here is the output from my report.
vDisk Versions Boot production devices from version: Newest released Version : 0 Created : 2014-01-27 18:26 Devices : 0 Access : Production Type : Base Can Delete : No Can Merge : No Can Merge Base : No Can Promote : No Can Revert back to Test : No Can Revert back to Maintenance : No Can Set Scheduled Date : No Can Override : Yes Is Pending : No, version Scheduled Date has occurred Replication Status : Available on all servers Disk Filename : Win7Test.vhd Version : 1 Created : 2014-01-28 11:34 Devices : 0 Access : Production Type : Manual Properties : Install Acrobat Reader 11.0.6 Can Delete : No Can Merge : No Can Merge Base : No Can Promote : No Can Revert back to Test : No Can Revert back to Maintenance : No Can Set Scheduled Date : No Can Override : Yes Is Pending : No, version Scheduled Date has occurred Replication Status : Available on all servers Disk Filename : Win7Test.1.avhd Version : 2 (Current booting version) Created : 2014-02-01 17:39 Released : 2014-02-02 05:00 Devices : 3 Access : Production Type : Manual Properties : Just for testing the audit trail. Can Delete : No Can Merge : Yes Can Merge Base : Yes Can Promote : No Can Revert back to Test : Yes Can Revert back to Maintenance : Yes Can Set Scheduled Date : Yes Can Override : Yes Is Pending : No, version Scheduled Date has occurred Replication Status : Available on all servers Disk Filename : Win7Test.2.avhd
Then I manually selected a version for booting.
Manually selected boot version Here is the output from my report.
vDisk Versions Boot production devices from version: 1 Version : 0 Created : 2014-01-27 18:26 Devices : 0 Access : Production Type : Base Can Delete : No Can Merge : No Can Merge Base : No Can Promote : No Can Revert back to Test : No Can Revert back to Maintenance : No Can Set Scheduled Date : No Can Override : Yes Is Pending : No, version Scheduled Date has occurred Replication Status : Available on all servers Disk Filename : Win7Test.vhd Version : 1 (Current booting version) Created : 2014-01-28 11:34 Devices : 3 Access : Override Type : Manual Properties : Install Acrobat Reader 11.0.6 Can Delete : No Can Merge : No Can Merge Base : No Can Promote : No Can Revert back to Test : No Can Revert back to Maintenance : No Can Set Scheduled Date : No Can Override : No Is Pending : No, version Scheduled Date has occurred Replication Status : Available on all servers Disk Filename : Win7Test.1.avhd Version : 2 Created : 2014-02-01 17:39 Released : 2014-02-02 05:00 Devices : 0 Access : Production Type : Manual Properties : Just for testing the audit trail. Can Delete : No Can Merge : Yes Can Merge Base : Yes Can Promote : No Can Revert back to Test : Yes Can Revert back to Maintenance : Yes Can Set Scheduled Date : Yes Can Override : Yes Is Pending : No, version Scheduled Date has occurred Replication Status : Available on all servers Disk Filename : Win7Test.2.avhd
Script version is now 4.13. And Shane Kleinert should now have all his vDisk Versions information he asked for.
NOTE: This script is continually updated. You can always find the most current version by going to https://carlwebster.com/where-to-get-copies-of-the-documentation-scripts/
Thanks
Webster
February 3, 2014
PowerShell, PVS