Hi All,
I want to generate the HTML 'Export List' for the VMs as well as the ESXi hosts and send it through the email. Please do anyone have this kind of powercli script?
thank you,
Nick
I guess the question may not be cleare. This is when you goto vSphere Client --> 'File' --> 'Export' --> 'Export List'. You can save it as HTML, is there any script that can do this?
Looking for the same thing. I'm manually exporting from VMs and Templates view, where folders are my customers. Is there a way to achieve this with Powercli? I would like to also add my custom annotations, which can be easily done with vSphere Client.
Thats exactly what Im looking for...Ive tried to record the command with onxy but the screen is empty.
Im wondering why I cant find a solution via google...cant be to hard to find a command for this basic function.
Greets
X_Burner
Yes LUCD generally replies on automation threads. He is himself a Google for these type of solutions. But I am wondering he hasn't seen this thread yet. I am sure there is a solution for this but not sure where.
You can do this quite easily from PowerCLI, use the ConvertTo-Html cmdlet.
Attached a short example, note that I didn't fill in all the properties yet, but it should give you an idea how this can be done.
The embedded style sheet is what defines the layout of the report.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
HI LucD,
Is it possible to get all the properties of the vm. you have only provided a handful properties, and i'm wanting to get all properties of the vm.
Right now, i'm doing the exports on a monthly basis, and would be nice to have a scheduled task to get it all done. please advise
You can get all properties like this, but are you sure about that ?
It will generate a rather large HTML file, and not properties that are shown make sence in an inventory (for example the IDs).
$head = @"
<style>
body { background-color:#dddddd;
font-family:Tahoma;
font-size:12pt; }
td, th { border:1px solid black;
border-collapse:collapse; }
th { background-color: #39516B;
color: white;
font-size: x-small;
font-variant: small-caps;
font-family: arial;
text-align: center; }
table, tr, td, th { padding: 2px; margin: 0px }
table { margin-left:50px; }
</style>
"@
$body = Get-VMHost |
Sort-Object -Property Name |
Select * |
ConvertTo-Html -Fragment -PreContent "<h2>VMHosts</h2>" |
Out-String
$body += Get-VM |
Sort-Object -Property Name |
Select * |
ConvertTo-Html -Fragment -PreContent "<h2>VMs</h2>" |
Out-String
ConvertTo-Html -Head $head -PostContent $body -Title "vCenter Inventory" - |
Out-File "C:\report.html"
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference