Anwendungsvirtualisierung, Internet der Dinge und Cloud Computing, Blog von Sacha Thomet

Happy New Script – PVS 7.7 HealthCheck

Bald ist Neujahr und ich möchte euch fürs 2016 nur das Beste wünschen! Etwas ganz gutes habe ich euch schon vor dem neuen Jahr, nur einige Stunden nach dem Release vom Citrix Provisioning Server 7.7 kann ich euch auch das neue Health Check Script dazu übergeben. 

Heute hat Citrix die Produkte XenApp/XenDesktop 7.7 und Citrix Provisioning Services 7.7 herausgegeben, mit dabei sind eine Menge von neuen Features aber das wichtigste dabei neben dem Support für Windows 10 ist … Trommelwirbel …. die neue Power Shell APO für Citrix Provisioning Services. PVS mit PoSh bei 7.6 und früher war ein Sch….
Was sonst noch neu ist im PVS 7.7 hier: PVS 7.7 New in this release

Jetzt kommt PVS endlich mit einer echte PoSh API welche mehr zurück gibt als nur einen Haufen Strings. Ich konnte mit dem PVS 7.7 Tech Preview rumspielen und bin desshalb auch bereits ready mit dem komplett neuen Script. Achtung, für Versionen 7.6 und tiefer muss immer noch das alter Script verwendet werden. Diese Neue Version ist gültig ab 7.7 und wir dann für die Nachfolgenden Versionen gepflegt.


Wenn ihr neue Funktionen möchtet oder einen Fehler melden wollt, so tut dies bitte direkt auf GitHub.

Wie bereits geschrieben, diese Version geht nicht mit 7.6 und früheren Versionen, wenn ihr dazu ein HealthCheck braucht, gibt es hier das alte Script:  Citrix PVS HealthCheck 

Das Script findet ihr hier auf GitHub:

