Powershell Add-PSSnapin slow in RES Automation Manager

When I tried to schedule an simple PowerShell script [See script below], as a module in RES Automation Manager 2012 on a Windows 2008R2 machine, the task took a very long time to finish (+/- 2 min.)

Note: Script disables the logon to a XenApp server.

When I opened a PowerShell console on the Windows 2008R2 machine and ran the script, I found that the delay was caused by the “Add-PSSnapin” cmd-let. It appears that during this command the Snap-ins has to verify the certificate of the Snap-In online. The User in the security context of the task didn’t has access to the internet and because of this the check times-out and caused the delay.

Solution to this behavior is disabling the certificate check against the Certificate Revocation List. A way to do this is changing the value “State” at [HKCU:SoftwareMicrosoftWindowsCurrentVersion WinTrustTrust ProvidersSoftware Publishing] to “146944” (decimal).

I made an other PowerShel task, with the same user in the security context, to modify the above setting in the profile of this user.

After this modification of the duration of the task was reduced from +/- 2 min. to 2 a 3 sec.

Update: 030613:  RES Support made an article about this.


Delete multiple XenServer orphan SR’s

When a Citrix XenServer, member of a Resource Pool, is reinstalled the local storage repositories (Local storage, DVD drive) are left in the resource pool as orphans. In XenCenter, below a Resource Pool, these SR’s are marked with a red bullet.

When there are a few of these orphaned SR, you can remove these with the console command:

Note uuid of the SR’s with:

To delete this SR:

But what to do if there are to much of the orphaned SR’s ? The procedure above is very time-consuming.

Lets see if Powershell can help solve this problem. For XenServer, as for other Citrix products, are Powershell cmd-lets available. With the help from this Pdf I found the cmd-let to get the SR list.

The command let to get a list of all the SR’s is:

I had to find out which property of the SR’s is one of the orphaned SR’s… It appears that an orphaned SR has no PBD’s assigned. Because this property is returned as an array I need a way to determine a way to check this. When an array is empty teh array count is “0”.

Now we have al the UUID os the orpahned SR’s. To delete a SR in Powershell:

Combined in a script, with all the logic and cmd-lets check, will result in:



Script Convert-ExcelSerialdate

When converting an Excel sheet, containing a column with dates, to a CSV file, the column in the CSV file contains nummeric values instead of date values. These numeric values are Serial dateformated values, used internal by Excel to calculate the date.

More info: Link

I wrote a Powershell function to convert the Excle serial date to a .Net date object:

Example code



Kef PSW2000 Subwoofer problem

Since a month I have a problem with my Kef PSW2000 sub-woofer. When the sub-woofer is on power is making a funny noise, a buzzing sound. The sound is originating from the back of the case.
I started searching om google for a solution to this problem. When I came across some forums, I found a site completely dedicated to problems with the Kef sub-woofers.

Update: I fixed my PSW-2000 last Saturday!!!! happy subwoofing.


Batch file: CheckIMAService