I am new on this Forum, and virtualization aspect too, I would like to run Script to get informations from vCenter: name of VM, on wich vmHost, CPU information and the total memory
#Add Text to the HTML file Function Create-HTMLTable { param([array]$Array) $arrHTML = $Array | ConvertTo-Html $arrHTML[-1] = $arrHTML[-1].ToString().Replace('</body></html>',"") Return $arrHTML[5..2000] }
$output = @() $output += '<html><head></head><body>' $output += '<style>table{border-style:solid;border-width:1px;font-size:8pt;background-color:#CCCC99;width:100%;}th{text-align:left;}td{background-color:#fff;width:20%;border-style:so 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
$VC = Connect-VIServer $VCServer $myCol = @() # Prepare output collection $VMs = Get-VM | Sort Name # Get all VMs (sorted) $counter = 0 # Initialize counter for progress bar ForEach ($VM in $VMs) # Loop through VMs { $counter++ # Increase counter for progress bar Write-Progress -Activity "Gathering disk information" -Status "Processing VM $VM" -PercentComplete (100*($counter/$VMs.count)) # Display progress bar $VMHost = Get-VMHost -VM $VM # Get this VM's host $VMHostView = $VMHost | Get-View # Get advanced properties of host
#ForEach ($DISK in $VM.HardDisks) # Loop through VM's harddisks # {