Академический Документы
Профессиональный Документы
Культура Документы
function PreReq
{
if ((Test-Path REGISTRY::HKEY_CLASSES_ROOT\Word.Application) -eq $False){
Write-Host "This script directly outputs to Microsoft Word, please
install Microsoft Word"
exit
}
Else
{
Write-Host "Microsoft Word Detected"
}
if ((Test-Path REGISTRY::HKEY_CLASSES_ROOT\OWC11.ChartSpace.11) -eq
$False){
Write-Host "This script requires Office Web Components to run
correctly, please install these from the following website:
http://www.microsoft.com/downloads/details.aspx?FamilyId=7287252C-402E-4F72-97A5-
E0FD290D4B76&displaylang=en"
exit
}
Else
{
Write-Host "Office Web Components Detected"
}
}
$Contents | foreach-object {
$categories = $cats[0], $cats[1]
$values = [math]::round(($contents[0]), 0), [math]::round(($contents[1]), 0)
}
$series.Caption = $Caption
$series.SetData(1, -1, $categories)
$series.SetData(2, -1, $values)
$filename = (resolve-path .).Path + "\PIE.jpg"
$chart.ExportPicture($filename, "jpg", 900, 600)
$objSelection = $msWord.Selection
$msword.Selection.EndKey(6) > Null
$objSelection.TypeParagraph()
$msWord.Application.Selection.InlineShapes.AddPicture($filename) > Null
#Remove-Item $filename
}
# Table style
$doctable.Style = "Table List 4"
$docTable.Columns.AutoFit()
$objSelection = $msWord.Selection
$msword.Selection.EndKey(6) > Null
$objSelection.TypeParagraph()
}
$date = Get-date
Prereq
$totalhosts = $VMhs.Length
$Text = "Total Number of Hosts: $totalhosts"
InsertText $Text
$totalhosts = $VMs.Length
$Text = "Total Number of Virtual Machines: $totalhosts"
InsertText $Text
# Datastore report
$contents = @($Ds | Sort-Object Name)
$columnHeaders = @('Name','Storage Type','Total Size','Free Space')
$columnProperties = @('Name','Type','CapacityMB','FreeSpaceMB')
$Heading = "Datastore Information"
if ($contents[0] -eq $null){
Write-Host "No entries for $Heading found"
}
else
{
Tableoutput $Heading $columnHeaders $columnProperties $contents
}