PowerCLI undamp; Windows jump list for recent items set to zero

Today I had to install PowerCLI on my workstation. When I tried launching it for the first time, it simply opened and closed again instantly. After browsing the VMware community for this error and not finding a useful solution, I ended up googling the error. As it turns out, this only happens when you did set the " Number of recent items to display in jump lists" to something less than 4. ...

July 5, 2011 · 1 min · 89 words · christian

Create an offline snapshot of a VM

We’re currently thinking about automating Windows Updates and the involved disaster snapshot-copy to a degree, where we don’t need to intervene anymore. Right now, we already have a rudimentary scheduler in place, which does the reboots for some (200 ..) systems already. Now, we’d like to extend it to also cover the bi-weekly Windows Update spree. Since PowerShell (and PowerCLI) work quite well with vSphere automation, I cooked up the below script to first shutdown a virtual machine (for snapshot consistency reasons), then take a snapshot and power on the virtual machine again afterwards. ...

October 22, 2010 · 2 min · 331 words · christian

Modified SnapReminder

Well, PowerCLI makes my life a little bit easier. Believe it or not, each of us vCenter infrastructure admins has one of these: a Windows admin, thinking a snapshot is also a backup. Thankfully, Alan Renouf over at virtu-al.net wrote the SnapReminder, which already helped me a lot! However, occasionally the script isn’t finding the snapshot author (for whatever reason). Since I want a notification in that case, I modified the script a little bit to suit my needs. ...

October 8, 2010 · 3 min · 604 words · christian

Fix Path Selection Policy for a whole vCenter Cluster

These last few weeks, I’ve been toying with PowerCLI (and PowerShell for that matter). One thing I do have to say, is that Microsoft finally did it right! It’s a useable, program-able command line interface for Windows after all! Thanks to Ivo Beerens and his post " Best practices for HP EVA, vSphere 4 and Round Robin multi-pathing", I was able to come up with the below: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 # LICENSE: GNU General Public License v2. (see LICENSE.txt) # COPYRIGHT: Copyright 2010 Christian Heim <christian.heim@barfoo.org> # Add the VI-Snapin if it isn't loaded already if ( (Get-PSSnapin -Name "VMware.VimAutomation.Core" -ErrorAction SilentlyContinue) -eq $null ) { Add-PSSnapin -Name "VMware.VimAutomation.Core" } if ($args.length -lt 2) { Write-Host Write-Host "fix_multipathing: " Write-Host " - Display-Name of the vCenter cluster, we should check all LUNs" Write-Host " on all available Hosts, and set the Path Selection Policy" Write-Host " to the selected one." Write-Host "" Write-Host " - Path Selection Policy" Write-Host " Possible:" Write-Host " - RoundRobin (VMW_PSP_RR, Round Robin)" Write-Host " - Fixed (VMW_PSP_FIXED, Fixed)" Write-Host " - MostRecentlyUsed (VMW_PSP_MRU , Most Recently Used)" Write-Host exit 1 } $vcserver = "vcenter.home.barfoo.org" $cluster = $args[0] $target_policy = $args[1] # Since I do have only SVC-Disks connected to my hosts, I limit the search to those $canonical_name = "naa.6005076801808021*" Write-Host "Target vCenter Cluster: " $cluster Write-Host "Target PSP: " $target_policy Write-Host switch ($target_policy) { RoundRobin { $display_policy = "VMW_PSP_RR"; } MostRecentlyUsed { $display_policy = "VMW_PSP_MRU"; } Fixed { $display_policy = "VMW_PSP_FIXED"; } default { Write-Warning "Unknown PSP selected! Please consult the help and try again."; exit } } Connect-VIServer $vcserver >/dev/null 2>&1 Write-Host "Found "@(Get-VMHost -location ( get-cluster $cluster ) | Get-ScsiLun -CanonicalName $canonical_name -LunType "disk" | where {$_.MultipathPolicy -ne $target_policy }).Count" LUNs in "$cluster" not using Path Selection Policy "$display_policy Get-VMHost -location ( get-cluster $cluster ) | Get-ScsiLun -CanonicalName $canonical_name -LunType "disk" | where {$_.MultipathPolicy -ne $target_policy } | Set-ScsiLun -MultipathPolicy $target_policy >/dev/null 2>&1 This works great, however you could make it work on the whole vCenter inventory, which I don’t want. We usually add LUNs to a single cluster at one time. Only thing you might need to change, is the canonical name. Mine simply says “find all SVC LUNs” and you might need to change it, if you’re using a different storage.

October 7, 2010 · 2 min · 426 words · christian