Have created a simple CLI Script to Dump Virtual machine info to a CSV file. Have Skipped Cpu,RAM information.
CSV would Contain below Columns,
VMName,VMHostName,VMIPAddress,VMInstalledOS,PowerState,HostServer,HostCluster,Notes
Step 1 :
Open PowerCLI – VMware.
Connect-VIServer -Server vcenter.domain.com -Protocol https -User "care\manoharan" –Password P @330eod |
Step 2 :
Example —
PowerCLI F:\Scripts> .\VmwareExport.ps1 |
CSV saves to Scripts Folder. In above example
# Save as ps1
Write-host "Saving CSV Variable" $ExportPath = "Vms.csv" Write-host "Saved CSV Variable" Write-host "Saving ALL VMs" $VMs = Get-VM Write-host "Saved ALL VMs" $VCenter = @() Write-host "Entering Loop" foreach ( $vm in $VMs ) { Write-host "Collecting $VM info" $HostServer = $vm .host.Name $VMSysInfo = Get-VMGuest -VM $VM $MyObject = New-Object PSObject -Property @{ VMName = $VM .name VMHostName = $VMSysInfo .HostName VMIP = $VMSysInfo .IPAddress VMInstalledOS = $VMSysInfo .OSFullName PowerState = $vm .powerstate HostServer = $HostServer HostCluster = ( Get-Cluster -VMHost $HostServer ).Name Notes = $vm .notes } $VCenter += $MyObject } $VCenter | Select VMName, VMHostName, @{N= 'VMIPAddress' ;E={ $_ .VMIP -join '; ' }}, VMInstalledOS, PowerState, HostServer, HostCluster, Notes | Export-Csv $ExportPath -NoTypeInformation |