Application virtualization, IoT and Cloud Computing, Blog of Sacha Thomet

Happy New Script – PVS 7.7 HealthCheck

We are close to the New Year 2016 and I want to wish you all the best for 2016!
I’m already happy now, because I can publish some hours after the PVS 7.7 release from Citrix this Script:

Today Citrix released XenApp/XenDesktop 7.7 and Citrix Provisioning Services 7.7. There are a bunch of new features, but for me the most important thing, beside of the Win10 support, is
….  drum roll ….
the new PVS PowerShell API. PoSh with PVS 7.6 and below was a pain …  To know what else is new in PVS look here: PVS 7.7 New in this release

Now PVS comes with a real PoSh interface which gave more back than a bundle of strings. I had the chance to play around with PVS 7.7 Tech Preview and so here you have already the PVS HealthCheck Script for Version 7.7 in a complete new developed version:

pvs77

If you have a feature request or a bug report please post it direct on GitHub.

This version doesn’t work with PVS 7.6 and below, if you have an older version than 7.7 take this script: Citrix PVS HealthCheck 

Update 11.04.2016: Performance-Improvement, Change the order of the table, all the VDI status now at the end.
Update 09.05.2016: Bugfix & Input from Jay, get CPU/Memory/Disk usage of PVS.
Update 27.05.2016: Now my Script is on GitHub
I’m an absolute GitHub newbie … for this reason I leave it still also here as a download until I’m really comfortable with GitHub.

The code is on GitHub:

https://github.com/sacha81/citrix-pvs-healthcheck

43 Responses to 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:
    https://github.com/FlorianHeigl/xenserver-health
    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. https://github.com/sacha81/citrix-pvs-healthcheck

          • 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 {
            param(
            [Parameter(
            Position=0,
            Mandatory=$false,
            ValueFromPipeline=$true,
            ValueFromPipelineByPropertyName=$true)
            ]

            [Alias(‘Command’)]
            [string]$Input
            )

            $collection = @()
            $item = $null

            switch -regex (Invoke-Expression $Input) {
            “^Record\s#\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 ?

    Regards

  • 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

Leave a Reply

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

Script Archive GitHub
sacha81 @ Github

Hide my repositories

My Tweets & Retweets
CUGC