PowerShell Primer

A few times in the last few weeks I’ve been asked if it’s worth learning PowerShell. My answer is always “yes”. Rather than repeat myself too often I thought I’d make a post out of it.

But first, an apology. I met a chap at vBeers in London about 6 weeks ago. His background was more UNIX than Windows but he recognised that PowerShell was something that he’d have to learn a bit about. At the time I did promise to send him a few useful links to get started. As you might have guessed, I didn’t do it.

So… Jeff, I’m sorry.

For the benefit of Jeff and anyone else, here are some places to start when it comes to PowerShell and also PowerCLI (VMware’s extension cmdlets to PowerShell for managing their products). (more…)

Read More

Review: VMware vSphere PowerCLI Reference

It’s difficult to be objective when you know (and like) some of the authors. Fortunately it’s not a problem in this case since I don’t have anything bad to say about their work anyway so I don’t need to be diplomatic! Of course it could be argued that anything I say here might not be totally impartial but I leave it to you, the reader, to make that decision – I just wanted to be open and clear from the start. “Clear” is definitely a word I’d use when describing the book. With a subject like this, which isn’t exactly what you would call bedtime reading, any confusion would make the book unreadable. Maybe this is helped in my case by the fact that I’ve been using PowerCLI and PowerShell for quite a while now although I certainly wouldn’t put myself […]

Read More

PowerCLI: Empty Resource Pool

Just a quick one today and I’m only putting it up here because it’s a one-liner and they always make me smile 🙂 Of the multiple clusters on one vCenter server that I’m working on, one of them has some resource pools that we don’t really need. Rather than dragging and dropping a few dozen VMs from one resource pool to the root resource pool of the cluster in the vSphere client I thought I’d use PowerCLI. [ps]Get-ResourcePool -name "MyResourcePool" | Get-VM | Move-VM -Destination (Get-Cluster -name "MyCluster" | Get-ResourcePool -name "Resources")[/ps] Job Done!

Read More

Finding HA Primary Nodes

A question came up in yesterday’s “Chad’s Choice” webcast about choosing which hosts in a cluster would be configured as HA primary nodes. I’m not going to go into any great detail here about what HA primary nodes are because there is a more comprehensive article on HA freely available over on the Yellow Bricks blog of Duncan Epping. The short answer to whether or not you can choose HA primary nodes is a simple “no”. It’s not possible. Things are rarely simple though. Technically it is possible (again see Duncan’s HA deepdive page for details) but, and this is important, manually choosing HA primaries is not supported – even experimentally. The good news though for anyone who wants to know which hosts are their HA primaries is that there is now a dead simple way to find out. As […]

Read More

List of VMX Files

Don’t ask me why but I wanted a list of .VMX files for all of the virtual machines registered in vCenter. With a little experimentation it was easy to come up with a oneliner. [ps]Get-VM | Get-View | % { $_.Config.Files.VmPathName }[/ps] However, that’s not the quickest way. The output takes ages to display because each VM is passed along the pipeline one at a time resulting in multiple Get-View queries. The following is faster: [ps]Get-View -ViewType VirtualMachine | % { $_.Config.Files.VmPathName }[/ps] Although it is a bigger query, the single Get-View call makes the whole thing so much faster. I learned that the other week at a fantastic VMware event. Cheers Alan. Now, one question I have. Most of the VMX files returned by this take the following form: [text][datastore_name] VM-Name/VM-Name.vmx[/text] However, there were a few that came out […]

Read More