Write Cache in Provisioning Services Server

In PVS, write cache describes all the cache modes. The write cache includes data written by the target device and the user data. In vDisk caching mode, the data is not written back to the base vDisk. Instead, it is written to a write cache file in one of the following locations

Cache on device hard disk
Cache in device RAM
Cache on device RAM with overflow on hard disk
Cache on server

When the target device is booted, write cache information is checked to determine the presence of the cache file. If the cache file is not present, the data is then read from the original vDisk file. All current versions of PVS have the option for distributing write cache. It is called Multiple Write Cache Paths. The multiple write cache paths (for a store) option provides the capability of distributing the write cache files across multiple physical media. This feature helps to improve I/O throughput for heavily loaded servers.

When a target device starts the server chooses one of the write cache paths from the list based on the MAC address of the client. The goal of selecting a path based on the MAC address is to get an even distribution of the clients across the available paths. The algorithm selects the same path for a given client each time that client is booted. This functionality is needed to ensure that during a High Availability (HA) failover the new server would choose the same write cache for the client (otherwise it would not be able to find the write cache file and the client would hang). If the defined write cache path is not available to a server, the server falls back to the standard vDisk path.

Cache on device Hard Disk

•Local HD in every device using the vDisk.
•It must be a Basic Volume pre-formatted with NTFS file system with atleast 512MB of free space.

The cache on local HD is stored in a file on a secondary local hard drive of the device. It gets created as an invisible file in the root folder of the secondary local HD. The cache file size grows, as needed, but never gets larger than the original vDisk and frequently not larger than the free space on the original vDisk. It is slower than RAM cache, but faster than Server cache and works in a HA environment.

The lack of space on this drive will bring some slowness in user’s session and this drive needs to be expanded a bit to get back a normal user experience.

To expand these disks two actions need to be done :
1. Expand the Virtual Machine hard disk
2. Expand the disk within the Windows Operation System

Cache in device RAM

•Appropriate amount of physical memory on the machine.

The cache is stored in client RAM. The maximum size of the cache is fixed by a setting in vDisk properties. All written data can be read from local RAM instead of going back to the server. RAM cache is faster than cache on server and works in a HA environment.

Cache on device RAM with overflow on Hard Disk

•Provisioning Service 7.1 or later.
•Windows 7, Windows Server 2008 R2 or later.
•Local HD in every device using the vDisk.

When RAM is zero, the target device write cache is only written to the local disk. When RAM is not zero, the target device write cache is written to RAM first. When RAM is full, the least recently used block of data is written to the local Write Cache disk to accommodate newer data on RAM. The amount of RAM specified is the non-paged kernel memory that the target device consumes.

Cache on Server

•Enough space allocated to where the server cache will be stored.

Server cache is stored in a file on the server, or on a share, SAN, or other location. The file size grows, as needed, but never gets larger than the original vDisk, and frequently not larger than the free space on the original vDisk. It is slower than RAM cache because all reads/writes have to go to the server and be read from a file. The cache gets deleted when the device reboots, that is, on every boot the device reverts to the base image. Changes remain only during a single boot session. Server cache works in a HA environment if all server cache locations to resolve to the same physical storage location. This case type is not recommended for a production environment.

Posted in Citrix, Citrix XenApp | Tagged , , , , , , ,

Citrix SMA Service not starting

If SMA service could not be started and getting the below error message:
“The Citrix SMA Service service on Local Computer started and then stopped. Some services stop automatically if they have no work to do, for example, the Performance Logs and Alerts service.”

Resolution 1:

Active folder would be missing. Copy the Active folder ”C:\Program Files\Citrix\SMA\Active” from another server and then start the service.

Resolution 2:

To resolve the preceding issue, complete the following procedure:

•Stop the SmaService.exe service by using the Task Manager.
•Citrix SMA Service Properties and under the Log on tab, select Local System Account.
•Set the SMA  Service to Manual and restart it, once the service started.
•Change Citrix SMA Service Properties and under the Log on tab, select Local Service Account.
•Set the SMA  Service to Automatic and restart it.

Resolution 3.

Stop IMA service (Kill both IMASRV and IMAAdvanceSRV) and SMA services (SmaService).
Run “dsmaint recreatelhc”
Start IMA service and then SMA service.

Posted in Citrix XenApp | Tagged , , , ,

