Recently I was asked if we could list some basic information from VMware View using the cmdlets which come installed on the View Administrator server, the request was specifically a list of VMs and the pool they were in, this was easily achieved with the Get-DesktopVM cmdlet as below:
Get-DesktopVM | Select Name, Pool_id | Sort Pool_id
I was recently asked if it was possible to automate the update of a View Pool every week after the updates had been applied to the virtual machines using Windows Update services, the process is quite straight forward.
This person needed to snapshot a VM after the updates were completed and then use this snapshot to re-compose the pool, after this was complete they would then use this pool to make sure there were no issues.
The following script does just that, it takes the VM from a given pool and snapshots the VM, it then adds this snapshot back as the active replica for the pool, the idea is to run this as a scheduled task (maybe on Tuesday night) on the View server allowing the snapshot to be created every time it runs.
Watch it in action…
As of version 4.6 VMware View came with some PowerCLI Cmdlets, I wrote a post about these recently after they were released explaining why this was both a good and a bad thing.
I have seen a couple of posts since then using View PowerCLI :
Myself, I never really had a reason to use them that much, I have been busy since they came out and have always been meaning to have a more thorough look at what could be done.
My next post will go into some more detail on the use case but for now I wanted to talk about using these cmdlets from another machine. Normally with PowerCLI we can connect to the vCenter server using any machine with PowerCLI installed on it whether that be our workstation, an admin server or the vCenter server itself, unfortunately we are unable to do that with the View cmdlets as they stand but PowerShell can help us with this.
One of the features built into Windows PowerShell V2 is called remoting, to find out more information about this feature use the get-help cmdlet in PowerShell as follows: Get-Help About_Remoting.
Its probably not news to you that VMware have now released View 4.5, just one of the many cool announcements made at VMworld 2010 – San Francisco.
Did you know however that View now has some PowerShell cmdlets ? – Yeah that’s right.
I think its great that VMware are putting so much time and effort into PowerShell and giving windows admins a great tool to manage their VMware infrastructure with, one thing I always tell anyone who will listen is that PowerShell is “the glue” that sits in between your applications to enable a common programmatic interface allowing you to glue all these applications together to give you the end results you need, whether it be deploying a VM and then installing Windows and then installing Exchange and then following on to add the mailboxes and patch the server and even send you an email at the end to say its done or simply just adding an “A host” record to a DNS server for a VMHost after installing ESX and patching the host using the Update manager cmdlets.
The possibilities are endless, well as endless as your imagination !
So yes, the point here is that its a great thing that VMware continue to add PowerShell enablement to their apps giving us the freedom to automate them.
With View 4.5 we are given 45 cmdlets to manage our View environment, these are listed below: Continue reading