This PowerCLI script will display specified VM settings for all VMs in the vCenter server you specify. If you do an inventory, a health check or need to troubleshoot VMware environment this PowerCLI script can be useful.
The following VM settings will be displayed:
VMName, Hostname, IP address, OS version, Boottime, VMstate, Total vCPUs, CPU afinnity, CPU hot add status, CPU share, CPU limit, Overall CPU usage, CPU reservation, Total memory, Memory share, Memory usage, Memory hot add status, Memory limit, Memory reservation, Memory swap, Memory ballooning, Memory compression, Total NICs, VMware tools status, VMware Tools version, VM hardware version, Timesync status and CBT status.
The output can be specified in the scripts. The following formats:
– CSV
– HTML
– GridView. The cool about gridview is that you can easily sort and filter columns.
– On screen
– HTML file can be send by email.
Requirements:
– Microsoft Powershell v2.0
– VMware PowerCLI 4.1 U1 build 332441
What do I need to change:
The following variables can be changed to suit your needs:
001
002 003 004 005 006 007 008 009 010 011 012 013 |
# Variable to change
$CreateCSV= "yes" $GridView = "yes" $HTML = "yes" $DisplayHTMLOnScreen = "yes" $EmailHTML = "yes" $SendEmail = "yes" $EmailFrom = "vm@ivobeerens.nl" $EmailTo = "info@ivobeerens.nl" $EmailSubject = "VMs settings information" $EmailSMTP = "smtpserver" $FileHTML = New-Item -type file "D:\temp\VMInfo_$datefile.html" $FileCSV = New-Item -type file "D:\temo\VMInfo_$datefile.csv" |
The PowerCLI script listing:
001
002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020 021 022 023 024 025 026 027 028 029 030 031 032 033 034 035 036 037 038 039 040 041 042 043 044 045 046 047 048 049 050 051 052 053 054 055 056 057 058 059 060 061 062 063 064 065 066 067 068 069 070 071 072 073 074 075 076 077 078 079 080 081 082 083 084 085 086 087 088 089 090 091 092 093 094 095 096 097 098 099 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
<#
.SYNOPSIS Displays VM settings .DESCRIPTION .EXAMPLE #> #Initialize PowerCLI Add-PSSnapin VMware.VimAutomation.Core C:\"Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1" #Connect to vCenter #Variables #Add Text to the HTML file $output = @() lid;border-width:1px;}body{font-family:verdana;font-size:12pt;}h1{font-size:12pt;}h2{font-size:10pt;}</style>’ $output += ‘<H1>VMware VM information</H1>’ $output += ‘<H2>Date and time</H2>’,$date #Gathering VM settings { #Output if ($CreateCSV -eq "yes") { if ($HTML -eq "yes") { $output += ‘</p>’ $output += ‘</body></html>’ $output | Out-File $FileHTML } if ($DisplayHTMLOnScreen -eq "yes") { if ($SendEmail -eq "yes") { #Disconnect session from VC |
Download link
Running the script and having a few issues. Still kinda new to powercli.
Why does it stop and ask for Process[0]?
Trouble with “{“! Ccript work, if change to:
Get-VM | Sort Name -Descending | % {
$vm = Get-View $_.ID
$vms = “………………….
****
***
***
}
Hi,
just found your script, would it be possible to get info on the disk of the vms?
I need to get the sum of all the configured virtual disk.
Can this be done?
You need to change line 065 + 066 + 067 into one line 🙂
It should be as following:
Get-VM | Sort Name -Descending | %{
Otherwise the foreach won’t have any vm, which it can gather details from
Happy hunting!
The script seems work well. I had the issue above where it complained of process [0] so I made the fix. Now, The report grid displays but I do not get a csv, html, or email. Any pointers for me. The variables were changed to my server and local file location c:\vmware\file1, file2…
Hi Chris, How you fixed the processor[0] issue? Do reply. -Shripal
Will this script work with the new 5.5 powecli? I am looking for a script that can do the export plus also the Tags. For us its a way to export the vm guest list and tell each project which servers they have on their account and what the costs are.
List VM settings to CSV, HTML, gridview, screen and email | https://www.ivobeerens.nlwww.ivobeerens.nl ugg bailey bow uwbekvrsvk uggs bailey bow armssaint ugg boots cheap lixmns uggs outlet yxhxkkkg botte ugg bbxsctef ugg france xkkfws moncler outlet ohmsfymhe ugg bailey bow nfiouz bailey bow uggs women yjbbsd ugg bailey bow women pgaudpmeho ugg bailey bow hvxdjhtn Ugg Kensington Boots zoelqhhby Bailey Button Ugg ylfbhzviuw Bailey Button rrqgehgr Mens Ugg Boots xinhywfjzbt Uggs for Men syulokvflo Uggs Sale mafvypflybv bailey bow uggs women wubpfcmpcqd uggs bailey bow gmrerqouupr ugg bailey bow women rvkepu outlet woolrich
bow uggs http://sotoaviation.com/En/BlueBaileyBowUgg/
Works well on PowerCli 6.5, after merging line 65 to 67 as suggested by Nickolej.
I’m so impressed when I saw the report open!
@Brandon , could you please post the update work full script , still I’m getting error