Citrix License Usage: LMSTAT

To quickly find the count of citrix licenses used run the following command:
C:\Program Files\Citrix\Licensing\LS>lmstat -a | find /i “licenses”

If lmstat -a results in the fillowing error do the following:
lmpath location: “C:\Program Files\Citrix\Licensing\LS”

First, make sure you point first to your citrix_startup.lic file  Run the following command:
lmpath -add CITRIX “C:\Program Files\Citrix\Licensing\MyFiles\citrix_startup.lic”

After you run the above lmpath -add command, drop any additional license files in the  C:\Program Files\citrix\Licensing\MyFiles directory.
Note: you can manually add any additional files if you want by running the following: lmpath -add CITRIX “C:\Program Files\Citrix\Licensing\MyFiles\1.lic;C:\Program Files\Citrix\Licensing\MyFiles\1.lic”

If you recieve any of the following errors: First check citrix_startup.lic is in your lmstat path, if not add it.
Error: (CITRIX) DENIED: “MPS_ENT_CCU” MPS@server.domain.net  [FECC5FE3] (License server system does not support this version of this feature. (-25,334)) (CITRIX) DENIED: “MPS_ENT_CCU” MPS@server.domain.net  [FECC5FE3] (No such feature exists. (-5,341))  Errors above retrieved from –> C:\Program Files\citrix\Licensing\LS\lmgrd_debug.log Note: restart citrix licensing service to recreate the lmgrd_debug.log file.

The “lmstat -a” command should now be fixed and ready to run.

Citrix LMSTAT.exe context:
C:\Program Files\Citrix\Licensing\LS>lmstat /?

Posted in Citrix XenApp | Tagged , , , ,

Preboot Execution Environment (PXE)

Preboot Execution Environment (PXE) is a protocol that enables a client machine to boot from its network interface and connect to a server resource on the network to retrieve a boot-file program and load an Operating System. When a workstation start with PXE boot, the PXE client sends a DISCOVER packet (broadcast) to the entire domain to search for a DHCP server to get an IP address. If it doesn’t find one, it tries a few times and then it times out. In Citrix PVS technology the target device is just a PXE-enabled machine. In most of the subnetted network the target device fails to obtain an IP while DISCOVER and cannot reach a DHCP server where PVS targets are on one physical segment and DHCP resources are on a another one. Because of a limitation in PXE, the broadcast packet never reaches the other segments. So to overcome this issue there is a feature called DHCP Relay (also known as IP Helper for specific vendors) that can be enabled with a simple command on the router in order to make it “listen” to PXE packets and “relay” them to the next-next subnets until they reach a DHCP destination.

Posted in Citrix | Tagged , , , , , , , , , ,

Get alert email when an event occurs and logged in the event viewer

Scenario: We need to get an email when an event occurs and logged in the event viewer. The mail should contain the contents of the event log entry.

In this example, I am using Event ID 137 on a Windows Server 2008 R2 while taking Backups.

First, find the event in the event log.



Click “Attach Task To This Event…” in the right side task pane and proceed with the wizard. We can give a name for the task “the event name in the server”. On the Action page, select send an email. On the send an email page, provide From/To/Subject/Text and SMTP server. So we can’t specify what comes in the body of the email. But we can include a specific attachment, which is not our requirement.


Now go to task scheduler, Task Scheduler Library and then to Event Viewer Tasks, we can find a new item. There is no way to include the text of the event log in the message.

So to get the last instance of event 137 logging in the System event log use the command wevtutil. Run the below command to see all the event details on one line.

wevtutil qe System “/q:*[System [(EventID=20274)]]” /f:text /rd:true /c:1

So create a batch file, query.cmd and saved it on my desktop which will get all event details.

del %temp%\query.txt
wevtutil qe System “/q:*[System [(EventID=20274)]]” /f:text /rd:true /c:1 > %temp%\query.txt

Now go to the properties of the task and click Actions tab. Add an item to run this batch file and place it on top of the list.


Now go to the properties of the “Send an e-mail” option. Find there is an “Attachment” setting and now we have a file which contains the information at %temp%\query.txt. Simply put “C:\Users\admin\AppData\Local\Temp\query.txt” in that box. (Replace the username/location as appropriate). So if the event happens and logged in the event viewer we get the email like what we wanted! Hope this helps many of us…





Posted in Citrix | Tagged , , ,