When looking at a lot of PowerCLI scripts available I noticed that people tend to forget to validate their output. For example let’s look at the following piece of code:
$Vms = Get-VM
Although this command will return a collection in almost all cases, it can however return 3 different output types. It can return a collection, [...]
Posts Tagged ‘PowerCLI’
$Null or Nothing?
PowerCLI 4.0 Update 1- Another leap forward
Last week VMware released PowerCLI 4.0 Update1. According to the PowerCLI blog this new version contains over 60 new cmdlets as well as greatly improved performance.
One great thing is that they put the cmdlet reference online. I always like references online, because they are always at your disposal. When I ‘m working on my scripts, [...]
PowerCLI 4.0 U1 doesn’t reconnect to VIServer
When I was testing with the new PowerCLI feature to work with multiple VIServers, I ran into a bug. Whenever you disconnect from a VIServer you can’t reconnect to that server. You can however connect to another VIServer, but never to the same VIServer again.
As a workaround for this problem close your PowerCLI session and [...]
How big is my VM?
If you want to know the size of your vm, you probably first look at the size of the virtual disks in the vm’s settings, but there’s more to it. A virtual machine consists of the following set of files:
Config files (.vmx, .vmxf, .vmsd, .nvram)
Log files (.log)
Disk files (.vmdk)
Snapshots (delta.vmdk, .vmsn)
Swapfile (.vswp)
To make things more complicated, these [...]
List HBA WWPNs and LUNs using Powershell
Lately I’m moving around my VMs and storage luns between my ESX clusters a lot to accomplish a complete redesign of my Virtual Infrastructure. At some point I got lost and didn’t had the complete overview anymore. Which luns were attached to which cluster? To remove(unpresent) a lun from an ESX host/cluster on the storage [...]
Setting custom attributes with VMware PowerCLI
Last week I wanted to extend my vCenter with some extra custom attributes on my VMs. This would extend the usability of the Export List feature for reporting purposes. So together with Hal Rottenberg’s “Managing VMware Infrastructure with Windows PowerShell TFM” book in my hand, I took a dive into VMware PowerCLI (formerly known as [...]
