Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 230663

Re: Documentation Report on all advanced settings in vCenter

$
0
0

Ok, I think I understood what you are trying to do.

I took that code and changed it slightly.

Have a look and feel free to ask if some parts are not clear.

 

$vcenter='192.168.0.1'
Connect-VIServer-Server$vcenter
$vpx=Get-View-Id'OptionManager-VpxSettings'
$rowCount=$vpx.Setting.Count
$colNames=$vpx.Setting|Select-First1|Get-Member-MemberTypeProperty|
where {$_.Name-notmatch"^Dynamic"} |Select-ExpandPropertyName
$colCount=$colNames.Count

$msWord=New-Object-ComObjectWord.Application
$wordDoc=$msWord.Documents.Add()
$msWord.Visible=$true
$wordDoc.Activate()

$doctable=$wordDoc.Tables.Add($wordDoc.Application.Selection.Range,$rowCount+1,$colCount)

# Header
for($col=0;$col-lt$colCount;$col++){
 
$cell=$doctable.cell(1,$col+1).Range
 
$cell.font.bold=$true
 
$cell.InsertAfter($colNames[$col])
}


# Data
for($row=0;$row-lt$rowCount;$row++){
 
for($col=0;$col-lt$colCount;$col++){
   
$cell=$doctable.cell($row+2,$col+1).Range
   
$cell.font.bold=$true
   
$cell.InsertAfter($vpx.Setting[$row].$($colNames[$col]))
  }
}

#Table formatting stuff
$doctable.columns.autofit()

Viewing all articles
Browse latest Browse all 230663

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>