Virtu-Al
Virtually everything is poshable
Virtually everything is poshable
May 4th
Some of you might be interested to know, Alan and Luc are writing a PowerCLI book.
We don’t have many more details at the moment but wanted to let you know, as we are both very excited (and nervous by the amount of work) about this project.
As you know we both live and breathe PowerCLI. And we want to share our knowledge to help others achieve the level of PowerCLI automation we both know is possible.
One thing you can expect from this book is a practical approach with examples galore, we aim to cover most of the common configuration/troubleshooting and reporting areas with easy to understand examples and explanations.
To answer some of your questions:
Q: What’s the title ?
A: Well, in the end we went for “VMware vSphere PowerCLI Reference: Automating vSphere Administration”
Q: Why ?
A: We’re both crazy enough to think we can do this.
Q: When ?
A: Our publisher, Sybex, targets 2011 Q1
Q: What ?
A: Expect a practical, down-to-earth approach. We’re going to show you how you can manage all aspects of your vSphere environment with PowerCLI.
Q: Who are these guys ?
A: Alan, who recently joined EMC’s vSpecialist army, is well-known from his Virtu-Al blog, his UK VMUG appearances, as a co-host of the Get-Scripting podcasts and as the winner of the recent Script-O-Mania contest.
Luc, aka LucD, is known from the PowerCLI Community, his LucD notes blog, his Dutch VMUG and VMworld appearances and as the winner of the first PowerCLI Scripting contest.
Q: Where do these guys live ?
A: Alan, contrary to some rumours, is an English guy and lives in Wiltshire, UK.
Luc lives in Belgium and works in the Netherlands. The best of both worlds
Apr 29th
I was recently contacted via my blog and asked if there was a way to find the VMs which are not named in vCenter the same as they are in Active Directory or their hostname, the person contacting me had explained that someone had “accidently” renamed a number of VMs and when there was an issue with the windows VM they were unable to find it as the name of the VM did not relate to the hostname in any way.
The quick way to find the VM was easy enough, we can easily find the VM with this single one-liner:
Get-VM | Where { $_.Guest.HostName -match "HostnameOfVM"} | Select Name, @{N="Hostname";E={$_.Guest.Hostname}}
If you replace “HostnameOfVM” in the above example with the hostname you should get the correct results back showing the name and the Hostname of the VM.
With this in mind I expanded the above one-liner a little to check your vCenter for each VM which may have a VM name which is different to the hostname, now obviously this depends on if you name the VMs with the hostname or the FQDN so I added an option for both.
If you name your VM’s with the FQDN like MyVM.MyDomain.Com rather than just the hostname (MyVM) then simply set the $IncludeFQDN to $true rather than the preset $false.
As it stands at the moment, the below script will tell you about the VMs which are not named correctly and it will also tell you that it would have changed the name, that’s because this script is currently in “Whatif” mode, this mode means it will tell you if it was going to make a change and not actually make the change. I would run the script as it was and if you are happy with the results simply remove the –whatif which is located after the Set-VM cmdlet, this will then enable the cmdlet to set the name of the VM back to the correct name.
Connect-VIServer MyvCenterSRV
# Specify if your virtual machine names include the FQDN
$IncludeFQDN = $false
Get-VM | Where { $_.PowerState -eq "PoweredOn" } | Foreach {
If ($IncludeFQDN) {
$Name = $_.Guest.Hostname
} Else {
$Name = (([string]$_.Guest.HostName).Split("."))[0]
}
If ($_.Name -ne $Name) {
If ($_.Guest.Hostname) {
Write "VM name '$($_.Name)' is not the same as the hostname $Name"
Set-VM $_.Name -Name $Name -whatif
} Else {
Write "Unable to read hostname for $($_.Name) - No VMTools ?"
}
}
}
A gentle reminder that whilst this may rename the VM name correctly it will obviously not touch the name of the folder on the datastore, if the name was not correct in the first place then your folder name will be incorrect which is an entirely different issue (picked up by my vCheck script), this can of course be resolved whilst the VM is powered on by performing a storage vmotion to another datastore, a SVMotion renames the folder and files to the correctly named entities.
Apr 21st
Well im not sure about the PowerCLI automated vBlocks as yet but I did want to let my readers know that I (like many others) have now joined EMC working as a vSpecialist in EMEA.
I know this blog is mainly about PowerCLI and I have had a fir few questions about if I will still be blogging and if I will still be using PowerCLI, I wanted to answer these questions… YES !
EMC are a very forward thinking company, you should know that by now, look at there continued delivery of leading products and software, with this being the case they actively encourage blogging and therefore my blog will definitely still be here for a long time yet.
PowerCLI has been my bread and butter for a long time now, its what most people know me for, apart from not being French. This blog will still include many PowerCLI examples, experiences and updates to my current projects. Believe me, I have a long list of scripts to write which I have thought of over a log period of time.
I am super excited to be a part of what EMC is doing with the vSpecialist team and hope to update you on more PowerCLI / VMware and EMC articles soon. I want to make it clear though, any opinions or expressions on my site will by mine alone and not that of EMC, hence the new disclaimer on the right hand side of the site !
Lastly, sorry for the self-publicised article…. normal service will be resumed as soon as possible.
Apr 13th
You may have noticed a distinct lack of posts from me recently, I have been on holiday, I had a great time staying in Belgium and The Netherlands, a fantastic country which I would recommend to anyone thinking about travelling in northern Europe, not just for the red lights or “space cakes” either !
Whilst preparing for my trip I heard that the famous “Dutch VMUG” was having a PowerCLI / VESI event, now I know I was on holiday but it would have been rude to pass within an hour of the area and not attend
and I was glad I did.
Having presented at a few VMUGS now I was very impressed at how organised the Dutch VMUG members really are, the presentations were submitted before hand and everything was set for the date well in advance, there were some real superstars presenting too, Armin van Lieshout, Arne Fokkema and Viktor van den Berg.
Mar 26th
That’s right, its finally here, vCheck v5 has arrived !
If you have been using previous versions of this report then its time to update, I have added lots of cool new features and checks which make this report (even if I do say so) awesome !
Some of the highlighted features of v5 are:
Comments
Each section now has comments telling you why I think it may be an issue, there are often links to blog posts and useful information for further reading, an example is below:
Obviously for the experts among you these comments can easily be removed in the script by changing the $comments = $true to $false
Automatic searching for log warnings
There is now a handy link to both the VMware KB site and Google which will automatically search for the errors found on these sites, no longer do you have a reason for not investigating those errors !
Multiple new checks
There are so many new checks that I have now created a dedicated page on my site for this script which lists some basic information, this will of course change over time as more detail is needed and I hope to shoot some video soon showing how to change some of the key areas.
To access the page click the “Featured Scripts” area above and select “vCheck (Daily Report)” or click here.
Thanks
I have been bugging various people to help me with this script, whether it be for information or html help, thanks to everyone who helped me out and also to the beta testers.
To mention a few of the people specifically, thanks goes to:
Raphael Schitz – As always he has contributed some great checks for v5 and thought of areas I would never have. Amazing job my friend.
Duncan Epping – I have bothered him more than once for clarification on the way things work, cheers mate.
Andy Grant – He did a great job helping me tidy up my HTML and add new areas.
The beta testers – you know who you are !
Sorry if I missed anyone !
Mar 17th
Unlike the traditional ESX software, the ESXi software does not have a service console. It helps reduce the installation footprint of the software and can allow the hypervisor to be directly installed on the system’s internal flash storage or a USB key.
At the moment I am investigating moving to ESXi from ESX, after resolving the DSET issue I was then faced with the management of the ESXi hosts, currently the full fat ESX hosts have the Dell open management agent installed on them and SNMP configured, this allows the Dell management server to keep track of the underlying hardware and report any hardware issues or firmware updates.
But what happens with ESXi 4.0 and the removal of the service console ?
Earlier with ESXi 3.5, OpenManage component were integrated with the downloadable Dell ESX3i ISO image
but from ESXi 4.0 onwards, VMware introduced a new concept called vSphere Installation Bundle (VIB), this allows the end users to download VIB files and install it directly into ESXi 4.0. Dell are now posting their OpenManage component as a VIB on support.dell.com.
To help reduce the system footprint and to simplify deployment, the ESXi software does not have a traditional service console management interface where Dell OpenManage agents are installed. Instead, to provide the required hardware manageability, VMware has incorporated the standard Common Information Model (CIM) management profiles into the ESXi software.
Mar 11th
Last night I needed to update some of my hosts with the latest patches that have been released recently, this gave me the ideal opportunity to look at the recently released VMware Update Manager cmdlets for PowerCLI.
For a full list of cmdlets or to download click here.
Whilst upgrading one of my hosts I shot a short video which will take you through some of the basics like:
When watching the video don’t think about how you can do this to a single host, keep in mind that this could be run against multiple hosts or added to the end of a configuration script to ensure your hosts are up to date with the latest security patches after being deployed. More >
Mar 5th
The reasons why not to upgrade to ESXi are getting less and less recently, I think I knocked the automated configuration on the head at the London VMUG with my recent presentation which can be seen here.
With the improved vSphere API’s and using PowerCLI we are slowly able to replace most of the things which used to be performed at the service console, a few of these can be read about here.
But what happens when PowerCLI can not help ?
At a recent engagement with a customer we pretty much got rid of all reasons why we couldn’t move to ESXi apart from one.
Being based on Dell hardware the customer needed to be able to send a detailed report on what the issue was with the physical host, the Dell readers amongst you will be familiar with a Dell System Extraction Tool (DSET), this is a utility which is run on the host (through the service console) which looks at the logs, the Dell management agents and the system to create a packaged hta file which can be sent to Dell, in our case the customer often found it very hard to get hardware components replaced unless a DSET was sent, if not impossible.
The obvious part of this statement was the fact that it ran in the service console, when checking the Dell documentation it was clearly stated that the DSET application was not supported in ESXi:
So when reading the above statement “The server can be rebooted to a supported Linux environment to use DSET” gave me an idea: Live-CD.
After searching for a while I managed to find a nice repository of Dell Live boot CD’s with various different versions of the Dell Open Manage Client already pre-installed, just booting from this CD not only enabled the web interface which you can normally view by accessing the https://<ip address>:1311 url but also allowed me to design a support mechanism where we could boot to a supported operating system via the live boot CD and copy the DSET app over to the box which runs and produces our hardware report for us.
This might sound simple but believe me, it was nearly a show stopper when moving to ESXi, I hope this post helps others in the same predicament this customer was in.
Mar 3rd
Way back beyond the time before PowerCLI was invented there was this app called the Virtual Infrastructure Toolkit, when you installed the VITK if you had Update manager installed you used to be able to install some beta cmdlets which worked with update manager, this was subsequently removed in future versions….. Until Now !
They are back from the dead and in the form of a separate download to the current PowerCLI installable.
Download and install them now !
The first thing you will need to check is what operating system you are installing these on, personally I did not check and ended up with an error when trying to install them on Windows 7 64bit so here is a list of the supported operating systems so you don’t make the same mistake: – OK I may have been using a modified version of PowerCLI – Apparently this does install on Win7 64bit, even if it isn’t in the supported list !
You will also need the following installed:
After installing, from the PowerCLI prompt we can see a list of the new cmdlets by using the Get-Command cmdlet as below:
Get-Command -PSSnapin VMware.VumAutomation
So we can see we have an extra 13 cmdlets, what do these do, well they do all the “Update Manager” type tasks you would expect to do, so now as well as deploying our hosts we can also make sure they are patched to the latest version before adding them into our cluster, all automated of course !
Mar 1st
Today Duncan over at yellow-bricks.com has started quite the conversation on technical support mode for ESXi or otherwise known as “unsupported mode”, check out his blog post and especially the comments here: http://www.yellow-bricks.com/2010/03/01/disable-tech-support-on-esxi/
As always when I see a post my first thought is to PowerCLI, so how can it help in this instance, well apart from the obvious cmdlets which I mentioned in my earlier ESXi post, there are also a couple of one liners which can help us manage Technical Support mode.
To view all hosts and check to see if they have Technical Support mode enabled, use the following:
Get-VMHost | Where {$_.State -eq "Connected" -or $_.State -eq "Maintenance"} | Get-View | Where {$_.Summary.Config.Product.Name -match "i"} | Select Name, @{N="TechSuportModeEnabled";E={(Get-VMHost $_.Name | Get-VMHostAdvancedConfiguration -Name VMkernel.Boot.techSupportMode).Values}} | Out-GridView
To disable it on all ESXi hosts use the following:
Get-VMHost | Where {$_.State -eq "Connected" -or $_.State -eq "Maintenance"} | Get-View | Where {$_.Summary.Config.Product.Name -match "i"} | Get-VIObjectByVIView | Set-VMHostAdvancedConfiguration -Name VMkernel.Boot.techSupportMode -Value $false
And to enable it use the following:
Get-VMHost | Where {$_.State -eq "Connected" -or $_.State -eq "Maintenance"} | Get-View | Where {$_.Summary.Config.Product.Name -match "i"} | Get-VIObjectByVIView | Set-VMHostAdvancedConfiguration -Name VMkernel.Boot.techSupportMode -Value $true
Thanks to Duncan and his most excellent site for the constant source of script ideas