Please see the attached program to perform common XenDesktop administrative tasks without needing to physically login to the Citrix Delivery Services Console.

XenDesktop | Enumerate all active and used desktops:
This application will comb though your XenDesktop infrastructure and enumerate/list all of your desktops. The results will be exported to a textbox where you can copy to a spreadsheet or parse into a database. The attached program can be published in XenApp or run directly from one of your XenDesktop servers. The code is compatible with XenDesktop 4.0 and XenDesktop 5.0. The source code is also available upon request.

Requirements:
XenDesktop SDK
Powershell 2.0
Microsoft .NET Framework 4.0
Compiled with Visual Studio 2010

Apr 062011
 

Please see the attached program to perform common XenDesktop administrative tasks without needing to physically login to the console Citrix Delivery Services Console.

XenDesktop | Enumerate only used desktops:
This application will comb though your XenDesktop infrastructure and enumerate/list only used desktops. The results will be exported to a textbox where you can copy to a spreadsheet or parse into a database. This program will gather the primary user\domain, as well as the desktop and desktop domain. The attached program can be published in XenApp or run directly from one of your XenDesktop servers. The code is compatible with XenDesktop 4.0 and XenDesktop 5.0.  The source code is also available upon request.

Requirements:
XenDesktop SDK
Powershell 2.0
Microsoft .NET Framework 4.0
Compiled with Visual Studio 2010

Apr 062011
 

Okay,  so all I simply want to do is write some .NET Managed Code to run reports against my Xendesktop 4.0 and 5.0 environments. When i attempt to add the System.Management.Automation assembly from my .NET compliler, I get the following message.  Namespace or type specified in the Imports ‘System.Management.Automation’ doesn’t contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn’t use any aliases.

I have already confirmed Powershell 1 or 2 is currently installed in my Development Environment, and I have at least .NET Service Pack 3.5 installed as well. I also have added a reference to System.Management. Now all I need to do is get my compiler to recognize this specific namespace. Fear no more, here is a quick way to get this minor issue resolved.

For starts, here is what my code looks like.

Just to confirm, lets make sure you ahve added a reference to System.Management. To do so, right click on your project and select “Add Reference”. Click on the .NET tab and highlight the System.Management Component and select OK to proceed. You can see, in this scenario, we are using the .NET 4.0.0.0 Framework. (see capture below)

With the system.management reference successfully added and confirmed, go ahead and save your project and exit visual studio.
Now with the compiler closed, open your Project File in notepad. 
Search for <Reference Include=”System.Management” />, which should be located under <ItemGroup> and replace  with <Reference Include=”System.Management.Automation” />, then save your Project file and reopen in visual studio.
Example Before:

Example After:

Once you open your project, you can see system.management.automation is now available for you to utilize.

By performing the above few steps, you will also be able to add references to System.Management.Automation.Runspaces, as well as several others.

© 2012 random technology [RT] technology documentation

Optimized by SEO Ultimate