Use PowerCLI to mass assign tags and storage based policy management

Storage Based Policy Management (SBPM) has been around for a while, when working with storage tiers, metro clusters, or vSAN, it’s either fundamental or best practice. But clicking on anything more than half a dozen vms and datastores is a bit too much hard work. Using a mix of PowerCLI and the web client I …

PowerCLI – Get-Datastore Naa and Capacity

simple script to extract fc naa and capacity info [code language=”powershell”] $AllDS = Get-Datastore $results = @() foreach ($ds in $AllDS) { $dsview = $ds | Get-View $resultsarray = "" | Select "DatastoreName","CanonicalName","CapacityGB","FreeSpaceGB" $resultsarray."DatastoreName" = $ds.Name $resultsarray."CanonicalName" = $dsview.info.vmfs.extent $resultsarray."CapacityGB" = $ds.CapacityGB $resultsarray."FreeSpaceGB" = $ds.FreeSpaceGB $results += $resultsarray } $results | Sort-Object DatastoreName [/code]

Insanely simple and incredibly useful PowerCLI snipits

I find that I’m spending an increasing amount of time in PowerCLI, partly that’s because I am working with groups of hosts or vms. It’s not that I’m working with scripts all the time, just that if I need to do some action at scale, a foreach loop is going to save a bunch of …

VMware PowerCLI Script Library

I’m moving scripts to GitHub Mainly because it’s cool, but the formatting of scripts in wordpress is horrible, and I need to revisit most as I found mistakes in some, what’s in GitHub has been recently tested https://github.com/raoconnor       Get-ByBlueFolders Series Many of us divide services or customers using blue folders, typically in a …

PowerCLI – VMotion Report

DRS history will only show the most recent VMotion events, to get a more complete picture LudD has created a couple of fantastic functions. What they do is allow you to create a csv report of all the VMotion/SVMotions events of a period of time, for example 24, 48, or 72 hours – This is …

PowerCLI – Find mac in a haystack

find a vms mac in two minutes with this really useful one-liner Get-VM | Get-NetworkAdapter ´ | Where-Object {$_.MacAddress -eq “00:50:56:xx:xx:xx:”} | Select MacAddress,NetworkName,Name,Parent,ConnectionState Ok, it’s a bit slow to run, this function by Robert van den Nieuwendijk is much faster   [code language=”powershell”] function Get-VmByMacAddress { <# .SYNOPSIS Retrieves the virtual machines with a …

PowerCLI – configure host dump-collector

There are a number of post showing how to setup VMware’s Dump Collector, once that is done the hosts need to be configured to point to the dump collector. First check that you can connect to the dump collector nc -z -u <your dump collector ip><port> see the following kb for troubleshooting http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2003042   Jonathan …