I had a need to automate the installation of Citrix XenDesktop DDC including using some of the different available install options.
XenDesktopServerSetup.exe is the command line tool to use. Running XenDesktopServerSetup.exe /? displays most of the options that can be used, however I found a couple missing which are documented here.
The Install-XenDesktopDDC function below will enable you to install XenDesktop with different options. For instance, to install all components, but no SQL Express and see the install steps:
The PowerShell community extensions module contains Test-XML which can perform a number of checks for the validity of an XML file. For my particular needs I wasn’t able to take a dependency on an external module, consequently I needed to make something similar of my own to carry out some basic tests.
The below function makes use of the XmlException exception from the XmlDocument class . An attempt is made to load the XML file and then any Load or Parse errors are caught by the XmlException exception.
Some PowerShell cmdlets include switch parameters, i.e. no arguments are typically supplied to them - they are either True / On when they are present and False / Off when they are not. However, it is also possible to explicitly specify them with $true and $false, e.g.
-switchparameter:$true or
-switchparameter:$false
Typically you would not use this when working manually at the console, but what if you needed to automate a task using a switch parameter and set it to be On or Off based on values from a CSV or XML file, i.
Here’s a quick tip for you when using PowerShell’s -match operator. The other day I was given a script to work on which was producing some (to the naked eye) confusing results, turned out the behaviour was actually consistent when you figured out what was happening. Here’s an example:
Take the following text and store it in two variables:
$a = "This is some text. It includes (brackets)" $b = "This is some text.
In an Active Directory environment its typical for client machines to use a local domain controller as their time source, domain controllers with the PDC emulator for the domain and the PDC emulator for the root domain to synchronise time with an external source. In most circumstances the aim is to keep the time synchronised within a 5 minute tolerance level, this will ensure there are no issues with Kerberos authentication which has the 5 minute tolerance as part of its requirements.
I remember back to a London VMUG long ago a presentation about differences to watch out for between ESX and ESXi during the version 3.5 days. The one that got most people looking around at each other saying “oops, I don’t think we knew that” was configuring a Syslog server for your ESXi servers. vCenter 5 now includes it’s own built in Syslog server so there’s no excuse. Alternatives, such as Kiwi Syslog Server, are available if you don’t want to use the vCenter 5 syslog server.
VMUG, vBeers, vLunch….whatever the occasion, there are always some great conversations and I particularly enjoy finding out what other people are up to in their environments. During vLunch last week, I was talking with Ed Grigson and he asked whether it was possible to use PowerCLI to remove vCenter Plugins that have got into an orphaned state, i.e. the uninstall process did not remove the vCenter plugin. VMware KB article 1025360 details a process whereby you can clean these up by navigating to the vCenter Server with a web browser.
The WMI Class Win32_OperatingSystem Caption property returns the particular version of Windows, e.g.:
Microsoft Windows Server 2008 R2 Enterprise or
Microsoft(R) Windows(R) Server 2003, Enterprise Edition
I had a requirement when querying this via PowerShell to take different actions based on whether the OS was some flavour of 2003 or 2008 and was using the following switch statement :
switch ($OperatingSystem.Caption) { "Microsoft Windows Server 2008 R2 Enterprise" {$OSBuild = "2008"; break} "Microsoft(R) Windows(R) Server 2003, Enterprise Edition" {$OSBuild = "2003"; break} "Microsoft(R) Windows(R) Server 2003, Standard Edition" {$OSBuild = "2003"; break} default {$OSBuild = "Unknown"} } However, when querying a 2008 R2 server $OperatingSystem.
The vCheck PowerCLI script from Alan Renouf is one of the most popular scripts for managing vSphere with PowerCLI. Its an amazing piece of work and I think has in its own small way helped the success of PowerCLI itself, by showing the kind of information it is possible to retrieve from vSphere and present in a great format. The number of people I talk to who use it and the large scale organisations that you would think spend thousands of pounds on expensive monitoring tools that have it as part of the daily monitoring checks never ceases to surprise me.
I recently needed to provide a high level capacity overview per VMware cluster looking at some metrics of interest that were being used as a guide to the capacity state of a cluster. Note: these are by no means definitive or the ones you should be using in your environment, but for these purposes they met the requirements. The metrics I looked at per cluster were the ratio of vCPUs to pCPUs, the amount of Effective, Allocated and average Active Memory and the amount of Free Diskspace.