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:
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:
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?
Thank you Sacha: http://imgur.com/dlpEzZi
Also, not sure if this helps, but I am running PVS 7.8 and XenApp 7.8
That’s indeed very strange. You have the vDisk fixed to one PVS if I see that right. So why it goes to an other PVS? Or why it shows that it is on an other PVS. I’ll try to reproduce that.
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” }
Yep that worked 🙂
Thank you for your assistance Taylor!
Not a problem! I did a major overhaul of the script on this page recently, and that was one of the things I changed. :-).
Thanks – just added in the newest version what is in gitHub
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?
Not yet. I move now all my Scripts to GitHub to open it for community contribution.
I have added this in GitHub as an Issue so it will be tracked in next versions
Is the GitHub repository open to the public or a private one?
public
Sacha,
Can you send you your email? I want to share something with you.
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) {
“^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 ?
Regards
currently not implemented, I added this to my issue list on GitHub: https://github.com/sacha81/citrix-pvs-healthcheck/issues
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
currently not implemented, I added this to my issue list on GitHub: https://github.com/sacha81/citrix-pvs-healthcheck/issues
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?
you mean for PVS targets?
Hi Sacha,
That’s correct.
I added this Feature Request in the queue in GitHub.
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?
Thanks,
What do you want exactly? There are no other vDisks checked.
Sacha
I would like to ignore the vdisk that has a “devicecount” of “0” in the report.
And is it possible to have 2 sites?
Thanks
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
und wenn du nichts anpasst dann läufts? Grüsse Sacha
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.
Regards
Stefan
thanks, created an issue in my GitHub repo: https://github.com/sacha81/citrix-pvs-healthcheck/issues/26
When the script is running on this, it stops here and I have to press enter so that script can proceed further. What could be the problem. I need script to work till the end without pressing any keys.
Cache on RAM with overflow
WriteCache on RAM size is low with 19.93 GB
Collection: 713 Prod
Used DiskVersion: 0
Used Server:
Retry: 0
Retry:
Cache on RAM with overflow
WriteCache on RAM size is low with 21.06 GB
Collection: 713 Prod
Used DiskVersion: 0
Used Server:
Retry: 13
Retry:
Cache on RAM with overflow
WriteCache on RAM size is low with 18.06 GB
Collection: 713 Prod
Used DiskVersion: 0
Used Server:
one more comment. I am not getting vdisk data as I have registered all the snapins. the data is showing blank.
Get-PvsDiskInfo : The specified vDisk does not exist.
At C:\temp\new folder\Citrix-PVS77-Farm-Health-toHTML.ps1:683 char:15
+ … $diskinfo = Get-PvsDiskInfo -DiskLocatorId $short_diskLocatorID
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (System.Collecti…ystem.String][]:KeyValuePair`2[]) [G
PvsException
+ FullyQualifiedErrorId : Citrix.PVS.SnapIn.InvalidDiskLocator,Citrix.PVS.SnapIn.GetPvsDiskInfo
Check PVS vDisks
Get-PvsDiskInfo : The specified Site does not exist.
At C:\temp\new folder\Citrix-PVS77-Farm-Health-toHTML.ps1:479 char:15
+ $AllvDisks = Get-PvsDiskInfo -SiteName $siteName
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (System.Collecti…ystem.String][]:KeyValuePair
PvsException
+ FullyQualifiedErrorId : Citrix.PVS.SnapIn.InvalidSite,Citrix.PVS.SnapIn.GetPvsDiskInfo