Add a Folder to the Write Cache drive of Multiple PVS Targets – PowerShell

I recently needed to create a folder on the Writecache disk for the persistence of Eventlog files. Unfortunatley the customer already had around 40 XenApp hosts deployed.

I wrote a script which can be run from a machine with the Citrix Powershell commandlets installed, ie DDC. This Script lists all the Targets in the site and pipes them to the create folder command.

Ensure you have enabled the Citrix Snapins first…

And heres the code I created…

Smart-X ControlUp and PVS Cache In Ram

When visiting a customer I’m often like to get a feel for the performance of their Citrix farm so I can see what improvements can be made. A fantastic tool for doing this is Smart-X Control-Up. Control-Up is the ultimate administration and real time monitoring tool. Not only can you see, in real time, what’s happening in your RDSH/VDI Farm but it also provides administrators with all the tools necessary to support and administer it. I like the analogy that its like a Medical ECG, you simply run the executable which then installs an agent on your VDI or RDSH hosts and then instantly you see the environments vital statistics.

VDI Environment in ControlUp

VDI Environment in ControlUp

There are loads of great admin features to make life managing the environment easier. One such killer feature, I love, is being able to select a user session and kill Group Policy being applied to that user, thus enabling the admin to change a browser setting, execute admin console, regedit or whatever is being restricted by GP.

Just one of the many built in features, there are far too many to write about in this blog, I suggest you go to their website and check it out for yourself.

As well as being able to use the built in features, Control-Up is extensible by creating your own Script Based Actions. These actions can be developed in house and/or shared with the community, there are already a large selection of scripts available to perform different tasks.

Its really quite easy to do, in fact I wrote my own. All that was involved was a slight modification to a PowerShell script I had previously developed. After some verifications and tweeking from Smart-X, it has now been published and shared for all to use, they even made a video showing how to use it. http://www.controlup.com/pvs-write-cache-size/

Just one example of how admin and community oriented this product is, I urge you to download the demo and give it a try for yourselves. http://www.controlup.com/ you’ll be supprised how great it is.

 

Monitor Citrix PVS ‘Cache In Ram’ Size Using Powershell

I’m a firm advocate of Provisioning Services ‘Cache in RAM with overflow on hard disk’ leveraging operating system RAM for write-cache. This results in better response times and a greater number of IOPS for the write-Cache than using traditional SAN or Local storage.

However, careful planning and monitoring of the size of this cache is imperative as a breach in the available RAM will cause an overflow to the assigned slower disk which dramatically reduces performance.

Much speculation has surrounded how to monitor the write-cache with some relying on the Target Device System Tray data but this only reflects the amount of physical cache used.

I wanted to be able to monitor the amount of Ram Used so that a typical usage baseline at a customer of mine could be taken.

Buried away in the Citrix eDocs (as most things are!) is reference to the actual metric that gives an indication of how much cache in Ram is in use. This can be done by checking the Pool Nonpaged Memory and is shown in the task manager.

taskmgr

In this case the Write-Cache is around 913MB minus some other elements, normally in my experience equate to under 100Mb.

To test this I copied 1Gb of files to the C Drive on the target device and the Nonpaged memory increased by 1Gb. What was interesting was that by removing the 1GB’s of data released the Nonpaged Memory, I wasn’t expecting that.

Using the task manager to check usage is not very practical, so I used WMI to provide the value and obtained this by writing a PowerShell function :-

Using this code we can get the values of multiple servers by using the pipeline eg:

image

Hope you find it useful and any improvements please add comments below.

Thanks

Matthew Nichols

PVS Reseal with Appsense

Here is a script created to allow users to reseal a XenApp 6.5 server with Appsense Agent installed. It is meant to generalise the AppSense agent for imaging…

@ECHO OFF
echo Removing AppSense CCA registry information and stopping CCA Service
net stop "AppSense Client Communications Agent"
reg add "HKEY_LOCAL_MACHINE\Software\AppSense Technologies\Communications Agent" /v "group id" /t reg_sz /d "" /f
reg add "HKEY_LOCAL_MACHINE\Software\AppSense Technologies\Communications Agent" /v "machine id" /t reg_sz /d "" /f

echo Starting the Citrix Reseal
"C:\Program Files (x86)\Citrix\XenApp\ServerConfig\XenAppConfigConsole.exe" /ExecutionMode:ImagePrep /RemoveCurrentServer:True /PrepMsmq:True
ECHO *************************************************
ECHO *************************************************
ECHO **************** RESEAL COMPLETE ****************
ECHO ***** Remember to promote the vDisk to Test *****
ECHO ********* The Server will now shutdown **********
ECHO *************************************************
ECHO *************************************************
pause
shutdown -s -f -t 00

PVS Console Running Slow?

This is a very old fix but I keep seeing it when attending customer sites. The symptoms are PVS Console is very sluggish and you sometimes get the error :-

“The snap-in is not responding, end now or cancel to return to the MMC to check the status of the snap-in.”

By hitting Cancel the console loads but its very slow.

 

To fix it on Pvs 6 you should get this prompt….

Click Disable. However if you didn’t click it or choose something else you wont get prompted again.

The best way to fix this is to create a file called mmc.exe.config with the following contents…

<?xml version=”1.0″ encoding=”utf-8″?>
<configuration>
<runtime>
<generatePublisherEvidence enabled=”false” />
</runtime>
</configuration>

 

Copy this file to c:\windows\system32 and c:\windows\sysWOW64.

 

On restarting the console you should see the problem resolved;.

Sync Citrix PVS vDisk Stores

When using provisioning services and multiple PVS servers I find that using a SAN storage presenting a local vDisk store a good option. However, this creates the question of replication to all PVS server vDisk stores.

You can create a read-only LUN but this causes problems when you want to update the vDisk.

 

There are two easy ways to replicate the storage, Microsoft’s DFS or ROBOCOPY.

 

I prefer ROBOCOPY as replication can be controlled whereas DFS is automatic and you can encounter problems with ‘the last write wins’. These are explained in more detail in BramWolfs Blog Replicating your vDisk Store with DFS.

 

To replicate the vDisk stores I create a batch file with the following contents…

ROBOCOPY \\PVS1\D$\Vdiskstore \\PVS2\D$\Vdiskstore /MIR /xo /XF *.lok /XD WriteCache

ROBOCOPY \\PVS2\D$\Vdiskstore \\PVS1\D$\Vdiskstore /MIR /xo /XF *.lok /XD WriteCache

This script will mirror the destination with the source but the XO options are used in case the destination has a new version of the file,  XD is used to exclude the writecache folder and finally /xf will exclude the LOK files as recommended by Citrix.