Quantcast
Channel: VMware Communities : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 176483

Documentation Report on all advanced settings in vCenter

$
0
0

Trying to set a list of all the advanced settings in vCenter for a "build-as" report in a 2 column format with a list of option and then the value. 

 

When trying to run this I get the information I want in the when I type $contents from the PS C:> prompt, but when I try to get in Word I get a bunch of VMWare.VIim.OptionDef[] and vmware.vim.optionvalue[]

 

Also get an error: method invocation failed because vmware.vim.optionmanager doesn't contain a method named 'op_addition'

 

Still learning, but here is what I have and help would be greatly appreciated:

 

$vcenter = '192.168.0.1'

Connect-VIServer -Server $vcenter

$vcenterSettings = get-View -Id 'OptionManager-VpxSettings'

 

$settings = @()

foreach ($settings in $vcenterSettings)

{

$a = "" | Select-object SupportedOption,Setting

$a.SupportedOption = $settings.SupportedOption

$a.Setting = $Settings.Setting

$settings += $a

}

 

$Contents = @($a.SupportedOption,$a.Setting)

$ColumnHeaders = @('Option','Setting')

$ColumnProperties = @('Option','Setting')

 

$columncount = $columnHeaders.Count

 

$msWord = New-Object -ComObject Word.Application

$wordDoc = $msWord.Documents.Add()

$msWord.Visible = $true

$wordDoc.Activate()

 

$doctable = $wordDoc.Tables.Add($wordDoc.Application.Selection.Range,$contents.Count,$Columncount)

 

for($col =0; $col -lt $columncount; col++)

{

$cell = $doctable.cell(1,$col+1).Range

$cell.font.bold = $true

$cell.InsertAfter($columnHeaders[$col])

}

 

#Insert Data into 1st Row

for ($row =0; $row -le ($contents.count); $row++)

{

$cell = $doctable.cell($row,1).Range

$cell.font.bold = $false

$cell.Text = $contents[$row -1]

}

#Insert Data into 2nd row

for ($row =0; $row -le ($contents.count); $row++)

{

$cell = $doctable.cell($row,2).Range

$cell.font.bold = $false

$cell.Text = $contents[$row -1]

}

#Table formatting stuff

$doctable.columns.autofit()

$objSelection = $msWord.Selection

$msWord.Selection.EndKey(6) > Null

$objSelection = TypeParagraph()

$msWord.Selection.EndKey(6) > Null

 

 

 

 

 

 

 

 

 


Viewing all articles
Browse latest Browse all 176483

Trending Articles



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