Find unused portgroups in a cluster

Triggered by a recent post, see get-virtualportgroup, in the PowerCLI Community, I had a closer look at the Get-VirtualPortgroup cmdlet.

This cmdlet returns a VMware.VimAutomation.Types.Host.VirtualPortGroup object, which contains a very useful property called Ports. In that property it lists all the guests that are connected to a port on the portgroup. That would be the solution to find unused portgroups, I thought. But while the vSphere Client also shows powered off guests that are connected, the Port property returned by the Get-VirtualPortgroup cmdlet doesn’t. ๐Ÿ™

So the question at hand required a bit more scripting than I originally thought.

Continue reading Find unused portgroups in a cluster

LUN report – datastore, RDM and node visibility

When you are running multi-node vSphere clusters, you probably already had the experience that one or more of your LUNs were not visible on all nodes. Now you can try to find out which LUN is missing on which node the hard way through the vSphere client. Or you can use the force of PowerCLI and run a script that will report all this in a handy spreadsheet.

To make the script as flexible as possible it should be able to handle any n-node cluster. And as you some of you might know, the Export-CSV cmdlet has some problems with variable length rows. Luckily there is a handy solution I already used in my yadr – A vDisk reporter post.

Continue reading LUN report – datastore, RDM and node visibility

UML diagram your VM, vdisks and snapshots

After my yadr โ€“ A vdisk reporter post I received an email from Dennis Zimmer, known from VMachine blog and as the IcomaSoft CTO. He pointed me to the yUML website and suggested that I could perhaps use part of the yadr script to produce an UML diagram.

As it happended there were already some PowerShell scripts that used the functionality offered by the yUML website to produce UML diagrams. Have a look for example at Use PowerShell and yUML to Create Diagrams by Doug Finke and Create Database Diagrams with Powershell + yUML by Chad Miller.

As you probably guessed by now I was sold to the idea.

Continue reading UML diagram your VM, vdisks and snapshots

yadr – A vdisk reporter

I know there are already numerous scripts to report on virtual hard disks and most of them without a doubt much better then what I came up with for this post.

The reason I started with this script was a question in the PowerCLI Community from Alan in his Thin Provisioned Disks post. He wanted to know if you could get the provisioned and the allocated disk size for a thin provisioned virtual disk.

Continue reading yadr – A vdisk reporter

Script-O-Mania submission – PSTop v1

As most of you should know VMware is organising a scripting contest, called Script-O-Mania. For those of you that haven’t submitted anything yet, hurry up. The closing date is tomorrow (March 15th 2010).

After some reflection I decided to go for a performance monitoring script. I wanted to have the vCenter client performance tab, without having to pay for the vCenter Agent license. And I wanted to offer some of the functionality that esxtop provided on the classic ESX systems.

That’s where my PSTop v1 script came to be.

Continue reading Script-O-Mania submission – PSTop v1

Name that hardware

This post was triggered by the thread Retrieving ESX host hardware information in the PowerCLI community. In that thread at a certain point the NIC HW

information was missing. The solution was to use the classId, which is 0x0200 for NICs, as a filter on the HostPciDevice objects that are present under the pciDevice property in the HostHardwareInfo object.

That made me think that this would be an ideal way to list all the hardware present on a server. But to my surprise a lot of the entries are listed as “unknown”. Since the vendorId and the deviceId are known I knew that this could be improved.

Continue reading Name that hardware

Counter the self-aware VUM

Today there was quite a bit ofย  activity on Twitter following Jason Boche‘s blog post titled VMware Update Manager Becomes Self-Aware.
The problem Jason discovered was that the VUM skipped the guests which are hosting the VUM server and the vCenter server. As a consequence you can not select a cluster, select “remediate” and go out for lunch anymore. The resolution was a rather cumbersome and error prone manual procedure.
But of course PowerCLI can help the human vSphere administrator ๐Ÿ˜‰

Continue reading Counter the self-aware VUM

dvSwitch scripting – Part 8 – Get and Set network adapters

One of the feature requests that came up in several emails I received for my dvSwitch series, was how to get and set the network adapters of virtual guests. In the current PowerCLI version the Get-NetworkAdapter and Set-NetworkAdapter cmdlets can not handle portgroups on dvSwitches.

That is why I created the following two functions, called Get-dvSwNetworkAdapter and Set-dvSwNetworkAdapter.

Continue reading dvSwitch scripting – Part 8 – Get and Set network adapters

PowerWF Studio: a new star on the PowerShell firmament

It has been in the making for more than a year and today the DevFarm Team announces the GA of their PowerWF Studio product.

For those of you that haven’t played with the Release Candidate, PowerWF Studio combines PowerShell and Windows Workflow Foundation in a sleek GUI.

It allows you to drag-and-drop any “activity” from the Toolbox onto the IDE’s Workflow canvas. No more looking through endless lines of PowerShell code, your script is available as a nice graphical workflow drawing.

But PowerWF Studio has much more to offer.

Continue reading PowerWF Studio: a new star on the PowerShell firmament

About Async tasks, the Get-Task cmdlet and a hash table

There was an interesting question in the PowerCLI Community on how to use the -RunAsync parameter. The user wanted to create a number of new guests and start each guest once the creation was complete. This can be done rather easily by using a New-VM cmdlet and piping the result to the Start-VM cmdlet.

Only problem was, the creation of the new guests was done in Async mode.

That’s where the Get-Task cmdlet and the use of a hash table come in handy.

Continue reading About Async tasks, the Get-Task cmdlet and a hash table