Citrix Synergy is over, and I finally have time to write this blog — the third post I have written about the vDisk Replicator Utility (see post 1 and post 2) that I created to replicate vDisks.

I wrote the utility for several reasons. Citrix Provisioning (PVS) is popular because it has many benefits for efficiently managing a large number of non-persistent Citrix Virtual Apps and Desktops systems. PVS gives Citrix customers a high degree of flexibility and operational agility while minimizing storage costs. The vDisk Replicator Utility provides automation to help manage PVS replication using a DevOps methodology. The scripts behind the utility can be run on a schedule to keep PVS stores in-sync between PVS Servers in the same site, different sites, or even different farms. This utility will save administrators a significant amount of time, while enhancing their users’ perceptions of the overall Citrix experience by eliminating issues caused by vDisks being out of sync.

The utility has been updated many times in the last year. Lots of those updates were to fix bugs found when the script was used by customers with different environments. Some of the new versions were to add features requested by customers. The reason I am saying that the utility is finally finished is that, with release 3.5, I’m happy to announce I have added deleting/removing vDisks. Now, the vDisk Replicator Utility has add, change, and delete capabilities. Now to be fair to myself, the original version of the utility would remove vDisks that were deleted on the Master server when it replicated the store. The scripts used the robocopy/MIR directive, which keeps folders exactly in-sync. However, the utility did not remove vDisk entries from the console/database for secondary sites and farms. That has been added in this version.

Deleting and Removing vDisks

There are two ways now that you can remove vDisks. The first is to use the Citrix Provisioning console on the Master server to delete a vDisk. The next time the utility is run, it will synchronize the store files and, after adding any new vDisks, it will check every vDisk on the store and remove any that have no associated file in the store. If you are keeping your stores in-sync on a schedule, this is the method you would use. Of course remember that the vDisk to be deleted has to be unassigned from any targets on all sites and farms or the delete will fail.

The second method to delete vDisks was added for customers that want to replicate changes manually. The utility now provides a mechanism to select vDisks to delete. The utility will perform the delete first on the Master server, then the changes will be replicated, then the utility will remove the vDisk from and Secondary Site Master servers or Secondary Farm Master servers. The key to this process? You cannot manually delete the vDisk in the console first. If you do, there will be no vDisk to choose when the utility asks the Master server for the list of vDisks.

You will notice if you use the utility that the process screen has changed and now has two sides at the bottom. The left side is used for normal manual replication and the right side is used for manually deleting vDisks. When you’re ready to delete just click on button 1 shown below and, after selecting the vDisks to delete, click Process (button 2).

The interface to select vDisks to delete is shown below. This interface is loaded when you click button 1, shown above.

You can select as many vDisks as to want to delete. When you click Save Chosen vDisk, a script will be run to make sure the vDisks are not assigned to Targets on the Master Server. If that is not true, you will see the an error, and a sample of assigned vDisks will be listed. Note that this is only checking the Master Server. You must check any other site or farm you are replicating to. You will not be able to save the selection without fixing the problem by either unchecking the vDisk or unassigning it from Targets.

After saving the files, the selected files should be shown in the selection area as seen here:

Now you can just click Process to delete the vDisk from the Master server, replicate the stores for only the selected files, and then have the vDisk deleted from all Secondary Site and Secondary Farm Master servers.

The last thing to know about deleting is that it must be enabled in setup to work at all. To enable this feature in setup, select the check box in G and click save.

More new Features

There’s a reason I made this version 3.5 — there are more good features included. They aren’t quite as major as adding the delete functionality, but they are still useful.

Space_Status

The script has a new status tab that shows how much disk space is available on all of the PVS stores. If you don’t have monitoring set up for PVS store disk usage you can use this to help out. I added a script called GetStoreSpace.ps1, which will go to all Master Servers, get a list of stores, then find out how much total and freespace there is for the store. The script will email the status, and the status is shown in the UI.

The utility allows you to define the warning and critical percent full amounts and the colors to which those lines will be changed for the status page. These, of course, are defined in the setup tab. By default they are configured as shown below.

The script turned out to be fairly easy to implement when I found the right command. I am using WMI from the system running the script to connect to each remote system that hosts a store. The PowerShell command used is shown here:

$disk = Get-WmiObject Win32_LogicalDisk -ComputerName $ShareServer -Filter “DeviceID=`’$StoreDisk`'” | Foreach-Object {$_.Size,$_.FreeSpace}

This script has been added to run at the end of the vDiskReplicator script, as well, and the results will be included in the status email. You can run the script as a standalone script on a schedule. If email is enabled, it will email the results.

Replication Between Stores on the Same PVS Server

Another new feature requested by a customer was the ability to replicate between stores on the same PVS server. The use case for this was that the customer has a DEV store where they upload all of their vDisks while they are still working on them. They then want to replicate from DEV store to all of their production stores. This includes a production store on the same server. The scripting was modified to be able to handle this situation. To use this functionality you will have to configure the stores using the manual store-matching feature of the stores tab.

Summary

As I said at the beginning, I think this is a big release because the utility is feature complete now. It certainly took quite some time and an awful lot of work to get to this point, and I wanted to list all the features of the utility.

Features

  • Auto generation of store replication pairs
  • Manual generation of store replication pairs
  • Support for local and shared stores
  • Support for replication between:
    • Stores on same server
    • Servers/Stores in same site
    • Servers/Stores in different sites
    • Servers/Stores in different farms
  • Replication order is fully customizable.  Any replication can be run concurrently or after any other replication. This is controlled by a job manager that also provides a time limit when the script will be gracefully shut down if it does not end as it should.
  • Bandwidth limiting for slow WAN connections
  • Mirroring Store replication
  • Selected file replication
  • Both schedulable and manual kickoff of replication
  • Ability to backup the replication configuration and easily restore for small changes to the replication mapping
  • Ability to create custom backups of the replication mapping to easily switch between different sets of stores, servers, farms etc.
  • Ability to delete selected vDisks manually
    • Inlcudes check to make sure the vDisk is not assigned to any targets
  • Removal of vDisks that no longer exist in stores after mirror replication
  • Extensive logging with email notification.  Logs are saved into a local folder by run
  • Replication Status Report on one page for all stores
  • Storage Usage Status Report on one page for all stores with color coding for warning and critical percentage full
  • Ability to test the process before running
  • Integrated help

Looking back, there is a lot in there. Remember this project started to provide these features as an example of what can be done with the very powerful set of Citrix PowerShell SDK commands. You are free to use the utility as desired, and you can also change it to suite your needs.

The utility is available with my initial blog post. Please read the Warnings and Disclaimers provided with the download.

I hope this project has been useful to the fantastic Citrix community that I am always happy to support.

Rob


Citrix Tech Bytes – Created by Citrix Experts, made for Citrix Technologists! Learn from passionate Citrix Experts and gain technical insights into the latest Citrix Technologies.

Click here for more Tech Bytes and subscribe.

Want specific Tech Bytes? Let us know! tech-content-feedback@citrix.com.