My original XenApp Farm Health Check has had great feedback, and thanks to all of you who have modified the script and supplied me with the updated code!
So, finally, version 2 of the script is now available for download. The script has not been extensively tested so please let me know if you have any problems and I will endeavour to help.
The tests performed by this script are:
– Ping response
– Logon enabled
– Assigned Load Evaluator
– Active sessions
– ICA port response
– CGP port response (session reliability)
– WMI response (to check for WMI corruption)
– Citrix IMA, Citrix XML, Citrix Print Manager and Spooler services
– Server uptime (to ensure scheduled reboots are occurring)
– Server folder path and worker group memberships are report for informational purposes
– PVS vDisk and write cache file size
Location
Deptive - Commercial Bay
11-19 Customs Street West St
Commercial Bay Tower, Level 17, Room 1715
Auckland 1010
Contact Details
0800 000 141
Postal Address
PO Box 34797,
Birkenhead, Auckland 0746
163 Comments
Great stuff Jason, thank you
TerryV – OSS
@Jason : ICA dont work properly. For testing purpose i disabled the ICA on one server but still the result in script says success.If i telnet to 1494 its failed.
Nice script Jas. I especially like the check for WMI corruption. Only bug I’ve found giving me an issue is the cache disk value will be too big for the variable (int32) if your actual vdiskcache is above 2GB.
>> $CacheDisk = [int] ((get-childitem $PvsWriteCacheUNC -force).length)
Hi Nikhil,
I have updated to script and cleaned up the port checking code and my testing shows it is working correctly. Please download the script again (you will see it is now v2.1). If you still have issues let me know how did you disabled ICA and performed your test.
Jason
This comment has been removed by the author.
Hi Jason,
Now it works perfect.
KR
Nikhil
Hi azza2u,
Good catch, I’ve updated the script to use a long integer type instead.
Jason
Is it possible also to run script from a non XenApp server?
Hi Tony,
I haven’t tried it, but you could look at the XenApp 6.5 PowerShell SDK:
http://community.citrix.com/display/xa/XenApp+6.5+Powershell+SDK
Let me know how you get on.
Jason
Yes, I am aware of that, however all the commands require a -computer paramenter, I think it would be good if this could be set as a variable at the start of the script, or maybe even pass the parameter through to the script from the command line…
This might help:
“In order to facilitate running existing scripts remotely without having to make significant changes, a default computer name can be set in the client machine. To do this a new set of cmdlets was introduced. When the default computer name is set, all the cmdlets will automatically remote to the server specified without having to explicitly use the -ComputerName parameter every time.”
Jason,
Great script to use
On the farm what I use:
defaultVDisk = 4 different Vdisk example: (silo + Desktop + DesktopTest, etc.)
Default load evaluator = 2 evaluator example: (VM Load Evaluator + Silo load Evaluator)
How can I modify the script to give more Vdisk and evaluator. I try but doesn’t work can you help me.
Kind regards,
Hakan
Hi Hakan,
I am aware of the need to assign different vDisks and Load Evaluators to groups of servers. Based on the server folder I could check for different vDisks and LEs… but I think this functionality will have to wait for the next version sorry!
Having just downloaded and launched this for the first time (Jason, you rock), I’m planning on running two jobs – one for each of my setups/vdisks. I have each build in a separate folder, so I can exclude all folders except the one that fits my variables.
This is awesome, thanks for you effort guys 🙂
Swj123
Thank you for your great job!
If possible could you add possibility to send an email to abc@domain.com if no errors detected and send an email to another account def@domain.com if errors detected?
Thank you
D.
Sorry, I’ve forgotten to ask you if it’s possible to add some check for web interface.
You’re the best! =)
Thank you
D.
Hi Daniel, thanks for your feedback, but I’m sorry I’m not in a position to be doing more development on the script just at the moment.
We recommend using NetScaler to load balance and monitor Web Interface – you could look into that. I do like the idea of a basic heath check in this script though…. and a PVS health check…. one day!
Hi,
thank you for this usefull script, no problem for web interface.. I’ll try to modify your script… even if I’m not an expert powershell programmer.. I’ll try =)
Thank you for your response, good job!! Bye
Hello Jason,
Love all the improvements made to the script. Question, is it possible to send to more than one email address? I think my email system is having problems with DL’s.
Sincerely,
Jeff
Check out the XenDesktop script at http://blogs.citrix.com/2012/10/27/xendesktop-monitoring-desktop-availability/ for options for using an array for the recipient email addresses in a Send-Mailmessage command
Thank for posting the XenDesktop script, that looks like the base for good XenDesktop script…. another project for me 🙂
Jeff, try specifing your email addresses like this:
$emailTo = “abc@acme.com”, “def@acme.com”
This will create an array of email addresses which I believe will work with Send-MailMessage – let me know how you get on.
Hi,
Great script. Only problem I am seeing is the XML check. The farm is sharing XML with IE (Port 80). No services is in the services list and the script shows an error continuously due to this.
Hi,
This is not something I have tested as I never share the XML port with IIS. You could comment out the XML service check (lines 385 – 393) and add: $tests.XML = “SUCCESS”,”N/A”
This will always return a success status for the XML test with the status text of “N/A”.
Good job Jason.
I would like to challange you to do a small change to til script however.
The activesession, counts all sessions (includning pub apps). If a user has one session on a server, but runs 10 pub apps in that session, the count for this user will be 10.. I would like the count in this case to be 1.
Hi,
So what you are after is a unique user count rather than an active session count. Try this, find line 335:
if ($activeServerSessions) { $totalActiveServerSessions = $activeServerSessions.count }
and change to this:
if ($activeServerSessions) { $totalActiveServerSessions = ($activeServerSessions | Group-Object -property AccountName).count }
Let me know if this works….
Any easy way to have both of these counts? Thanks
Hi,
Is there a download link to V 1, assuming it is for XenApp 5.
thanks
Hi, sorry but v1 of the script was also for XA6.x. I do have a version for XA4.5 I recently wrote for a client… but it’s not in a state where I am happy to share it!
No worries, thanks for putting this out there.
Hello Jason,
thanks for the excellent script. I made some additions to your script to fit it in our environment. I was trying to sort the html file on one of the Value Fields like FolderPath or Workergroup. Unfortunately with no success. Are you able to help me?
best regards
Hanspeter
Need the end of the script is this line:
$allResults | sort-object -property FolderPath | % { writeData $allResults $resultsHTM }
Just trying change “FolderPath” to another property if you wish to sort by another column.
I can put there what ever I want, the html is always sorted by ServerName
The original script sorts by FolderPath so perhaps the changes you made have altered this behaviour. I suggest trying the original script and changing the sort property. If this works you know it’s your changes.
I did test with your original script and the html file is not sorted at all. 🙁
I have nearly 200 Servers listed in the script.
Hello Jason
I just tried it again with the script I downloaded freshly from your website. I did not bother about configuration on smtp and other settings (no modifications at all). In my environment there is no sorting at all.
best regards
Hanspeter
Hello Jason
Found a way to get what I need:
changed the definition of:
$allResults = [ordered]@{}
then I do the sorting here:
Get-XAServer | sort ElectionPreference, FolderPath, ServerName | % {….
}
and finally got rid of all other sorting in the script:
$allResults | % { writeData $allResults $resultsHTM }
$data.Keys | foreach {……
I’m still not the PS Crack but it works for me.
best regards
Hanspeter
You Rock Sir!!!! I have used your script to manage my farm and it works like a charm..Salute to you!!
May I suggest using ConvertTo-HTML for all html output, saves a lot of formatting work 🙂
Nice script! Thanks!
Feedback:
– Workergroups to exclude servers
– More than 1 mail user to receive report.
More than 1 mail user is already possible:
“address1”, “address2”,
Jason – is it possible to send a health check only for specific server names? So if customer XXX has servernames CLDXXX1020 / CLDXXX1030 I only want this script to send the health check over these 10 servers. Can I set a filter?
The only filtering built into the script is based on server folder as shown in the AppCenter. Organise your XenApp servers by folder and edit the $excludedFolders variable in the script (multiple folders/paths can be excluded).
Or you could change the code and introduce a filter in the line:
Get-XAServer | % {
Thanks, due the amount of server it a no-go to exclude folders/paths. The last option would be best – but how can I achieve that filder in Get-XAServer | % { ? For example with the names below CLDXXX1020? Can I do a filter contains / starting with CLDXXX?
Get-XAServer has a ServerName parameter which accepts wildcards, so you could try something like:
Get-XAServer -ServerName “CLD*”
In the script replace:
Get-XAServer | % {
with:
Get-XAServer -ServerName “CLD*” | % {
Let me know how you get on.
I’ve changed it into:
Get-XAServer -ServerName “ASPBAK*” | % {
(for all servers starting with ASPBAK)
But that’s not working 🙁
My fault, it’s working like a charm – great thanks!!
Great to hear!
Hello Jason.
Your script is very useful.
In my environment the Power Shell shows mesnagem [Error] Socket connection failed.
Any idea?
Thank you.
Gilmar
Hi Gilmar,
Please provide some more detail including what line number the error is occurring on.
I have a few XML servers running with IIS on port 443. How would you convert the XML checker to take that into consideration?
The script only checks that the XML service is running, it doesn’t check a response from the port so I don’t see you will have a problem.
This comment has been removed by the author.
Jason, Great job 🙂 We think this script is very usefull for our team since we have to check various customers environments every morning. This script saves us a lot of time.
i got this error when executing your powershell script as below.
PS H:> .XenAppServerHealthCheck_v2.1.ps1
Parameter declarations are a comma-separated list of variable names with optional initializer expressions.
At H:XenAppServerHealthCheck_v2.1.ps1:72 char:24
+ [parameter(Mandatory <<<< = $true, ValueFromPipeline = $true)] $logEntry,
PS H:>
please assist/help/advise. TQ.
I suggest you try downloading the script again.
Any thoughts on how I could get a sum of active and disconnected sessions by Workergroup and place those numbers at the top of the report under the total active and disconnected sessions?
Hi,
The script does not currently group anything by worker group so what you are asking for would require significant redevelopment… sorry, not going to happen right now!
Jason
I seem to have an issue where ping is timing out, any recommendations for altering things to be a bit more tolerant? My farm is located in two different geographical locations, I have an admin machine in one location running the script, but the other location is across the country and some of those servers are the ones timing out.
Jason,
I’ve found that script is realy slow on verifing the Service running status for some services because you make for each check a different connection and different query to a server, while you do 5 checks, this causes 5 times two slow actions.
What you could do instead is before starting to do your first get-service is to get a full list of running processes like this:
$running_list = Get-Service -ComputerName $server | Where-Object {$_.status -eq “running”} | ft Name
And then just check if the service exists in the running_list (that will speed up a lot your script and less stress the production servers)
You would only query once per server in the beginning of your server loop.
Great idea, I’ll look at changing the code when I make the next update to this script.
Beware my code was difficult to implement.
I’ve changed it so that you can implement it without a sweat:
$running_list=[array] 1;Get-Service -ComputerName $server | Where-Object {$_.status -eq “running”} | %{$running_list+=$_.Name}
Now to check if a service is running you execute this:
$running_list -Contains “SENS”
My program runtime was 15 minutes and now it executes in 4 minutes 🙂
You can do the same with qfarm -load, just execute it once on the first citrix server you can reach and use that list for checking the “load” and “logons enabled”
Glad I can help you, after you helped me 😉
This is a great script. Worked perfectly. One thing that I think would be a huge benefit would be if we could run the script based Worker Group or Zones. So something like Get-XAWorkerGroup | where-object {$_workergroupname -eq “OAsia”}
We have USA, Europe and Asia and being able to get different scripts with specific servers on it would be great.
Thanks, Tim
Hi Jason,
The script is amazing. Since I have so many folder paths .could you help me in getting the code to sort it by folder path.
Hi, the report should already be sorted by folder path. Near the end of the script is the line:
$allResults | sort-object -property FolderPath | % { writeData $allResults $resultsHTM }
As you can see this sorts the output by the FolderPath property.
How are you seeing the output sorted?
Great script!! How can I filter with multiple folders?
Hi Jerry, can you elaborate on what you are trying to achieve and/or provide an example?
Dear Jason,
Thanks for inspiration very much. As a PS beginner I slowly try to use your script and to extend it a bit. I found one issue.
Depending on an installation procedure the “ctxhttp” service is visible or is not visible on a broker server. See please : http://terenceluk.blogspot.cz/2012/07/citrix-xenapp-65-server-missing-citrix.html
So perhaps and additional check has to be done (registry check). So in case a registry check is OK some text like “IIS Integration” should be used (not an error).
Kind regards,
Pavel Stadler
P.S. Additional inspiratin scripts:
http://www.techdecode.com/wp/?p=186
http://www.florisvanderploeg.com/ica-connections-using-powershell-part-4/
Hi Pavel,
Yes that is a limitation of the script. Given the move to XenApp 7.5 it’s unlikely I’ll be developing this script much more… I will rewrite it for XD7.1 / XA7.5 at some stage though!
Jason
I am new with Power shell script, In my environment we’re having few CampusVue citrix server, Using your attached script where can i add the server.txt file.
please assist AEAP.
Hi Ranjith, there is no servers.txt file. This script reports on all servers in a farm unless you exclude server folder(s) using the $excludedFolders variable.
Hi,
I am trying to understand how would I input my email info in this location. Should I change the $emailFrom to $myemailaddress@xyz.com and similarly for others?
$mailMessageParameters = @{
From = $emailFrom
To = $emailTo
Subject = $emailSubject
SmtpServer = $smtpServer
Body = (gc $resultsHTM) | Out-String
Attachment = $resultsHTM
}
Hi Jon, at the beginning of the script you will see this:
# E-mail report details
$emailFrom = “alerts@acme.co.nz”
$emailTo = “alerts@acme.co.nz”
$smtpServer = “mail.acme.co.nz”
Change “alerts@acme.co.nz” and “mail.acme.co.nz” to the appropriate values for your company.
Thank you Jason.
Hey
Possible to include the Citrix Profile Management Service into this script?
How do you get the $excludedFolders = @(…..) to accept multiple folders?
Hi Matthew,
I believe the format is $excludedFolders = @(“Servers/Folder1″,”Servers/Folder2″,”Servers/Folder3”)
This creates an array of strings.
Active sessions calculation issue:
Old
$activeServerSessions = [array]($sessions | ? {$_.State -eq “Active” -and $_.Protocol -eq “Ica” -and $_.ServerName -match $server})
New
$activeServerSessions = [array]($sessions | ? {$_.State -eq “Active” -and $_.Protocol -eq “Ica” -and $_.ServerName -eq $server})
Hi Jason
Great script.
I have managed to modify it to run on 4.5, 5 and 6.5 as well as adding a few extra checks then join them all together.
Took our morning checks from an hour to 10 mins.
Thanks for the great starting point and getting me a ton of brownie points with my manager.
I would LOVE to know how this can be modified to run on a 4.5 farm as well?
Is there a way to get this to work with Xenapp 7.5.
Hi Mike, the answer is “not yet”… it’s on my to do list to port this to XA7.5.
In the output what does the server load number translate to? what does the number mean?
The value is the output of qfarm /load. I suggest you view this to get an understanding of XenApp load balancing: https://www.youtube.com/watch?v=YMgN64WBwYg
Great script.. Is there a simple way to output the results as an Excel spreadsheet?
Hi Scott, it could certainly be done, but would require some work. If you’re good with PoSH it shouldn’t be too hard.
All the results are stored in the $allResults hash table (the data structure is described within the script). The WriteData function takes the hash table and writes out HTML – this function could be copied and modified to write out to csv instead.
Jason, wonderful script. It helped me identify why 6 of the 200 servers were having issues with connections. either the IMA service was not starting or ICA was bad.
Now were are trying to focus on Disk Space.
Would you be able to help me add a piece to the script that gives disk free size, this is what I’ve been using:
# Issue warning if % free disk space is less
$percentWarning = 15;
# Get server list
$servers = Get-Content “d:ScriptsPSCheckDiskSpaceAllServers.csv”;
$datetime = Get-Date -Format “yyyyMMddHHmmss”;
# Add headers to log file
Add-Content “$Env:USERPROFILEserver disks $datetime.txt” “server,deviceID,size,freespace,percentFree”;
foreach($server in $servers)
{
# Get fixed drive info
$disks = Get-WmiObject -ComputerName $server -Class Win32_LogicalDisk -Filter “DriveType = 3”;
foreach($disk in $disks)
{
$deviceID = $disk.DeviceID;
[float]$size = $disk.Size;
[float]$freespace = $disk.FreeSpace;
$percentFree = [Math]::Round(($freespace / $size) * 100, 2);
$sizeGB = [Math]::Round($size / 1073741824, 2);
$freeSpaceGB = [Math]::Round($freespace / 1073741824, 2);
$colour = “Green”;
if($percentFree -lt $percentWarning)
{
$colour = “Red”;
}
Write-Host -ForegroundColor $colour “$server $deviceID percentage free space = $percentFree”;
Add-Content “$Env:USERPROFILEserver disks $datetime.txt” “$server,$deviceID,$sizeGB,$freeSpaceGB,$percentFree”;
}
Is the latest script from March of 13?
Thanks great script,
But its showing the active sessions and server load 0.
How do i get those info.
Hi Jason,
Great work and lot of appreciation.. i just need to ask how to configure multiple recipient in email.
$emailTo = “alerts@acme.co.nz” ??
Try the format $emailTo = “user02@example.com”, “user03@example.com”
Great script! Also saved me lots of work trying to do the same.
I have copied the script and adjusted it for monitoring Remote Desktop Services 2012. Many thanks to Jason Poyner.
Check it out!
http://sjvdberg.wordpress.com/2014/07/02/remote-desktop-services-health-check-v1/
Hello Jason,
Thank you very much for this wunderful script. It works great.
Question: The LoadEvaluator column shows in the htm output all “Default” entries in the color orange. How does the color change to green? How can I Change that?
# Default load evaluator assigned to servers.
$defaultLE = “Server Default”
[…] Poyner made a great script to monitor the XenApp server Farm health on a regular […]
Jason,
Thanks for the awesome script. It works great after some small changes for our environment. I wanted to use this script as a tool for a few helpdesk guys, however it seems they need elevated (Admin) rights to get all the results. Can you confirm what the minimum privileges are required (Citrix & MS) to get full results on a small group of 10 server.
What I’m seeing is some tests come back OK but others (the services, ICA, IMA and so on) do not.
Thanks
John
Great script. Thank you for your hard work.
Question for you regarding the uptime… is that in minutes?
What does it mean when it is at zero?
The uptime is in days, zero means the server rebooted less than 24 hours ago.
Hi greate tool.
Going to make one for XA/XD 7.5 ?
I plan to… I just need some time!
having some issues with the script. It runs fine but doesn’t list all servers in the farm. It reports number of active sessions and disconnected sessions and default load evaluator.
[…] if you don’t know it until now, you really need have a look on his blog and on the Script on http://deptive.co.nz/xenapp-farm-health-check-v2 […]
Jason, I really love this script! I adore your work 🙂
I hope you don’t mind that I re-used your “Framework” to create a PVS-Health Check script:
http://blog.appcloud.ch/?p=133
Hi Sacha, nice work with the PVS Health Check script! I started one a few weeks ago, but did not complete it. I’ll now be using yours.
Need script for daily checks
Very useful script
Great Script !!
Great script!
How can I modify the script to monitor write cache on RAM?
[…] you need a Health Check Script for XenApp Version which are older than XenApp 7.x see http://deptive.co.nz/xenapp-farm-health-check-v2 where it’s an excellent work and the inspiration for my […]
@Empyre
If you are still having issues with the drive space, try this:
Add the function to get the disk free space and percentage. we only have this on the C: drive:
Function Get-DiskSpace
{
Param ([string[]]$servers)
Foreach ($s in $servers)
{
Get-WmiObject -Class win32_volume -cn $s -Filter “DriveLetter=’C:'” |
Select-Object @{LABEL=’Computer’;EXPRESSION={$s}},
driveletter, label,
@{LABEL=’GBCapacity’;EXPRESSION={“{0:N2}” -f ($_.Capacity/1GB)}},
@{LABEL=’GBfreespace’;EXPRESSION={“{0:N2}” -f ($_.freespace/1GB)}},
@{LABEL=’PercentFree’;EXPRESSION={“{0:N0}” -f (($_.freespace/$_.capacity)*100)}}
} #end foreach $s
} #end function Get-DiskSpace
Then under the main script section add the reporting:
# Check Drive Space
$C_Drive_Space = ((Get-DiskSpace $_.ServerName).GBFreespace -as [int])
if ($C_Drive_Space -ge “5.00”) { $tests.c_drive_space = “SUCCESS”, $C_Drive_Space}
if ($C_Drive_Space -lt “5.00”) { $tests.c_drive_space = “ERROR”, $C_Drive_Space}
# Check Drive Free Space
#$C_Drive_Free = (((Get-DiskSpace $_.ServerName).freespace/(get-diskspace $._servername).capacity)*100)
$C_Drive_Free = ((Get-DiskSpace $_.ServerName).PercentFree -as [int])
if ($C_Drive_Free -ge “10”) { $tests.c_drive_free = “SUCCESS”, $C_Drive_Free}
if ($C_Drive_Free -lt “10”) { $tests.c_drive_free = “ERROR”, $C_Drive_Free}
# @{LABEL=’PercentFree’;EXPRESSION={“{0:N2}” (($._freespace/$_.capacity)*100)}}
# $PercentFree=@{name=”PercentFree(%)”;Expression={[int](($_.FreeSpace/$_.Size)*100)}}
Don’t forget to add your reporting columns.
Jason – thanks for the great script. I’m trying to get the section working that writes only the errors to a separate log. So far I’m only getting all or nothing. Has anyone else been able to get this working?
script for Xenapp farm is very useful and great work you have done so far. Vdisk column is not green and I am monitoring two vdisk with this script. Can you do let me know what changes I can made.
very very helpful . Thanks lot
Hi,
I tried to implement this script. When I run it separately I get the correct output. But when I run it as a scheduled task from the same machine, I get lot of errors in the output HTML file. Is there anything that needs to be checked? I am thinking that WMI communication problem as the errors are coming only for the services like IMA, spooler etc. But, the problem is it does not happen when I run it manually from a powershell prompt.
Any ideas?
Are you running the scheduled task using an appropriate domain user account which has the correct permissions to the XenApp farm?
Hello,
Yes. Domain admin credentials. I am using the same credentials when I run it as a power shell script directly and also like a scheduled task. For some one reason, the output when the scheduled task is run has many errors for services, even though the services are up and running fine.
Also, it does not read Write cache size and vdisk is showing as N/A. I wonder if it is unable to reach out to WMI. I removed the WMI part from your script as it was not required for me. So could not see them in the report.
Only thing that surprises me is the fact that from same server and same credentials and it works fine if I run in from powershell directly.
can we run this script on CPS 4.5?
If you are working with hash tables in Powershell you cannot sort it because it is handled as one big object.
If you want to sort the results you have to change the code in the writedata function. Change the line:
$data.Keys | sort | foreach {
to:
$data.Keys | Sort-Object {$data.$_.folderpath[1]},{$_} | foreach {
and it will sort on silo first, computername next.
Hope this helps.
Nice script. Can you able to add for ” unique users” to this script?
I can get the unique users by the following command but not sure where to put the results on this HTML Page
get-xasession | ? {$_.accountname -ne “”} | select accountname | sort accountname | get-unique -asstring
Thank you, Jason, for the wonderful script. We have three XenApp 6.5 farms, each comprising 0f 1450 servers. Is there a chance that my Zone Data Collector get hammerred if I run this script (ZDC has three 2.67 GHz processors and a 16 GB RAM)? Thank you for your time!
I do not believe the ZDC will be hit too hard. While the script does query farm info via the ZDC, it also queries each server directly for the state of services etc, this means there is a period of time between farm queries.
Awesome script!
However, when I am running it against a XenApp Farm with 50 servers, it takes over an hour to run…………..is that expected?
Are you using v2.7 of the script? There is a fix in 2.7 to speed up the script loop that checks the health of the services.
Dear Jason Poyner,
I’m new for PowerShell, can you please guide me step by step how can I add Exclusion list.
I have created one folder Servers and inside that another folder Test. I created one text file inside Test folder named Server and have list down the hostname to whom I wanted to put on exclusion. But I failed. Can you please help me.
Hi, line 65 of the script needs to be edited. The line looks like this: $excludedFolders = @(“Servers/Test”,”Servers/Turned Off”)
The path “Server/Test” reflects the path within the Citrix AppCenter console. For example, place all XenApp servers to be excluded from the report into Servers > Excluded within AppCenter, then change line 65 to: $excludedFolders = @(“Servers/Excluded”)
Hi Jason,
Great PowerShell script. It runs great and I am able to get email but there is a small bug that is driving me crazy. Maybe when you have some free time you look at this?
When I run the script I get the following error:
Mcli-Get : The specified Store does not exist.
+ $storeid = Mcli-Get store -p storeName=$storename | Select-String storeId
+ CategoryInfo : DeviceError: (:) [Mcli-Get], EAException
+ FullyQualifiedErrorId : InvalidStore,McliPSSnapIn.McliGet
and I also get this:
Mcli-Get : The guid parameter is not valid.
+ $alldisks = Mcli-Get disklocator -p siteName=$siteName, storeId=$storeid_short | …
+ CategoryInfo : DeviceError: (:) [Mcli-Get], EAException
+ FullyQualifiedErrorId : InvalidParameter,McliPSSnapIn.McliGet
Any insight will be greatly appreciated. Thank you.
Hi Angel, the code you’ve shown is not in my XenApp Farm Health Check script. It looks like it’s checking PVS disks, which is another script I have…. Try downloading the script again.
Hi Jason,
Great PowerShell script. It runs great but i m not able to get write-cache size details. could you please suggest me which below values need to change??
# Relative path to the PVS vDisk write cache file
$PvsWriteCache = “d$.vdiskcache”
$PvsWriteCache2 = “d$vdiskdif.vhdx”
(No result for WC, if i didn’t change these values )
Hi Reddy, just change d$ on both those lines to which ever drive letter you’re using for the write cache, eg, e$
Hey Jase,
Awesome work. I created about 25% of this scrip today before googling around and finding your site ha.
I like your idea of performing the TCP connection to port 1494, but then streaming the data to check for *ICA*. I was trying to think of a way of redirecting telnet to stdout but it can’t be done, so I’m going to steal that 🙂 ha.
My script also performs an invoke-webrequest on the XML brokers to ensure the correct HTTP response is given, would that be of interest? Thanks mate.
Good to hear you’ve found the script useful, and that it’s saved you some time! I’d be keen to see the XML test code – just drop it through to me via email (my address is in the script)
I have checked the version 2 and looks great, excellent job, also I have made some visual modifications just to meet some internal requirements, my question still no possible to have an array for 2 or more LE or vDisks?
Thanks
Sorry, didnt check I was using a previous version
Hey – great script. I want to run this on an admin server (a non-ZDC) how can I get the script to point towards the ZDC for the information?
[…] http://deptive.co.nz/xenapp-farm-health-check-v2/ […]
Great Script!!
How do I get the report to only show errors?
i have uncommented the # Write only the errors to an html file section and changed the below to use the $errorsHTM but am still getting all the results??
$mailMessageParameters = @{
From = $emailFrom
To = $emailTo
Subject = $emailSubject
SmtpServer = $smtpServer
Body = (gc $errorsHTM) | Out-String
Attachment = $errorsHTM
}
Thanks
Hi, good job Jason.
I have the same issue as Ben. It would be great just to have just the ERRORS in the HTML, not all servers.
Any ideas?
Thx!
I’ve managed to adjust the code so that the report can now only return errors instead of all results.
$allErrors =@{}
$allResults.Keys | % { if ($allResults.Item($_).Ping[0] -eq “ERROR” -or $allResults.Item($_).Serverload[0] -eq “ERROR” -or $allResults.Item($_).Logons[0] -eq “ERROR” -or $allResults.Item($_).ICAPort[0] -eq “ERROR” -or $allResults.Item($_).CGPPort[0] -eq “ERROR” -or $allResults.Item($_).IMA[0] -eq “ERROR” -or $allResults.Item($_).CitrixPrint[0] -eq “ERROR” -or $allResults.Item($_).WMI[0] -eq “ERROR” -or $allResults.Item($_).XML[0] -eq “ERROR” -or $allResults.Item($_).Spooler[0] -eq “ERROR” -or $allResults.Item($_).Uptime[0] -eq “ERROR” -or $allResults.Item($_).WriteCacheSize[0] -eq “ERROR” -or $allResults.Item($_).vDisk[0] -eq “ERROR”){$allErrors.add($_,$allResults.Item($_)) }}
also a small bug
$tests.WriteCacheSize = “ERORR”, $CacheDiskGB
should be
$tests.WriteCacheSize = “ERROR”, $CacheDiskGB
Thanks for sharing!
Hi Jason. I’m from Brazil. Congratulations for your script. I have some doubts. Is possible to run this script in a machine outside the farm? I downloaded and installed XenApp 6.5 Powershell SDK – Version 6.5. When I try to run script from this machine (it’s not a XenApp Server) powershell only returns error saying that I had to be and Administrator of farm.
So I enter in one of the XenApp Servers and set the execution policy of Powershell Unrestricted for machine and current user. My user is a admin of Citrix Farm. Windows Firewall is turned off. I already started the “Citrix XenApp Commands Remoting” service. But Powershell always returns the same error. Access denied and say that I had to be an Administrator. I had to run this script from a XenApp Server?
Thanks.
Hi, I have always run this script from a XenApp server. However, if you can successfully run XenApp PoSH commandlets from a non-XenApp server, or workstation, then this script should also work.
Hi,
Many thanks for this pretty script.
Did you know if it’s possible to use it to monitoring more than 1 farm ?
I have 5 farms XA6.5 and i would like to use only one script if it’s possible.
Did you test that before ?
Hi, the script is not designed to monitor more than one farm. I suggest running several copies of the script, one for each farm.
Hi im new to Powershell and nice script mr. Poyner
What is that i need to put into $defaultLE = “Servers”
# Default load evaluator assigned to servers. Can have multiple values in format “LE1”, “LE2”,
# if a match is made to ANY of the listed LEs SUCCESS is returned for the LE check.
$defaultLE = “Servers”
The default load evaluater is just called default ? …is it the xenapp farm name ? og just default ?
under my Xenapp servers folder..the folder is called Servers…is it that one the needs to be there ?
Hi Jason, Brilliant script, very useful for me on daily basis health check report, great job. Thank you very much,
Munvar
Super script, just a few modifications and it provided all useful info about my XA6 farm in the blink of an eye.
Thanks!
Frnds,
Thanks for the above script.. and I ran the script and got the exact output for my project…
I need the same kind of script for presentation server 4.5 machine… anyone can help me on this…? Still we are supporting few 4.5 Citrix presentation servers
Appreciate your help if anyone can help me…
[…] March 15, 2016 XenApp Farm Health Check v2 […]
I just wanted to comment on how useful this script has been for my 3 XA65 farms. Saves me a ton of time each morning being able to take a peek and identify problem servers.. I have also modified the script to pull licensing information, total server count, added UPM and RDP service checks.
Only issue I have is once in a while it hangs on a server for one reason or another, the report wont finish. Is there an easy way to timeout the check on a server so the rest of the script runs and a report generates?
Thank you for this great script.
We “monitor” multiple XA5 and XA6 farms with the same script. I customized the script to check the XA-version and there are some columns that are only displayed if it’s a XA6 farm (the checks are not run).
On our german farms the cpu-check does not function well because of translation problems (just meant as a hint).
This script has been a lifesaver for me. Thank you!
Hey @ ALL 🙂
Has anyone a working downloadlink for the v2 Version?
Thanks a lot!
SUper….. but unable to download the script. Please assist
Hi,
the download links isn’t working anymore. Could you please edit the right link into.
Thanks,
Michael
Hi
Can you send me the link to download the script please as the link isn’t working
Download link not working anymore
[…] reporting script that I’m running for all XenApp servers (modified from the script available here) I run the following to build a hash table of the RAM cache sizes for all […]
Would love to implement your script, but your download link is broken.
fix?
Cannot download the Script
has anyone tracked down this script the link is still kapput >
I’ve finally fixed it, the download should now be working.
“Download the script” is not working.
I’ve finally fixed it, the download should now be working.