Lately I have been playing around with the new Storage related features in vSphere 5. One of the novelties is that you can now unmount a VMFS datastore and detach a SCSI LUN through the API.
To be able to unmount a datastore, some conditions have to be met. In the vSphere Client you get an informative popup that tells what is prohibiting the datastore unmount. If not all conditions are met, you can not continue with the unmount.
Nice feature, but what for those of us that want to automate this ?
Update October 28th 2012: Take into account that the datastorecluster is not connected to a host that is part of a cluster. Skip the HA heartbeat test.
Update April 23th 2012: Use the RetrieveDasAdvancedRuntimeInfo method to find the actual datastores that are used for the heartbeat.
Continue reading Test if the datastore can be unmounted
Recently I had the pleasure of doing a guest post, called Finding your way in the PowerCLI Community, on the PowerCLI blog. The subject of the post was how to find community threads, that might hold an answer to your question.
Now this wouldn’t be a PowerShell/PowerCLI blog, if I didn’t try to automate the procedure. And with a serious amount of RegEx involved, I was able to create some working code. Here it is, my Find-VMTNPowerCLI function.
Warning: pure PowerShell, no PowerCLI content !
Continue reading Automate your VMTN search
On the PowerCLI Community there was an interesting question about dvSwitches, portgroups and connecting VMs. Turns out you will need to provide a free port to connect a VM’s NIC to a portgroup on dvSwitch.
Since the solution is a nice follow up on my previous, somewhat lengthy post, called Variations on a port, I decided to create a short post on the subject in my dvSwitch series.
Update 3th March 2016: added test to capture portgroups with no VM connected to it
Continue reading dvSwitch scripting – Part 12 – Find free ports
There was an interesting thread in the PowerCLI Community today. It raised the question how one could report on the current vCenter sessions, including the IP address or hostname from where the session was started.
Unfortunately the SessionManager doesn’t hold any information from where the session was started.
But there are other ways of finding that information. The UserLoginSessionEvent object has a property, called ipAddress, that has the information we’re after.
Btw if you are only interested in looking for idle sessions, independent from which host they were started, there is a great post, called List and Disconnect vCenter Sessions on the PowerCLI blog.
Update May 4th 2012: function updated to handle multiple vCenter connections.
Continue reading Get complete vCenter session info
In PowerCLI 5.0.1 a handy feature that showed the connected vSphere Servers in the title bar of the PowerCLI window was apparently removed.
In a PowerCLI Community thread some users found this a useful feature that they would like to have back.
I’m sure the PowerCLI Team will listen to their users and fix this problem in the coming PowerCLI version.
But while we are waiting for a new PowerCLI build that brings back the title bar text, you can fix this for yourself thanks to the proxy cmdlet feature.
Continue reading Proxy cmdlet revisited: Connect-VIServer and Disconnect-VIServer
For good security measures you should change the password of your root account on your ESX(i) servers on a regular basis. Instead of logging on to each and everyone of your ESX(I) servers, you can easily automate this process.
But what about the new ESX(i) hosts you will roll out in between root password changes and where you use a Host Profile to configure these new ESX(i) hosts ? Will you need to run a script after the deployment to change the root password ?
Turns out that you can easily update the root password in your Host Profile with the help of an SDK method.
Continue reading Change the root password in hosts and Host Profiles
As a belated Christmas present the new PowerCLI version 5.0.1 is available. This new build brings us the Cloud snapin. The availability of vCD cmdlets was already announced during VMworld 2011 and now the vCD cmdlets make their public appearance.
The first release of the Cloud snapin brings us primarily Get type cmdlets. But there is more, just as the Get-View cmdlet opened up access to the vSphere API, the new Get-CIView cmdlet, and the ExtensionData property, opens up access to all the vCD APIs.
Continue reading PowerCLI 5.0.1 goes Cloud
The Invoke-VMScript cmdlet can be a very useful cmdlet, but sometimes it will fail against one or more of your VMs. And it is not always immediately clear why the Invoke-VMScript cmdlet will not work against that specific VM.
The cmdlet help contains a number of prerequisites, but how do you verify if all the prerequisites are fulfilled?
I decided to create a function that would verify the prerequisites, and that would, if requested, which of the prerequisites was missing.
Continue reading Will Invoke-VMScript work ?
Another post coming from our Dutch VMUG Event 2011 presentation. On position number 10, we find the vMotion Enhancements that were introduced with vSphere 5.
A single vMotion can now scale over multiple NICs. This feature can use a regular vSwitch or distributed vSwitch.On YouTube there are 2 videos, uploaded by VMwareKB, that show how to configure such a vMotion enabled multi-NIC vSwitch, regular and distributed.
Very useful videos, but as you can imagine, I wanted to automate this. No GUI clicking for me 😉
Continue reading vSphere 5 Top 10 – vMotion
Buried in the massive amount of new features introduced with vSphere 5 there are several new API methods on the HostStorageSystem managed object.
Two of these API methods will allow you to automate the new Attach/Detach LUN feature from the vSphere Client. It concerns the AttachScsiLun and DetachScsiLun methods. Until this new feature is available natively in PowerCLI, you can use the following functions.
Continue reading LUN juggling in vSphere 5