Skip to content

Instantly share code, notes, and snippets.

@dapacruz
Last active August 17, 2018 17:17
Show Gist options
  • Select an option

  • Save dapacruz/330a3454edc316d564276f0b4b7f176e to your computer and use it in GitHub Desktop.

Select an option

Save dapacruz/330a3454edc316d564276f0b4b7f176e to your computer and use it in GitHub Desktop.
Generate VMware vSphere Documentation
# Host CPU ratio
Get-VMHostCpuRatio | Export-Csv -NoTypeInformation 'VMware Host CPU Ratio.csv'
# Host datastores
Get-VMHostDatastores | Export-Csv -NoTypeInformation 'VMware Host Datastores.csv'
# Host CDP/LLDP info
Get-VMHostNetworkCdpInfo | Export-Csv -NoTypeInformation 'VMware Host CDP Info.csv'
Get-VMHostNetworkLldpInfo | Export-Csv -NoTypeInformation 'VMware Host LLDP Info.csv'
# Host uptime
Get-VMHostUptime | Export-Csv -NoTypeInformation 'VMware Host Uptime.csv'
# Host networking configuration
$dir = 'VMware ESXi Host Networking Export'
mkdir $dir; cd $dir
Export-VMHostNetworkingToCsv -VMHost * -IncludeIscsiAdapter
# Virtual machine CPU ready percent
Get-VMCpuReadyPercent | Export-Csv -NoTypeInformation 'VMware Virtual Machine CPU Ready Percent.csv'
# Virtual machine (VM) inventory report
$properties = @(
'Name'
@{n='HostName';e={$_.ExtensionData.Guest.HostName}}
@{n='IpAddress';e={$_.Guest.IpAddress.where{$_ -match '(\d{1,3}\.){3}\d{1,3}'} -join ', '}}
@{n='GuestFullName';e={$_.ExtensionData.Guest.GuestFullName}}
@{n='ToolsVersion';e={$_.Guest.ToolsVersion}}
@{n='ToolsBuild';e={$_.Guest.VM.ExtensionData.Guest.ToolsVersion}}
@{n='ToolsStatus';e={$_.Guest.VM.ExtensionData.Guest.ToolsStatus}}
@{n='ToolsVersionStatus';e={$_.Guest.VM.ExtensionData.Guest.ToolsVersionStatus}}
@{n='ToolsRunningStatus';e={$_.Guest.VM.ExtensionData.Guest.ToolsRunningStatus}}
@{n='VmVersion';e={$_.Guest.VM.Version}}
'NumCpu'
'CoresPerSocket'
'MemoryGB'
'ProvisionedSpaceGB'
'UsedSpaceGB'
'Notes'
'PowerState'
'ResourcePool'
@{n='VmxPath';e={$_.extensiondata.config.files.vmpathname}}
@{n='VmdkPath';e={($_ | Get-HardDisk).Filename -join ', '}}
)
$params = @{Property = $properties}
$vms = Get-VM | Select-Object @params
$vms | Export-Csv -NoTypeInformation 'VMware Virtual Machine Inventory.csv'
# vSphere infrastructure as-built
$prog = Resolve-Path -Path 'C:\Program Files*\Robware\RVTools*\RVTools.exe'
& $prog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment