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 […]