61 Antworten auf Happy New Script – PVS 7.7 HealthCheck

  • thanks,Sacha.

  • Small bug I believe, the device count on a second (replicated) PVS server always shows “No Device on the this server” even though it shows devices connected to it under the PVSServer field on the bottom table.

    • Can you send me a screenshot?

    • Check on line 365 of the script and check the if statement for $numberofdevices. My guess is that the check is gt 1 rather than ge 1.

      ex: if ($numberofdevices -gt 1) { $PVStests.deviceCount = “SUCCESS”, ” $numberofdevices active” }
      should be
      if ($numberofdevices -ge 1) { $PVStests.deviceCount = “SUCCESS”, ” $numberofdevices active” }

  • My PVS servers are set to vDisk Load Balance using “Subnet Affinity: Fixed” and “Rebalance Enabled: Trigger Percent 25”. The vDisk is not set to particular PVS Server using “Use this server to provide the vdisk”

    • Ok, something is very strange. I need to test this here (as soon as I have time …. 🙁 )

  • No problem, just thought I’d point it out. Thank you for your efforts and sharing your excellent blog 🙂

    • Thank you for the bug report, it’s always hard to test so much scenarios … I need you blog readers to test my scripts – sorry that’s sometimes not working as expected.

  • Im currently using CIF shares for my stores. Is there a way to grab vDiskfilename, devicecount, createdate and replstate? Also i tend to get the “false” TimedOut under the Ping column a lot.

    • Current version dosen’t include a check for a CIFS share, it should be possible to do that. What ping time do you have between server where script runs and the target? It’s currently set to 200ms, all over this gives you a timeout.

      • Is there a way for me to add the check for CIFS share i would really like to have it in the report every morning. Also the ping times from the server where script is run and target is 48ms to 60ms.

        • I’m sure there is a way, with PVS 7.7 and higher there are nearly all things readable out of the configuration. I’m sure you can also read the CIFS stores and create a new separate table for this.

          I can add this on my list, but my problem is that I have so many “feature request’s” and so less time … Sorry that I cannot update the script today with this feature. Maybe you can try to change the timeout from 200 to 400 and test if you have less false-positives in the ping-timeouts.

    • what is the problem with CIFS?

  • Hi,

    I’ve got a little tool for standard XenServer envs:
    It’s a means to collect “normal” sysadmin-friendly infra data from them and the output is also archival-friendly.

    Already found some bad multipath policies with it, it doesn’t have the nice green/yellow/red part and doesn’t know anything about VDI.
    So, they’re really independent and just posting in case you run into a situation where it’d be helpful.
    “What ISO share did I have on that box last year?” “Was that server’s boot disk on a LSI controller? Which one?”

  • Do you know of any way to speed up the device check function? Presently, if a server is offline, it will fail at getting the wmiobject data and the PVS vDisk info for that device.

  • Any update on the CIFS vdisk store check?

  • the whole scripts to too much time to run complately approxmatly 5 to 6 hours ..can it be faster ?

    • Yes that’s a problem … I know … How many device do you query?

    • Absolutely! Send me an email and I’ll give you a version that seems a little faster.

      • I’m curious what you’ve changed. My Idea is to parallelize the checks, but what sounds easy in theory it’s not easy on reality …

        • In the version we run for work, I’ve tweaked the check so that if the ping connection fails, it tries a Get-WMIObject command to validate the server is offline. If that fails, the other checks are assumed to invalid. Cut the processing time of almost 200 guests and 5 vDisks from 2 hours to almost a minute. Working on a version that runs the check as a workflow, but then you’ve got to think about variable scope and work around issues where Get-PVS* commands aren’t always available in that setup. :-).

          • I also intended to create a version with PowerShell workflow, but this seems to be a hard thing… If you like you can share your version with others, in the meantime I’m on GitHub with my Scripts, feel free to add your version there.

          • Can do! I’m still toying with the use of a workflow, but using it in a scheduled task is a little funky. Anyway, version 2.0.0 has been updated for approval to your github repository. It probably needs to have a check at the beginning for versions of PowerShell older than 3.0, but that can come in a point release down the road. :-).

            An added bonus, I’m working on a method for rebooting PVS servers on a schedule using the uptime report! It’s going to check the sync and load balancing between each server then reboot them if applicable. Fun and challenging project, especially for 7.1-7.6.

          • That’s cool – wow really nice code! THANKS!

          • Not a problem! Working on a revision for the PVS 7.1-7.6 build which builds array objects out of the string data. Below is the function which seems to work pretty well for this effort.

            #Converts MCLI string data into an object array
            function ConvertFrom-MCLI {


            $collection = @()
            $item = $null

            switch -regex (Invoke-Expression $Input) {
            “^Records#d+$” {
            if ($item) {
            $collection += $item

            $item = New-Object System.Object

            “^(?w+):s(?.*)” {
            if ($Matches.Name -ne “Executing”) {
            $item | Add-Member -Type NoteProperty -Name $Matches.Name -Value $Matches.Value

            if ($item) {
            $collection += $item

            return $collection

            In practice, it would look like the following : “mcli-get device” | ConvertFrom-MCLI

  • Hi

    Tx for the script

    If i have multiple site, how do i specify them ?

    Using a coma or somethign else ?


  • HI Sacha,

    Thanks for sharing the script.

    I Just wanted to know, how can we configure script for SMPT which requires credential for authentication?

    My SMTP requires authentication

    Please help to configure

  • Does not work for 7.11

    • in my environment it does work well in 7.11, did you reregistered the snap-in?

      # Prerequisite: Script must run on a PVS server, where PVS snap-in is registered with this command:
      # 1. set-alias installutil C:WindowsMicrosoft.NETFramework64v4.0.30319installutil.exe
      # 2. installutil “C:Program FilesCitrixProvisioning Services ConsoleCitrix.PVS.SnapIn.dll”
      # 3. Add-PSSnapin Citrix*

  • could you add in the script to get the disk space for local C: and D: drives?

  • Really like this script. I only made two changes so far but works great.
    For the retry threshold bug not working, I resolved by taking some of the older pvs script portions and adding to the PVS target device check section for retries.

    $RetryStatus = $targetNamePvsDeviceStatus.Status -as [int]
    “Retry: $RetryStatus” | LogMe -display -progress
    #$tests.Retry = “NEUTRAL”, “$RetryStatus”
    if ($RetryStatus -lt $retrythresholdWarning) { $tests.Retry = “SUCCESS”, “$RetryStatus Retry = OK” }
    else { $tests.Retry = “WARNING”,”$RetryStatus retries!” }

    Also I modified the script runtime at the bottom of the script to convert to minutes and seconds since we have large PVS sites and I knew it would take longer than 1 minute.

    $scriptend = Get-Date
    $scriptruntime = $scriptend – $scriptstart
    “Script ran for $($scriptruntime.Minutes) minute(s) and $($scriptruntime.Seconds) seconds” | LogMe -display -progress

  • Hello,
    It’s possible to show in the report only the vdisk used in in the “PerformPVSvDiskCheck” section?

    • What do you want exactly? There are no other vDisks checked.

      • I would like to ignore the vdisk that has a “devicecount” of “0” in the report.
        And is it possible to have 2 sites?

  • Hey,

    we updated to 7.16 the last week. The script won’t work anymore. Does anyone has an idea which changes have to be made?
    Any help would be appreciated

    Thanks in advance!

    • Did you re-registered the SnapIn? Mostly this is the problem after the update.

      # Prerequisite: Script must run on a PVS server, where PVS snap-in is registered with this command:
      # 1. set-alias installutil C:\Windows\Microsoft.NET\Framework64\v4.0.30319\installutil.exe
      # 2. installutil “C:\Program Files\Citrix\Provisioning Services Console\Citrix.PVS.SnapIn.dll”

      • Hey Sacha,

        thanks for your quick reply. Worked for me, after re-registering the SnapIn 🙂

  • Hi,
    thanks for your good work!

    Put I get an error in my actual Project. Every time I start the script I get der Following:

    “cmdlet Join-Path at command pipeline position 1
    Supply values for the following parameters:
    ChildPath: ”

    my dircectory definition:

    $currentDir = Split-Path $MyInvocation.MyCommand.Path
    $outputpath = Join-Path “C:\AutomationScripts\citrix-pvs-healthcheck-master\LogFiles” #add here a custom output folder if you wont have it on the same directory
    $outputdate = Get-Date -Format ‘yyyyMMddHHmm’
    $logfile = Join-Path $outputpath (“PVSHealthCheck_$outputdate.log”)
    $resultsHTM = Join-Path $outputpath (“PVSFarmReport_$outputdate.htm”) #add $outputdate in filename if you like
    $errorsHTM = Join-Path $outputpath (“PVSHealthCheckErrors_$outputdate.htm”)

    Can you help me within this informations, or do you need more information`?

    Thanks for all!

    I can not Identify

  • Jetzt erst meinen Fehler gesehen: $outputpath = Join-Path “C:\AutomationScripts\citrix-pvs-healthcheck-master\LogFiles”

    Man sollte dann auch das “Join-Path” entfernen 🙂

    Danke trotzdem für deine rasche Antwort

    Grüsse Sascha

  • Hi,

    i´m getting an few errors if i enable the TargetDeviceCheck.

    Get-PvsDiskInfo : The specified vDisk does not exist.
    At C:\Healthcheck\Farm_Health.ps1:683 char:15
    + … $diskinfo = Get-PvsDiskInfo -DiskLocatorId $short_diskLocatorID
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (System.Collecti…ystem.String][]:KeyValuePair`2[]) [Get-PvsDiskInfo], PvsException
    + FullyQualifiedErrorId : Citrix.PVS.SnapIn.InvalidDiskLocator,Citrix.PVS.SnapIn.GetPvsDiskInfo

    Only happens for devices which are currently turned of. Seems not te be a problem but incresses the time the script is running. Maybe there schould be an check if the Target is online bevore performing the vdisk-check on the Target.



Leave a Reply to Sacha Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Follow me on Twitter