Tag Archives: PowerCLI

Setting MMU for your VMs

I was asked by my friend Duncan if it was easy enough to set the Memory Management Unit (MMU) for each of his VM’s.  Read his post here for more information on what he was working on.

He was about to set this by hand for 50+ VM’s which would take a while, so with the power of the VI Toolkit he can now take it easy whilst PowerShell does the hard work:

For one VM:
Get-VM -Name "MyVM" | Get-View | foreach {
    $spec = New-Object VMware.Vim.VirtualMachineConfigSpec
    $spec.flags = New-Object VMware.Vim.VirtualMachineFlagInfo
    $spec.flags.VirtualMMuUsage = "on"
    $taskMoRef = $_.ReconfigVM_Task($spec)
}
For all VMs you could use:
Get-VM | Get-View | foreach {
    $spec = New-Object VMware.Vim.VirtualMachineConfigSpec
    $spec.flags = New-Object VMware.Vim.VirtualMachineFlagInfo
    $spec.flags.VirtualMMuUsage = "on"
    $taskMoRef = $_.ReconfigVM_Task($spec)
}
Or for each of the VMs in a cluster:
Get-Cluster "MyCluster" | Get-VM | Get-View | foreach {
    $spec = New-Object VMware.Vim.VirtualMachineConfigSpec
    $spec.flags = New-Object VMware.Vim.VirtualMachineFlagInfo
    $spec.flags.VirtualMMuUsage = "on"
    $taskMoRef = $_.ReconfigVM_Task($spec)
}

To list each of the VM’s and their current MMU setting use this one-liner:

Get-VM | Get-View | ForEach {Write "$($_.Name) - $($_.Config.Flags.VirtualMmuUsage)"}

The VESI is on its way

Whilst at VMworld Europe 2009 I managed to get a sneak preview of the VESI, if you are unsure what this is then please check my previous post here.   Judging by the interest of the Vizioncore stand and the fact that Scott Herold was looking rather tired at the end of each day I am sure this product is going to AMAZING.

I managed to capture a few sneaky pics of the vDiagram portion of the app and let me tell you, if you liked my original script then you are in for a treat when they release this app, as you can see below they have added more features, nicer shapes and a whole can of kick ass in the process.

Continue reading The VESI is on its way

VI Toolkit voted Number 1

In a recent VMTN Round table podcast we were asked what our predictions would be for 2009, mine was “Automation of VMware Products”,  after visiting VMWorld Europe 2009 in Cannes it would seam that my prediction was coming true.

Whilst there I attended ‘TA01 – Managing VMware With PowerShell’ presented by Carter Shanklin (VI Toolkit Product Manager), one of the developer of the VI toolkit and also Dennis Zimmer (CTO of Icomasoft).

Continue reading VI Toolkit voted Number 1

The Virtualization EcoShell Initiative

Using powershell to manage applications is no new thing, Microsoft are pushing things that way with the release of Exchange 2007 where everything in the GUI is pushed back down to the powershell console and completed there.

So, Imagine if you could do that with VMware products, how amazing would that be !

Continue reading The Virtualization EcoShell Initiative

VI Toolkit Quick Reference Guide

 

VI Toolkit Quick Reference Guide
VI Toolkit Quick Reference Guide

I’m currently sat in Heathrow Airport Terminal 1, I have just found a nice Zurich stand where they give you place to sit, a plug for the laptop and even an Ethernet cable with free Internet access, how nice is that !

So I thought I would best use my time to upload a Quick Reference guide to the VI Toolkit, hopefully I will be handing a few of these out at VMWorld but thought I would also add it to my blog for those of you who were unable to make it.

If you are interested in getting started with the VI Toolkit then print off the attached pdf file on a duplex printer, fold it in half and you have the ultimate getting started guide.

Thanks to C.Shanklin, S.Herold, L.Dekens and C.Bunch for their help with the editing and for the one-liners.

Have Fun !

PowerGUI – Get started the easy way

Are you using PowerGUI and the VMware Powerpack yet, if the answer is no then why not ?
If you think its something that you will have to learn and you just dont have the time then please stop making excuses right now because VMGuru has just released some great new videos that not only show you how to get started but will also convert you into a guru.
The following videos are available from VMGuru’s site here

1. Establishing Connections to your VMware Infrastructure using the PowerGUI Console
2. Navigate your VMware Infrastructure using the PowerGUI Console
3. Execute Links and Actions in the PowerGUI Console
4. Create and Save Filters using the PowerGUI Console
5. Using the PowerGUI Script Editor

Reservations / Limits and Shares

Apparently when performing a Virtual Center upgrade from ‘2.5 Update 1’ to ‘Update 2’ caused some issues when someone on twitter upgraded, It gave some of the attached Virtual machines reservations and limits that did not exist before, this obviously caused a few problems, especially to the machines that had more memory allocated than was limited.
I was asked if there was a way to extract all the Limit/Reservation information from Virtual Center, the following script does just that, into a nice csv file which can be loaded into excel and sorted as needed…..
$Filename = "C:\MyInformation.csv"
Connect-VIServer MYSERVER
$myCol = @()
Foreach ($VM in (Get-View -ViewType VirtualMachine |Sort Name)){
	$MYInfo = "" |select-Object VMName,CPUReservation,CPULimit,CPUShares,MEMSize,MEMReservation,MEMLimit,MEMShares
	$MYInfo.VMName = $VM.Name
	$MYInfo.CPUReservation = $VM.Config.CpuAllocation.Reservation
	If ($VM.Config.CpuAllocation.Limit-eq "-1"){
		$MYInfo.CPULimit = "Unlimited"}
	Else{
		$MYInfo.CPULimit = $VM.Config.CpuAllocation.Limit
	}
	$MYInfo.CPUShares = $VM.Config.CpuAllocation.Shares.Shares
	$MYInfo.MEMSize = $VM.Config.Hardware.MemoryMB
	$MYInfo.MEMReservation = $VM.Config.MemoryAllocation.Reservation
	If ($VM.Config.MemoryAllocation.Limit-eq "-1"){
		$MYInfo.MEMLimit = "Unlimited"}
	Else{
		$MYInfo.MEMLimit = $VM.Config.MemoryAllocation.Limit
	}
	$MYInfo.MEMShares = $VM.Config.MemoryAllocation.Shares.Shares
	$myCol += $MYInfo
}
$myCol |Export-csv -NoTypeInformation $Filename