Back in March this year I saw a presentation by James O’Neill and Richard Siddaway about some of the new PowerShell features in Windows Server 2008 R2, in particular Active Directory. I was fascinated by the new ‘Recycle Bin’ feature, which is enabled via PowerShell, and could instantly see that this would be a great and long overdue new feature. I am not alone in this; when Mark Minasi recently appeared on the Run As Radio podcast he said the AD Recycle Bin was the standout feature of the whole Server 2008 R2 release, not just the Active Directory part.
A while back I needed to confirm what level of BIOS firmware a bunch of ESX hosts were at. Unfortunately I ran out of time to look properly, but today I discovered how to do it whilst looking through the VMware SDK for something else. Turns out it is very simple:
$VMHost = Get-VMHost ‘Server01’ | Get-View $VMHost.Hardware.BiosInfo
This will give you results along the lines:
BiosVersion ReleaseDate DynamicType DynamicProperty ———– ———– ———– ————— 2.
More stats for my capacity report, this time I want to know on a typical day in the month what is the average CPU and memory use like across my hosts and clusters. Note: this post is not aimed at troubleshooting performance issues, rather at a high level gives me a reasonable idea of the CPU and memory use in each cluster during peak and non-peak hours. By running this each month I can look at possible trends and where extra resource may be required.
More stats for my capacity report, this time numbers of VM’s in total in Virtual Center and average per host in each cluster. Obviously performance is not based on the numbers of VM’s per host, but its an interesting figure to keep track of.
Connect-VIServer virtualcenter | Out-Null
Total number of hosts $TotalVMHosts = Get-VMHost $TotalVMHostsCount = $TotalVMHosts.count Write-Host “There are $TotalVMHostsCount Hosts in $DefaultVIServer” # Total number of guests $TotalVMs = Get-VM $TotalVMsCount = $TotalVMs.
As part of some monthly stats I need to collate, I had to find out how much SAN storage was being used by my ESX hosts. Luckily we have a pretty good naming convention for our datastores so it’s pretty easy to filter out local storage figures. We simply query Virtual Centre for datastores, filter out any local ones, total up their capacity and then convert the figure into Terabytes.
So we recently published the latest episode of the Get-Scripting podcast and had a lot of fun talking with Carter Shanklin, the product manager over at VMware for PowerCLI - which for the uninitiated is the PowerShell toolkit for managing your ESX environment. Possibly the most interesting output from the interview was the upcoming Project Onyx. By sounds of things it a graphical tool which generates the PowerShell script for the action you just carried out in the VI client - similar to how Exchange 2007 provides the script at the end of most of the GUI wizards.
I wrote an article a little while back for Simple-Talk.com about how you can get information out of Twitter using James O’Neill’s PowerShell Twitter functions and the Twitter PowerPack for PowerGUI - they’ve published it now so you can check it out on their site.
During the last month whilst some colleagues have been away on their holidays, I’ve been spending a lot more time with our Virtual Infrastructure than normal and I thought I’d share a few tips I’ve picked up along the way. They are probably no brainers for your hardcore VMware administrators, but for those like me who aren’t 100% dedicated to one specific area, and particularly have been long time Windows admins, there’s nothing like getting really involved with something for a few weeks to really get to grips with how this stuff works.
Everybody in the PowerShell knows MoW aka the PowerShell Guy, aka Marc Van Orsouw. Either you have used one of his tools like Powertab or WMI Explorer, he’s answered one of your forum postings or you’ve read one of his blog posts to find some information about PowerShell or solve a problem. He is also crazy fun to be around, he had me in tears of laughter back at the PowerShell community dinner in Barcelona last year mainly because he instigated this which happened at the next morning’s PowerShell session with Jeffrey Snover.
Most Windows administrators know that the maximum length for the Netbios computer name of a machine is 15 characters since they may well have hit that limit at some point in time. Slightly less familiar might be the samAccountName attribute of an Active Directory account which must be less than 20 characters - I had experience troubleshooting this one though as recently as last year.
Last week I needed to create hundreds of distribution lists in Active Directory (using PowerShell of course ;-) ), some with particularly long names and during the first run through in my test environment about 20% of them failed to create with an error along the lines that one of the properties I was trying to set was causing a violation.