If the webclient is letting you down, you can also use PowerCLI to expand datastores.
First, as usual, expand the volume on the storage level. Then, fire up PowerCLI, log on to the vCenter/host and run the following script, replacing the name of the datastore you wish to expand:
$name = 'Datastore1' $datastore = Get-Datastore $name $esxi = Get-View -Id ($Datastore.ExtensionData.Host | Select -Last 1 | Select -ExpandProperty Key) $datastoreSystem = Get-View -Id $esxi.ConfigManager.DatastoreSystem $expandOptions = $datastoreSystem.QueryVmfsDatastoreExpandOptions($datastore.ExtensionData.MoRef) $datastoreSystem.ExpandVmfsDatastore($datastore.ExtensionData.MoRef,$expandOptions.spec)
Sometimes, you need to temporarily start a service (such as SSH) to perform some maintenance task. PowerCLI can help you with this:
To start the SSH server on each host of a vCenter:
Get-VMHost | Get-VMHostService | ? {$_.Key -eq "TSM-SSH"} | Start-VMHostService
To stop the SSH server:
Get-VMHost | Get-VMHostService | ? {$_.Key -eq "TSM-SSH"} | Stop-VMHostService -Confirm:$false
As always, you can make adjustments to the oneliner to select another service to start/stop, or further limit the selection of hosts to a cluster or a group of hosts (e.g. filtered by name).
I wrote a script to list virtual disk information for a specified VM, including VMDK path, SCSI IDs and more. It is loosely based on this script but excludes all WMI info.
With PowerCLI, you can generate all sorts of lists. To retrieve the configured and reported OS version of your VMs, try running this one-liner:
Get-VM | Sort | Get-View -Property @("Name", "Config.GuestFullName", "Guest.GuestFullName", "Guest.IpAddress") | Select -Property Name, @{N="Configured OS";E={$_.Config.GuestFullName}}, @{N="Running OS";E={$_.Guest.GuestFullName}}, @{N="IP Address";E={@($_.Guest.IpAddress)}} | Export-CSV -Delimiter ";" -Path "vms.csv"
You can quickly get a list of VMs, the datastores they are using and the logical folder they are in through PowerCLI:
Get-VM | Select Name,@{N="Datastore";E={[string]::Join(',',(Get-Datastore -Id $_.DatastoreIdList | Select -ExpandProperty Name))}},@{N="Folder";E={$_.Folder.Name}}
Combine it with Export-CSV to export the results to a CSV file.