- Free Disk Space (http://www.virtu-al.net/2010/01/27/powercli-virtual-machine-disk-usage/)
[source]ForEach ($VM in Get-VM ){($VM.Extensiondata.Guest.Disk | Select @{N="Name";E={$VM.Name}},DiskPath, @{N="Capacity(MB)";E={[math]::Round($_.Capacity/ 1MB)}}, @{N="Free Space(MB)";E={[math]::Round($_.FreeSpace / 1MB)}}, @{N="Free Space %";E={[math]::Round(((100* ($_.FreeSpace))/ ($_.Capacity)),0)}})}[/source]
- VMware Support Bundle
[source]
vm-support -w /vmfs/volumes/datastore1/
Usage: /sbin/vm-support [-a] [-n] [-s] [-S] [-d duration_in_seconds] [-i interval] [-k] [-x] [-X wid] [-q] [-w] [-l] [-Z wid] [-r] [-R statedumper options] [-v] [-h]
-a causes all cores to be tar’ed up – even those from previous
runnings of this script
-n causes no cores to be tar’ed up
-s take performance snapshots in addition to other data
-S take only performance snapshots
-d <s> set performance snapshot duration to <s> seconds [default 300]
-i <s> sleep <s> seconds between snapshots [default autodetect]
-k gather files stats/ of each VM (vm’s stats, vmware-stats*.log files)
-x lists wids for running VMs
-X <wid> grab debug info for a hung VM
-q runs in quiet mode
-w <dir> sets the working directory used for the output files
-l print list of files being collected
-Z <wid> suspends a VM and grabs debug info
-r causes all vmfs3 volumes’ volume headers to be tar’ed up
-R <statedumper options> invokes statedumper utility with given options
-v prints out vm-support version
-h prints this usage statement
[/source]
- Export Advanced Settings
[source]Get-VMHostAdvancedConfiguration -vmhost (get-vmhost) | findstr "NFS"[/source]
- Connect to vSphere Server
[source]Connect-VIServer [vSphere Hostname][/source]
- Remove all Snapshots
[source]Get-VM | Get-Snapshot | fl | remove-Snapshot[/source]
- Execution Signing
[source]powershell Set-Executionpolicy unrestricted[/source]
[source]powershell Set-Executionpolicy restricted[/source]
- Deploy VMware Tools
[source]
Get-Cluster "Productie" | Get-VM | Update-Tools –NoReboot
Get-Cluster "Productie" | Get-Folder "Beheer servers" | Get-VM | Update-Tools –NoReboot
Get-Cluster "Productie" | Get-VM "BHR-SVR11" | Update-Tools –NoReboot
Get-View -ViewType VirtualMachine | select Name, @{ Name=”ToolsVersion”;Expression={$_.config.tools.toolsVersion}}
[/source]
- Show Physica NIC details
[source]
esxcfg-nics -l
/etc/vmware/esx.conf
[/source]
- Sometimes you need exactly the correct version of tools from ESXi, maybe to package it via SCCM.. Here is the location of the ISO.
[sourcecode]
/vmimages/tools-isoimages
[/sourcecode]
