PowerShell: XenServer Count Function

countvoncount

Intro

I’ve been hesitant to dive into XenServer PowerShell cmdlets, but there’s no rational reason to not do it. Citrix continues to make great strides in expanding and updating PowerShell for XenServer, PVS, and XenDesktop. Today, we’ll go over a function that queries an array of XenServer Poolmasters and returns the total VM count on each. The idea behind this function was to stop manually counting VM’s in XenCenter and to understand VM growth and XenServer Pool utilization.

NOTE: Thanks to The Scripting Frog for getting me most of the way there with this function.

xenservercount
The manual count of VM’s

XenServer and PowerShell?

It may seem weird to use PowerShell to perform queries of a Linux-based system, but such is the world we live in. I remember back in my day :). Apple was a joke, IBM ruled the PC market and Linux didn’t exist. Of course I still remember saving BASIC programs to a cassette deck.

th

The script will prompt for credentials which can be root or any XenServer administrator. Then you connect to each pool master in turn…

The important flags are -SetDefaultSession and -NoWarnNewCertificates. You must set the default session on each new XenServer connection, otherwise, the script will not know what pool master to query. The NoWarnNewCertificates flag prevents a prompt asking you to accept the new XenServer certificate (you can leave this out if you want this additional warning to let you know you’re connecting to a new XenServer).

Unless you can refer to your XenServers with a DNS name, you can do some quick translation to make your output more readable. I’m using a switch statement to replace the IP address with a XenServer name.

The rest is just getting all the VM’s (minus snapshots, templates, etc), counting them and putting the results into a custom PowerShell Object. Finally you disconnect from each XenServer and go to the next one.

The results…

XenServer VM Count
--------- --------
XenServerPool1 108
XenServerPool2 109

You can get this and so much more from my github.

Thanks for reading,
Alain Assaf

Advertisements

WEM 4.7 UPDATE AVAILABLE

2ee31r

Intro

Summer is time for vacations, beaches, and WEM Upgrades! Citrix has released version 4.7 of WEM. You can now download the new version here (requires Platinum licenses and login to Citrix.com). I’ve provided the release notes below.

What’s new

Workspace Environment Management 4.7 includes the following new features. For information about bug fixes, see Fixed issues.

New-wemDatabase PowerShell cmdlet updated

PowerShell modules in the Workspace Environment Management SDK are updated at this release. A new parameter CommandTimeout is provided for the New-wemDatabase cmdlet which allows you to configure timeout period for connection attempts to the WEM database. After the timeout period an error message is displayed. The default timeout is 300 seconds.

The Workspace Environment Management SDK documentation is updated to version 4.7.

Thanks for reading,
Alain

WEM 4.6 UPDATE AVAILABLE

todayisnotthatday

Intro

Spring has sprung and Citrix has released version 4.6 of WEM. You can now download the new version here (requires Platinum licenses and login to Citrix.com). I’ve provided the release notes below.

What’s new

Workspace Environment Management 4.6 includes the following new features. For information about bug fixes, see Fixed issues.

Assigned applications can include StoreFront store apps

You can now assign resources published in Citrix StoreFront stores as application shortcuts in Workspace Environment Management. This allows you to configure Start menu shortcuts which Workspace Environment Management end users can use to easily access remote store resources. Agent host machines configured to use the Transformer feature show shortcuts to Citrix StoreFront store resources inside the Applications tab. Configure the StoreFront stores that Citrix Receiver connects to using a new Advanced Settings tab. Then add store resources as applications in the Add Application dialog, which contains a redesigned General settings tab. For more information see Applications.

Transformer integrated with Receiver for Windows SDK

Transformer is now integrated with the Citrix Receiver for Windows SDK. This allows you to make StoreFront-based assigned application actions available to Transformer kiosk users, and for Citrix Receiver pass-through authentication to be used. Only published applications which users have permission to access are displayed in the Transformer kiosk Applications tab.

Note: If you have previously configured Transformer for Enable Autologon Mode and now wish to configure users for Transformer integrated with Receiver for Windows SDK, you must clear the option Enable Autologon Mode (in the “Transformer Settings > Advanced > Logon/Logoff & Power settings” tab). This allows users to log in to the Transformer client endpoint machine using their own credentials. These credentials are passed through to provide access to their assigned StoreFront-based applications.

Active Directory performance

The Active Directory Subsystem has been redesigned to improve performance and stability. Performance improvements are particularly noticeable when you add AD or OU objects, and dead forests or domains are detected in your environment.

User interface

The administration console user interface has changed:

  • In Advanced Settings > Configuration pane, there is a new StoreFront tab for configuring the StoreFront stores that Citrix Receiver connects to.
  • In Actions > Applications, the Add Application dialog General Settings tab is redesigned for adding StoreFront store resources as applications. The Advanced Settings tab Application Type option is removed.
  • In Active Directory Objects, there is a new Advanced pane. The AD Settings tab contains a new option Active Directory search timeout for configuring how long Active Directory searches are performed before they time out. The default value is 1000 msec. We recommend that you use a timeout value of at least 500 msec to avoid timeouts before searches complete.

Agent administrative templates

The administrative templates provided to configure the agent have been renamed to make the filenames versionless. For more information see Configure the agent.

Documentation

Workspace Environment Management documentation is updated to reflect current product behavior.

Thanks for reading,

Alain