Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
<#
.SYNOPSIS
Creates an inventory of a Citrix XenApp 6.5 farm.
.DESCRIPTION
Creates an inventory of a Citrix XenApp 6.5 Farm using Microsoft PowerShell,
Word,
plain text or HTML.
Word is NOT needed to run the script. This script will output in Text and
HTML.
You do NOT have to run this script on a Collector. This script was developed
and run
from a Windows 7 VM. Unfortunately, Citrix did not add remoting support to
the Group
Policy module. If Policy information is required, the script will need to be
run on
a Collector.
You can run this script remotely using the –AdminAddress (AA) parameter.
Word and PDF Document includes a Cover Page, Table of Contents and Footer.
Includes support for the following language versions of Microsoft Word:
Catalan
Chinese
Danish
Dutch
English
Finnish
French
German
Norwegian
Portuguese
Spanish
Swedish
.PARAMETER CompanyName
Company Name to use for the Cover Page.
Default value is contained in
HKCU:\Software\Microsoft\Office\Common\UserInfo\CompanyName or
HKCU:\Software\Microsoft\Office\Common\UserInfo\Company, whichever is
populated on the
computer running the script.
This parameter has an alias of CN.
.PARAMETER CompanyAddress
Company Address to use for the Cover Page, if the Cover Page has the Address
field.
The following Cover Pages have an Address field:
Banded (Word 2013/2016)
Contrast (Word 2010)
Exposure (Word 2010)
Filigree (Word 2013/2016)
Ion (Dark) (Word 2013/2016)
Retrospect (Word 2013/2016)
Semaphore (Word 2013/2016)
Tiles (Word 2010)
ViewMaster (Word 2013/2016)
This parameter is only valid with the MSWORD and PDF output parameters.
This parameter has an alias of CA.
.PARAMETER CompanyEmail
Company Email to use for the Cover Page, if the Cover Page has the Email
field.
The following Cover Pages have an Email field:
Facet (Word 2013/2016)
This parameter is only valid with the MSWORD and PDF output parameters.
This parameter has an alias of CE.
.PARAMETER CompanyFax
Company Fax to use for the Cover Page, if the Cover Page has the Fax field.
The following Cover Pages have a Fax field:
Contrast (Word 2010)
Exposure (Word 2010)
This parameter is only valid with the MSWORD and PDF output parameters.
This parameter has an alias of CF.
.PARAMETER CompanyPhone
Company Phone to use for the Cover Page, if the Cover Page has the Phone
field.
The following Cover Pages have a Phone field:
Contrast (Word 2010)
Exposure (Word 2010)
This parameter is only valid with the MSWORD and PDF output parameters.
This parameter has an alias of CPh.
.PARAMETER CoverPage
What Microsoft Word Cover Page to use.
Only Word 2010, 2013 and 2016 are supported.
(default cover pages in Word en-US)
This parameter may require the script be run from an elevated PowerShell
session
using an account with permission to retrieve hardware information (i.e.
Domain Admin or
Local Administrator).
Selecting this parameter will add to both the time it takes to run the script
and size
of the report.
WARNING: Using this parameter can create an extremely large report and
can take a very long time to run.
This is used when the script developer requests more troubleshooting data.
The text file is placed in the same folder from where the script is run.
Webster" or
HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl
Webster"
$env:username = Administrator
Webster" or
HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl
Webster"
$env:username = Administrator
Will use all Default values and save the document as a PDF file.
HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\CompanyName="Carl
Webster" or
HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl
Webster"
$env:username = Administrator
Will use all default values and save the document as a formatted text file.
HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\CompanyName="Carl
Webster" or
HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl
Webster"
$env:username = Administrator
Will use all default values and save the document as an HTML file.
HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\CompanyName="Carl
Webster" or
HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl
Webster"
$env:username = Administrator
Webster" or
HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl
Webster"
$env:username = Administrator
Webster" or
HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl
Webster"
$env:username = Administrator
Will use all Default values and add additional information for each server
about its
hardware.
HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\CompanyName="Carl
Webster" or
HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl
Webster"
$env:username = Administrator
Will use all Default values and add additional information for each server
about its
installed applications.
HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\CompanyName="Carl
Webster" or
HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl
Webster"
$env:username = Administrator
Will use all Default values and add additional information for each server
about its
installed applications.
HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\CompanyName="Carl
Webster" or
HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl
Webster"
$env:username = Administrator
Will use all Default values and add additional information for each server
about its
installed applications.
HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\CompanyName="Carl
Webster" or
HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl
Webster"
$env:username = Administrator
Will use all Default values and add additional information for each server
about its
installed applications.
HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\CompanyName="Carl
Webster" or
HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl
Webster"
$env:username = Administrator
Will use:
Carl Webster Consulting for the Company Name.
Mod for the Cover Page format.
Carl Webster for the User Name.
.EXAMPLE
PS C:\PSScript .\XA65_Inventory_V5.ps1 -CN "Carl Webster Consulting" -CP
"Mod"
-UN "Carl Webster"
Will use:
Carl Webster Consulting for the Company Name (alias CN).
Mod for the Cover Page format (alias CP).
Carl Webster for the User Name (alias UN).
.EXAMPLE
PS C:\PSScript > .\XA65_Inventory_V5.ps1 -Section Policies
Webster" or
HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl
Webster"
$env:username = Administrator
Creates a report with full details on Farm policies created in AppCenter but
no Citrix AD based Policy information.
Webster" or
HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl
Webster"
$env:username = Administrator
Creates a report with full details on Farm policies created in AppCenter but
no Citrix AD based Policy information.
Webster" or
HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl
Webster"
$env:username = Administrator
Webster" or
HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl
Webster"
$env:username = Administrator
Will use all Default values and save the document as a PDF file.
HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\CompanyName="Carl
Webster" or
HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl
Webster"
$env:username = Administrator
Webster" or
HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl
Webster"
$env:username = Administrator
Webster" or
HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo\Company="Carl
Webster"
$env:username = Administrator
#endregion
Param(
[parameter(ParameterSetName='HTML',Mandatory=$False)]
[Switch]$HTML=$False,
[parameter(ParameterSetName='PDF',Mandatory=$False)]
[Switch]$PDF=$False,
[parameter(ParameterSetName='Text',Mandatory=$False)]
[Switch]$Text=$False,
[parameter(ParameterSetName='Word',Mandatory=$False)]
[Switch]$MSWord=$False,
[parameter(ParameterSetName='HTML',Mandatory=$False)]
[parameter(ParameterSetName='PDF',Mandatory=$False)]
[parameter(ParameterSetName='Text',Mandatory=$False)]
[parameter(ParameterSetName='Word',Mandatory=$False)]
[Alias('ADT')]
[Switch]$AddDateTime=$False,
[parameter(ParameterSetName='HTML',Mandatory=$False)]
[parameter(ParameterSetName='PDF',Mandatory=$False)]
[parameter(ParameterSetName='Text',Mandatory=$False)]
[parameter(ParameterSetName='Word',Mandatory=$False)]
[ValidateNotNullOrEmpty()]
[Alias('AA')]
[string]$AdminAddress='Localhost',
[parameter(ParameterSetName='HTML',Mandatory=$False)]
[parameter(ParameterSetName='PDF',Mandatory=$False)]
[parameter(ParameterSetName='Text',Mandatory=$False)]
[parameter(ParameterSetName='Word',Mandatory=$False)]
[Alias('Admins')]
[Switch]$Administrators=$False,
[parameter(ParameterSetName='HTML',Mandatory=$False)]
[parameter(ParameterSetName='PDF',Mandatory=$False)]
[parameter(ParameterSetName='Text',Mandatory=$False)]
[parameter(ParameterSetName='Word',Mandatory=$False)]
[Alias('Apps')]
[Switch]$Applications=$False,
[parameter(ParameterSetName='PDF',Mandatory=$False)]
[parameter(ParameterSetName='Word',Mandatory=$False)]
[Alias('CA')]
[ValidateNotNullOrEmpty()]
[string]$CompanyAddress='',
[parameter(ParameterSetName='PDF',Mandatory=$False)]
[parameter(ParameterSetName='Word',Mandatory=$False)]
[Alias('CE')]
[ValidateNotNullOrEmpty()]
[string]$CompanyEmail='',
[parameter(ParameterSetName='PDF',Mandatory=$False)]
[parameter(ParameterSetName='Word',Mandatory=$False)]
[Alias('CF')]
[ValidateNotNullOrEmpty()]
[string]$CompanyFax='',
[parameter(ParameterSetName='PDF',Mandatory=$False)]
[parameter(ParameterSetName='Word',Mandatory=$False)]
[Alias('CN')]
[ValidateNotNullOrEmpty()]
[string]$CompanyName='',
[parameter(ParameterSetName='PDF',Mandatory=$False)]
[parameter(ParameterSetName='Word',Mandatory=$False)]
[Alias('CPh')]
[ValidateNotNullOrEmpty()]
[string]$CompanyPhone='',
[parameter(ParameterSetName='PDF',Mandatory=$False)]
[parameter(ParameterSetName='Word',Mandatory=$False)]
[ValidateNotNullOrEmpty()]
[string]$CoverPage='Sideline',
[parameter(ParameterSetName='HTML',Mandatory=$False)]
[parameter(ParameterSetName='PDF',Mandatory=$False)]
[parameter(ParameterSetName='Text',Mandatory=$False)]
[parameter(ParameterSetName='Word',Mandatory=$False)]
[Switch]$Dev=$False,
[parameter(ParameterSetName='HTML',Mandatory=$False)]
[parameter(ParameterSetName='PDF',Mandatory=$False)]
[parameter(ParameterSetName='Text',Mandatory=$False)]
[parameter(ParameterSetName='Word',Mandatory=$False)]
[Alias('ED')]
[Datetime]$EndDate = (Get-Date -displayhint date),
[parameter(ParameterSetName='HTML',Mandatory=$False)]
[parameter(ParameterSetName='PDF',Mandatory=$False)]
[parameter(ParameterSetName='Text',Mandatory=$False)]
[parameter(ParameterSetName='Word',Mandatory=$False)]
[string]$Folder='',
[parameter(ParameterSetName='HTML',Mandatory=$False)]
[parameter(ParameterSetName='PDF',Mandatory=$False)]
[parameter(ParameterSetName='Text',Mandatory=$False)]
[parameter(ParameterSetName='Word',Mandatory=$False)]
[Alias('HW')]
[Switch]$Hardware=$False,
[parameter(ParameterSetName='HTML',Mandatory=$False)]
[parameter(ParameterSetName='PDF',Mandatory=$False)]
[parameter(ParameterSetName='Text',Mandatory=$False)]
[parameter(ParameterSetName='Word',Mandatory=$False)]
[Switch]$Log=$False,
[parameter(ParameterSetName='HTML',Mandatory=$False)]
[parameter(ParameterSetName='PDF',Mandatory=$False)]
[parameter(ParameterSetName='Text',Mandatory=$False)]
[parameter(ParameterSetName='Word',Mandatory=$False)]
[Switch]$Logging=$False,
[parameter(ParameterSetName='HTML',Mandatory=$False)]
[parameter(ParameterSetName='PDF',Mandatory=$False)]
[parameter(ParameterSetName='Text',Mandatory=$False)]
[parameter(ParameterSetName='Word',Mandatory=$False)]
[Alias('MAX')]
[Switch]$MaxDetails=$False,
[parameter(ParameterSetName='HTML',Mandatory=$False)]
[parameter(ParameterSetName='PDF',Mandatory=$False)]
[parameter(ParameterSetName='Text',Mandatory=$False)]
[parameter(ParameterSetName='Word',Mandatory=$False)]
[Alias('NoAD')]
[Switch]$NoADPolicies=$False,
[parameter(ParameterSetName='HTML',Mandatory=$False)]
[parameter(ParameterSetName='PDF',Mandatory=$False)]
[parameter(ParameterSetName='Text',Mandatory=$False)]
[parameter(ParameterSetName='Word',Mandatory=$False)]
[Alias('NP')]
[Switch]$NoPolicies=$False,
[parameter(ParameterSetName='HTML',Mandatory=$False)]
[parameter(ParameterSetName='PDF',Mandatory=$False)]
[parameter(ParameterSetName='Text',Mandatory=$False)]
[parameter(ParameterSetName='Word',Mandatory=$False)]
[Alias('Pol')]
[Switch]$Policies=$False,
[parameter(ParameterSetName='HTML',Mandatory=$False)]
[parameter(ParameterSetName='PDF',Mandatory=$False)]
[parameter(ParameterSetName='Text',Mandatory=$False)]
[parameter(ParameterSetName='Word',Mandatory=$False)]
[Alias('SI')]
[Switch]$ScriptInfo=$False,
[parameter(ParameterSetName='HTML',Mandatory=$False)]
[parameter(ParameterSetName='PDF',Mandatory=$False)]
[parameter(ParameterSetName='Text',Mandatory=$False)]
[parameter(ParameterSetName='Word',Mandatory=$False)]
[string]$Section='All',
[parameter(ParameterSetName='HTML',Mandatory=$False)]
[parameter(ParameterSetName='PDF',Mandatory=$False)]
[parameter(ParameterSetName='Text',Mandatory=$False)]
[parameter(ParameterSetName='Word',Mandatory=$False)]
[Alias('SW')]
[Switch]$Software=$False,
[parameter(ParameterSetName='HTML',Mandatory=$False)]
[parameter(ParameterSetName='PDF',Mandatory=$False)]
[parameter(ParameterSetName='Text',Mandatory=$False)]
[parameter(ParameterSetName='Word',Mandatory=$False)]
[Alias('SD')]
[Datetime]$StartDate = ((Get-Date -displayhint date).AddDays(-7)),
[parameter(ParameterSetName='HTML',Mandatory=$False)]
[parameter(ParameterSetName='PDF',Mandatory=$False)]
[parameter(ParameterSetName='Text',Mandatory=$False)]
[parameter(ParameterSetName='Word',Mandatory=$False)]
[Switch]$Summary=$False,
[parameter(ParameterSetName='PDF',Mandatory=$False)]
[parameter(ParameterSetName='Word',Mandatory=$False)]
[Alias('UN')]
[ValidateNotNullOrEmpty()]
[string]$UserName=$env:username
#endregion
#force on
$SaveEAPreference = $ErrorActionPreference
$ErrorActionPreference = 'SilentlyContinue'
If(!(Test-Path Variable:AdminAddress))
{
$AdminAddress = "LocalHost"
}
If(!(Test-Path Variable:CompanyAddress))
{
$CompanyAddress = ""
}
If(!(Test-Path Variable:CompanyEmail))
{
$CompanyEmail = ""
}
If(!(Test-Path Variable:CompanyFax))
{
$CompanyFax = ""
}
If(!(Test-Path Variable:CompanyName))
{
$CompanyName = ""
}
If(!(Test-Path Variable:CompanyPhone))
{
$CompanyPhone = ""
}
If(!(Test-Path Variable:CoverPage))
{
$CoverPage="Sideline"
}
If(!(Test-Path Variable:UserName))
{
$UserName=$env:username
}
If(!(Test-Path Variable:HTML))
{
$HTML = $False
}
If(!(Test-Path Variable:MSWord))
{
$MSWord = $False
}
If(!(Test-Path Variable:PDF))
{
$PDF = $False
}
If(!(Test-Path Variable:Text))
{
$Text = $False
}
If(!(Test-Path Variable:Administrators))
{
$Administrators=$False
}
If(!(Test-Path Variable:Applications))
{
$Applications=$False
}
If(!(Test-Path Variable:Logging))
{
$Logging=$False
}
If(!(Test-Path Variable:StartDate))
{
$StartDate = ((Get-Date -displayhint date).AddDays(-7))
}
If(!(Test-Path Variable:EndDate))
{
$EndDate = (Get-Date -displayhint date)
}
If(!(Test-Path Variable:Summary))
{
$Summary = $False
}
If(!(Test-Path Variable:MaxDetails))
{
$MaxDetails=$False
}
If(!(Test-Path Variable:Policies))
{
$Policies = $False
}
If(!(Test-Path Variable:NoPolicies))
{
$NoPolicies = $False
}
If(!(Test-Path Variable:NoADPolicies))
{
$NoADPolicies = $False
}
If(!(Test-Path Variable:AddDateTime))
{
$AddDateTime = $False
}
If(!(Test-Path Variable:Folder))
{
$Folder = ""
}
If(!(Test-Path Variable:Hardware))
{
$Hardware = $False
}
If(!(Test-Path Variable:Software))
{
$Software = $False
}
If(!(Test-Path Variable:Section))
{
$Section = "All"
}
If(!(Test-Path Variable:Dev))
{
$Dev = $False
}
If(!(Test-Path Variable:ScriptInfo))
{
$ScriptInfo = $False
}
If(!(Test-Path Variable:Log))
{
$Log = $False
}
If($MSWord -eq $False -and $PDF -eq $False -and $Text -eq $False -and $HTML -eq
$False)
{
$MSWord = $True
}
If($Log)
{
#start transcript logging
$Script:ThisScriptPath = Split-Path -Parent
$MyInvocation.MyCommand.Definition
$Script:LogPath = "$Script:ThisScriptPath\XA65V5DocScriptTranscript_$(Get-
Date -f yyyy-MM-dd_HHmm).txt"
try
{
Start-Transcript -Path $Script:LogPath -Force -Verbose:$false | Out-
Null
Write-Host "$(Get-Date): Transcript/log started at $Script:LogPath"
-BackgroundColor Black -ForegroundColor Yellow
$Script:StartLog = $true
}
catch
{
Write-Host "$(Get-Date): Transcript/log failed at $Script:LogPath"
-BackgroundColor Black -ForegroundColor Yellow
$Script:StartLog = $false
}
}
If($Dev)
{
$Error.Clear()
$Script:DevErrorFile = "$($pwd.Path)\XA65V5InventoryScriptErrors_$(Get-Date
-f yyyy-MM-dd_HHmm).txt"
}
If($MSWord -eq $False -and $PDF -eq $False -and $Text -eq $False -and $HTML -eq
$False)
{
$MSWord = $True
}
#If the MaxDetails parameter is used, set a bunch of stuff true and some stuff
false
If($MaxDetails)
{
$Administrators = $True
$Applications = $True
$HardWare = $True
$Logging = $True
$Policies = $True
$Software = $True
$NoPolicies = $False
$Section = "All"
}
If($NoPolicies)
{
$Policies = $False
}
$ValidSection = $False
Switch ($Section)
{
"Admins" {$ValidSection = $True; Break}
"Apps" {$ValidSection = $True; Break}
"ConfigLog" {$ValidSection = $True; $Logging = $True; Break} #force
$logging true if the config logging section is specified}
"LBPolicies" {$ValidSection = $True; Break}
"LoadEvals" {$ValidSection = $True; Break}
"Policies" {$ValidSection = $True; $Policies = $True; Break} #force
$policies true if the policies section is specified
"Servers" {$ValidSection = $True; Break}
"WGs" {$ValidSection = $True; Break}
"Zones" {$ValidSection = $True; Break}
"All" {$ValidSection = $True; Break}
}
`t`tAdmins
`t`tApps
`t`tConfigLog
`t`tLBPolicies
`t`tLoadEvals
`t`tPolicies
`t`tServers
`t`tWGs
`t`tZones
`t`tAll
[int]$PointsPerTabStop = 36
[int]$Indent0TabStops = 0 * $PointsPerTabStop
[int]$Indent1TabStops = 1 * $PointsPerTabStop
[int]$Indent2TabStops = 2 * $PointsPerTabStop
[int]$Indent3TabStops = 3 * $PointsPerTabStop
[int]$Indent4TabStops = 4 * $PointsPerTabStop
# http://www.thedoctools.com/index.php?
show=wt_style_names_english_danish_german_french
[int]$wdStyleHeading1 = -2
[int]$wdStyleHeading2 = -3
[int]$wdStyleHeading3 = -4
[int]$wdStyleHeading4 = -5
[int]$wdStyleNoSpacing = -158
[int]$wdTableGrid = -155
[int]$wdTableLightListAccent3 = -206
#http://groovy.codehaus.org/modules/scriptom/1.6.0/scriptom-office-2K3-
tlb/apidocs/org/codehaus/groovy/scriptom/tlb/office/word/WdLineStyle.html
[int]$wdLineStyleNone = 0
[int]$wdLineStyleSingle = 1
[int]$wdHeadingFormatTrue = -1
[int]$wdHeadingFormatFalse = 0
If($HTML)
{
Set-Variable htmlredmask -Option AllScope -Value "#FF0000"
Set-Variable htmlcyanmask -Option AllScope -Value "#00FFFF"
Set-Variable htmlbluemask -Option AllScope -Value "#0000FF"
Set-Variable htmldarkbluemask -Option AllScope -Value "#0000A0"
Set-Variable htmllightbluemask -Option AllScope -Value "#ADD8E6"
Set-Variable htmlpurplemask -Option AllScope -Value "#800080"
Set-Variable htmlyellowmask -Option AllScope -Value "#FFFF00"
Set-Variable htmllimemask -Option AllScope -Value "#00FF00"
Set-Variable htmlmagentamask -Option AllScope -Value "#FF00FF"
Set-Variable htmlwhitemask -Option AllScope -Value "#FFFFFF"
Set-Variable htmlsilvermask -Option AllScope -Value "#C0C0C0"
Set-Variable htmlgraymask -Option AllScope -Value "#808080"
Set-Variable htmlblackmask -Option AllScope -Value "#000000"
Set-Variable htmlorangemask -Option AllScope -Value "#FFA500"
Set-Variable htmlmaroonmask -Option AllScope -Value "#800000"
Set-Variable htmlgreenmask -Option AllScope -Value "#008000"
Set-Variable htmlolivemask -Option AllScope -Value "#808000"
If($TEXT)
{
$Script:output = ""
}
#endregion
Try
{
$Results = Get-WmiObject -computername $RemoteComputerName
win32_computersystem
}
Catch
{
$Results = $Null
}
ForEach($Item in $ComputerItems)
{
OutputComputerItem $Item $ComputerOS
}
}
ElseIf(!$?)
{
Write-Host "$(Get-Date): Get-WmiObject win32_computersystem failed for
$($RemoteComputerName)" -BackgroundColor Black -ForegroundColor Yellow
Write-Warning "Get-WmiObject win32_computersystem failed for $
($RemoteComputerName)"
If($MSWORD -or $PDF)
{
WriteWordLine 0 2 "Get-WmiObject win32_computersystem failed for
$($RemoteComputerName)" "" $Null 0 $False $True
WriteWordLine 0 2 "On $($RemoteComputerName) you may need to run
winmgmt /verifyrepository" "" $Null 0 $False $True
WriteWordLine 0 2 "and winmgmt /salvagerepository. If this is a
trusted Forest, you may" "" $Null 0 $False $True
WriteWordLine 0 2 "need to rerun the script with Domain Admin
credentials from the trusted Forest." "" $Null 0 $False $True
}
ElseIf($Text)
{
Line 2 "Get-WmiObject win32_computersystem failed for $
($RemoteComputerName)"
Line 2 "On $($RemoteComputerName) you may need to run winmgmt
/verifyrepository"
Line 2 "and winmgmt /salvagerepository. If this is a trusted
Forest, you may"
Line 2 "need to rerun the script with Domain Admin credentials
from the trusted Forest."
Line 2 ""
}
ElseIf($HTML)
{
WriteHTMLLine 0 2 "Get-WmiObject win32_computersystem failed for
$($RemoteComputerName)" "" $Null 0 $False $True
WriteHTMLLine 0 2 "On $($RemoteComputerName) you may need to run
winmgmt /verifyrepository" "" $Null 0 $False $True
WriteHTMLLine 0 2 "and winmgmt /salvagerepository. If this is a
trusted Forest, you may" "" $Null 0 $False $True
WriteHTMLLine 0 2 "need to rerun the script with Domain Admin
credentials from the trusted Forest." "" $Null 0 $False $True
}
}
Else
{
Write-Host "$(Get-Date): No results Returned for Computer information"
-BackgroundColor Black -ForegroundColor Yellow
If($MSWORD -or $PDF)
{
WriteWordLine 0 2 "No results Returned for Computer information"
"" $Null 0 $False $True
}
ElseIf($Text)
{
Line 2 "No results Returned for Computer information"
}
ElseIf($HTML)
{
WriteHTMLLine 0 2 "No results Returned for Computer information"
"" $Null 0 $False $True
}
}
Try
{
$Results = Get-WmiObject -computername $RemoteComputerName
Win32_LogicalDisk
}
Catch
{
$Results = $Null
}
Try
{
$Results = Get-WmiObject -computername $RemoteComputerName
win32_Processor
}
Catch
{
$Results = $Null
}
#Get Nics
Write-Host "$(Get-Date): `t`t`tNIC information" -BackgroundColor Black
-ForegroundColor Yellow
[bool]$GotNics = $True
Try
{
$Results = Get-WmiObject -computername $RemoteComputerName
win32_networkadapterconfiguration
}
Catch
{
$Results = $Null
}
If($GotNics)
{
ForEach($nic in $nics)
{
Try
{
$ThisNic = Get-WmiObject -computername
$RemoteComputerName win32_networkadapter | Where-Object {$_.index -eq $nic.index}
}
Catch
{
$ThisNic = $Null
}
Function OutputComputerItem
{
Param([object]$Item, [string]$OS)
$Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustNone)
FindWordDocumentEnd
$Table = $Null
WriteWordLine 0 0 ""
}
ElseIf($Text)
{
Line 2 "Manufacturer`t`t`t: " $Item.manufacturer
Line 2 "Model`t`t`t`t: " $Item.model
Line 2 "Domain`t`t`t`t: " $Item.domain
Line 2 "Operating System`t`t: " $OS
Line 2 "Total Ram`t`t`t: $($Item.totalphysicalram) GB"
Line 2 "Physical Processors (sockets)`t: " $Item.NumberOfProcessors
Line 2 "Logical Processors (cores w/HT)`t: "
$Item.NumberOfLogicalProcessors
Line 2 ""
}
ElseIf($HTML)
{
$rowdata = @()
$columnHeaders = @("Manufacturer",($htmlsilver -bor $htmlbold),
$Item.manufacturer,$htmlwhite)
$rowdata += @(,('Model',($htmlsilver -bor $htmlbold),$Item.model,
$htmlwhite))
$rowdata += @(,('Domain',($htmlsilver -bor $htmlbold),$Item.domain,
$htmlwhite))
$rowdata += @(,('Operating System',($htmlsilver -bor $htmlbold),$OS,
$htmlwhite))
$rowdata += @(,('Total Ram',($htmlsilver -bor $htmlbold),"$
($Item.totalphysicalram) GB",$htmlwhite))
$rowdata += @(,('Physical Processors (sockets)',($htmlsilver -bor
$htmlbold),$Item.NumberOfProcessors,$htmlwhite))
$rowdata += @(,('Logical Processors (cores w/HT)',($htmlsilver -bor
$htmlbold),$Item.NumberOfLogicalProcessors,$htmlwhite))
Function OutputDriveItem
{
Param([object]$Drive)
$xDriveType = ""
Switch ($drive.drivetype)
{
0 {$xDriveType = "Unknown"; Break}
1 {$xDriveType = "No Root Directory"; Break}
2 {$xDriveType = "Removable Disk"; Break}
3 {$xDriveType = "Local Disk"; Break}
4 {$xDriveType = "Network Drive"; Break}
5 {$xDriveType = "Compact Disc"; Break}
6 {$xDriveType = "RAM Disk"; Break}
Default {$xDriveType = "Unknown"; Break}
}
$xVolumeDirty = ""
If(![String]::IsNullOrEmpty($drive.volumedirty))
{
If($drive.volumedirty)
{
$xVolumeDirty = "Yes"
}
Else
{
$xVolumeDirty = "No"
}
}
$Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
FindWordDocumentEnd
$Table = $Null
WriteWordLine 0 2 ""
}
ElseIf($Text)
{
Line 2 "Caption`t`t: " $drive.caption
Line 2 "Size`t`t: $($drive.drivesize) GB"
If(![String]::IsNullOrEmpty($drive.filesystem))
{
Line 2 "File System`t: " $drive.filesystem
}
Line 2 "Free Space`t: $($drive.drivefreespace) GB"
If(![String]::IsNullOrEmpty($drive.volumename))
{
Line 2 "Volume Name`t: " $drive.volumename
}
If(![String]::IsNullOrEmpty($drive.volumedirty))
{
Line 2 "Volume is Dirty`t: " $xVolumeDirty
}
If(![String]::IsNullOrEmpty($drive.volumeserialnumber))
{
Line 2 "Volume Serial #`t: " $drive.volumeserialnumber
}
Line 2 "Drive Type`t: " $xDriveType
Line 2 ""
}
ElseIf($HTML)
{
$rowdata = @()
$columnHeaders = @("Caption",($htmlsilver -bor $htmlbold),
$Drive.caption,$htmlwhite)
$rowdata += @(,('Size',($htmlsilver -bor $htmlbold),"$
($drive.drivesize) GB",$htmlwhite))
If(![String]::IsNullOrEmpty($drive.filesystem))
{
$rowdata += @(,('File System',($htmlsilver -bor $htmlbold),
$Drive.filesystem,$htmlwhite))
}
$rowdata += @(,('Free Space',($htmlsilver -bor $htmlbold),"$
($drive.drivefreespace) GB",$htmlwhite))
If(![String]::IsNullOrEmpty($drive.volumename))
{
$rowdata += @(,('Volume Name',($htmlsilver -bor $htmlbold),
$Drive.volumename,$htmlwhite))
}
If(![String]::IsNullOrEmpty($drive.volumedirty))
{
$rowdata += @(,('Volume is Dirty',($htmlsilver -bor $htmlbold),
$xVolumeDirty,$htmlwhite))
}
If(![String]::IsNullOrEmpty($drive.volumeserialnumber))
{
$rowdata += @(,('Volume Serial Number',($htmlsilver -bor
$htmlbold),$Drive.volumeserialnumber,$htmlwhite))
}
$rowdata += @(,('Drive Type',($htmlsilver -bor $htmlbold),$xDriveType,
$htmlwhite))
$msg = "Drive(s)"
$columnWidths = @("150px","200px")
FormatHTMLTable $msg -rowarray $rowdata -columnArray $columnheaders
-fixedWidth $columnWidths
WriteHTMLLine 0 0 ""
}
}
Function OutputProcessorItem
{
Param([object]$Processor)
$xAvailability = ""
Switch ($processor.availability)
{
1 {$xAvailability = "Other"; Break}
2 {$xAvailability = "Unknown"; Break}
3 {$xAvailability = "Running or Full Power"; Break}
4 {$xAvailability = "Warning"; Break}
5 {$xAvailability = "In Test"; Break}
6 {$xAvailability = "Not Applicable"; Break}
7 {$xAvailability = "Power Off"; Break}
8 {$xAvailability = "Off Line"; Break}
9 {$xAvailability = "Off Duty"; Break}
10 {$xAvailability = "Degraded"; Break}
11 {$xAvailability = "Not Installed"; Break}
12 {$xAvailability = "Install Error"; Break}
13 {$xAvailability = "Power Save - Unknown"; Break}
14 {$xAvailability = "Power Save - Low Power Mode"; Break}
15 {$xAvailability = "Power Save - Standby"; Break}
16 {$xAvailability = "Power Cycle"; Break}
17 {$xAvailability = "Power Save - Warning"; Break}
Default {$xAvailability = "Unknown"; Break}
}
$Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
FindWordDocumentEnd
$Table = $Null
WriteWordLine 0 0 ""
}
ElseIf($Text)
{
Line 2 "Name`t`t`t`t: " $processor.name
Line 2 "Description`t`t`t: " $processor.description
Line 2 "Max Clock Speed`t`t`t: $($processor.maxclockspeed) MHz"
If($processor.l2cachesize -gt 0)
{
Line 2 "L2 Cache Size`t`t`t: $($processor.l2cachesize) KB"
}
If($processor.l3cachesize -gt 0)
{
Line 2 "L3 Cache Size`t`t`t: $($processor.l3cachesize) KB"
}
If($processor.numberofcores -gt 0)
{
Line 2 "# of Cores`t`t`t: " $processor.numberofcores
}
If($processor.numberoflogicalprocessors -gt 0)
{
Line 2 "# of Logical Procs (cores w/HT)`t: "
$processor.numberoflogicalprocessors
}
Line 2 "Availability`t`t`t: " $xAvailability
Line 2 ""
}
ElseIf($HTML)
{
$rowdata = @()
$columnHeaders = @("Name",($htmlsilver -bor $htmlbold),$Processor.name,
$htmlwhite)
$rowdata += @(,('Description',($htmlsilver -bor $htmlbold),
$Processor.description,$htmlwhite))
$msg = "Processor(s)"
$columnWidths = @("150px","200px")
FormatHTMLTable $msg -rowarray $rowdata -columnArray $columnheaders
-fixedWidth $columnWidths
WriteHTMLLine 0 0 ""
}
}
Function OutputNicItem
{
Param([object]$Nic, [object]$ThisNic)
$xAvailability = ""
Switch ($processor.availability)
{
1 {$xAvailability = "Other"; Break}
2 {$xAvailability = "Unknown"; Break}
3 {$xAvailability = "Running or Full Power"; Break}
4 {$xAvailability = "Warning"; Break}
5 {$xAvailability = "In Test"; Break}
6 {$xAvailability = "Not Applicable"; Break}
7 {$xAvailability = "Power Off"; Break}
8 {$xAvailability = "Off Line"; Break}
9 {$xAvailability = "Off Duty"; Break}
10 {$xAvailability = "Degraded"; Break}
11 {$xAvailability = "Not Installed"; Break}
12 {$xAvailability = "Install Error"; Break}
13 {$xAvailability = "Power Save - Unknown"; Break}
14 {$xAvailability = "Power Save - Low Power Mode"; Break}
15 {$xAvailability = "Power Save - Standby"; Break}
16 {$xAvailability = "Power Cycle"; Break}
17 {$xAvailability = "Power Save - Warning"; Break}
Default {$xAvailability = "Unknown"; Break}
}
$xIPAddress = @()
ForEach($IPAddress in $Nic.ipaddress)
{
$xIPAddress += "$($IPAddress)"
}
$xIPSubnet = @()
ForEach($IPSubnet in $Nic.ipsubnet)
{
$xIPSubnet += "$($IPSubnet)"
}
$xdnsenabledforwinsresolution = ""
If($nic.dnsenabledforwinsresolution)
{
$xdnsenabledforwinsresolution = "Yes"
}
Else
{
$xdnsenabledforwinsresolution = "No"
}
$xTcpipNetbiosOptions = ""
Switch ($nic.TcpipNetbiosOptions)
{
0 {$xTcpipNetbiosOptions = "Use NetBIOS setting from DHCP Server";
Break}
1 {$xTcpipNetbiosOptions = "Enable NetBIOS"; Break}
2 {$xTcpipNetbiosOptions = "Disable NetBIOS"; Break}
Default {$xTcpipNetbiosOptions = "Unknown"; Break}
}
$xwinsenablelmhostslookup = ""
If($nic.winsenablelmhostslookup)
{
$xwinsenablelmhostslookup = "Yes"
}
Else
{
$xwinsenablelmhostslookup = "No"
}
$Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
FindWordDocumentEnd
$Table = $Null
WriteWordLine 0 0 ""
}
ElseIf($Text)
{
Line 2 "Name`t`t`t: " $ThisNic.Name
If($ThisNic.Name -ne $nic.description)
{
Line 2 "Description`t`t: " $nic.description
}
Line 2 "Connection ID`t`t: " $ThisNic.NetConnectionID
If(validObject $Nic Manufacturer)
{
Line 2 "Manufacturer`t`t: " $Nic.manufacturer
}
Line 2 "Availability`t`t: " $xAvailability
Line 2 "Allow computer to turn "
Line 2 "off device to save power: " $PowerSaving
Line 2 "Physical Address`t: " $nic.macaddress
Line 2 "IP Address`t`t: " $xIPAddress[0]
$cnt = -1
ForEach($tmp in $xIPAddress)
{
$cnt++
If($cnt -gt 0)
{
Line 5 " " $tmp
}
}
Line 2 "Default Gateway`t`t: " $Nic.Defaultipgateway
Line 2 "Subnet Mask`t`t: " $xIPSubnet[0]
$cnt = -1
ForEach($tmp in $xIPSubnet)
{
$cnt++
If($cnt -gt 0)
{
Line 5 " " $tmp
}
}
If($nic.dhcpenabled)
{
$DHCPLeaseObtainedDate =
$nic.ConvertToDateTime($nic.dhcpleaseobtained)
$DHCPLeaseExpiresDate =
$nic.ConvertToDateTime($nic.dhcpleaseexpires)
Line 2 "DHCP Enabled`t`t: " $nic.dhcpenabled
Line 2 "DHCP Lease Obtained`t: " $dhcpleaseobtaineddate
Line 2 "DHCP Lease Expires`t: " $dhcpleaseexpiresdate
Line 2 "DHCP Server`t`t:" $nic.dhcpserver
}
If(![String]::IsNullOrEmpty($nic.dnsdomain))
{
Line 2 "DNS Domain`t`t: " $nic.dnsdomain
}
If($Null -ne $nic.dnsdomainsuffixsearchorder -and
$nic.dnsdomainsuffixsearchorder.length -gt 0)
{
[int]$x = 1
Line 2 "DNS Search Suffixes`t: "
$xnicdnsdomainsuffixsearchorder[0]
$cnt = -1
ForEach($tmp in $xnicdnsdomainsuffixsearchorder)
{
$cnt++
If($cnt -gt 0)
{
Line 5 " " $tmp
}
}
}
Line 2 "DNS WINS Enabled`t: " $xdnsenabledforwinsresolution
If($Null -ne $nic.dnsserversearchorder -and
$nic.dnsserversearchorder.length -gt 0)
{
[int]$x = 1
Line 2 "DNS Servers`t`t: " $xnicdnsserversearchorder[0]
$cnt = -1
ForEach($tmp in $xnicdnsserversearchorder)
{
$cnt++
If($cnt -gt 0)
{
Line 5 " " $tmp
}
}
}
Line 2 "NetBIOS Setting`t`t: " $xTcpipNetbiosOptions
Line 2 "WINS:"
Line 3 "Enabled LMHosts`t: " $xwinsenablelmhostslookup
If(![String]::IsNullOrEmpty($nic.winshostlookupfile))
{
Line 3 "Host Lookup File`t: " $nic.winshostlookupfile
}
If(![String]::IsNullOrEmpty($nic.winsprimaryserver))
{
Line 3 "Primary Server`t: " $nic.winsprimaryserver
}
If(![String]::IsNullOrEmpty($nic.winssecondaryserver))
{
Line 3 "Secondary Server`t: " $nic.winssecondaryserver
}
If(![String]::IsNullOrEmpty($nic.winsscopeid))
{
Line 3 "Scope ID`t`t: " $nic.winsscopeid
}
Line 0 ""
}
ElseIf($HTML)
{
$rowdata = @()
$columnHeaders = @("Name",($htmlsilver -bor $htmlbold),$ThisNic.Name,
$htmlwhite)
If($ThisNic.Name -ne $nic.description)
{
$rowdata += @(,('Description',($htmlsilver -bor $htmlbold),
$Nic.description,$htmlwhite))
}
$rowdata += @(,('Connection ID',($htmlsilver -bor $htmlbold),
$ThisNic.NetConnectionID,$htmlwhite))
If(validObject $Nic Manufacturer)
{
$rowdata += @(,('Manufacturer',($htmlsilver -bor $htmlbold),
$Nic.manufacturer,$htmlwhite))
}
$rowdata += @(,('Availability',($htmlsilver -bor $htmlbold),
$xAvailability,$htmlwhite))
$rowdata += @(,('Allow the computer to turn off this device to save
power',($htmlsilver -bor $htmlbold),$PowerSaving,$htmlwhite))
$rowdata += @(,('Physical Address',($htmlsilver -bor $htmlbold),
$Nic.macaddress,$htmlwhite))
$rowdata += @(,('IP Address',($htmlsilver -bor $htmlbold),
$xIPAddress[0],$htmlwhite))
$cnt = -1
ForEach($tmp in $xIPAddress)
{
$cnt++
If($cnt -gt 0)
{
$rowdata += @(,('IP Address',($htmlsilver -bor $htmlbold),
$tmp,$htmlwhite))
}
}
$rowdata += @(,('Default Gateway',($htmlsilver -bor $htmlbold),
$Nic.Defaultipgateway[0],$htmlwhite))
$rowdata += @(,('Subnet Mask',($htmlsilver -bor $htmlbold),
$xIPSubnet[0],$htmlwhite))
$cnt = -1
ForEach($tmp in $xIPSubnet)
{
$cnt++
If($cnt -gt 0)
{
$rowdata += @(,('Subnet Mask',($htmlsilver -bor $htmlbold),
$tmp,$htmlwhite))
}
}
If($nic.dhcpenabled)
{
$DHCPLeaseObtainedDate =
$nic.ConvertToDateTime($nic.dhcpleaseobtained)
$DHCPLeaseExpiresDate =
$nic.ConvertToDateTime($nic.dhcpleaseexpires)
$rowdata += @(,('DHCP Enabled',($htmlsilver -bor $htmlbold),
$Nic.dhcpenabled,$htmlwhite))
$rowdata += @(,('DHCP Lease Obtained',($htmlsilver -bor
$htmlbold),$dhcpleaseobtaineddate,$htmlwhite))
$rowdata += @(,('DHCP Lease Expires',($htmlsilver -bor
$htmlbold),$dhcpleaseexpiresdate,$htmlwhite))
$rowdata += @(,('DHCP Server',($htmlsilver -bor $htmlbold),
$Nic.dhcpserver,$htmlwhite))
}
If(![String]::IsNullOrEmpty($nic.dnsdomain))
{
$rowdata += @(,('DNS Domain',($htmlsilver -bor $htmlbold),
$Nic.dnsdomain,$htmlwhite))
}
If($Null -ne $nic.dnsdomainsuffixsearchorder -and
$nic.dnsdomainsuffixsearchorder.length -gt 0)
{
$rowdata += @(,('DNS Search Suffixes',($htmlsilver -bor
$htmlbold),$xnicdnsdomainsuffixsearchorder[0],$htmlwhite))
$cnt = -1
ForEach($tmp in $xnicdnsdomainsuffixsearchorder)
{
$cnt++
If($cnt -gt 0)
{
$rowdata += @(,('',($htmlsilver -bor $htmlbold),$tmp,
$htmlwhite))
}
}
}
$rowdata += @(,('DNS WINS Enabled',($htmlsilver -bor $htmlbold),
$xdnsenabledforwinsresolution,$htmlwhite))
If($Null -ne $nic.dnsserversearchorder -and
$nic.dnsserversearchorder.length -gt 0)
{
$rowdata += @(,('DNS Servers',($htmlsilver -bor $htmlbold),
$xnicdnsserversearchorder[0],$htmlwhite))
$cnt = -1
ForEach($tmp in $xnicdnsserversearchorder)
{
$cnt++
If($cnt -gt 0)
{
$rowdata += @(,('',($htmlsilver -bor $htmlbold),$tmp,
$htmlwhite))
}
}
}
$rowdata += @(,('NetBIOS Setting',($htmlsilver -bor $htmlbold),
$xTcpipNetbiosOptions,$htmlwhite))
$rowdata += @(,('WINS: Enabled LMHosts',($htmlsilver -bor $htmlbold),
$xwinsenablelmhostslookup,$htmlwhite))
If(![String]::IsNullOrEmpty($nic.winshostlookupfile))
{
$rowdata += @(,('Host Lookup File',($htmlsilver -bor $htmlbold),
$Nic.winshostlookupfile,$htmlwhite))
}
If(![String]::IsNullOrEmpty($nic.winsprimaryserver))
{
$rowdata += @(,('Primary Server',($htmlsilver -bor $htmlbold),
$Nic.winsprimaryserver,$htmlwhite))
}
If(![String]::IsNullOrEmpty($nic.winssecondaryserver))
{
$rowdata += @(,('Secondary Server',($htmlsilver -bor $htmlbold),
$Nic.winssecondaryserver,$htmlwhite))
}
If(![String]::IsNullOrEmpty($nic.winsscopeid))
{
$rowdata += @(,('Scope ID',($htmlsilver -bor $htmlbold),
$Nic.winsscopeid,$htmlwhite))
}
#ca - Catalan
#da - Danish
#de - German
#en - English
#es - Spanish
#fi - Finnish
#fr - French
#nb - Norwegian
#nl - Dutch
#pt - Portuguese
#sv - Swedish
#zh - Chinese
[string]$toc = $(
Switch ($CultureCode)
{
'ca-' { 'Taula automática 2'; Break }
'da-' { 'Automatisk tabel 2'; Break }
'de-' { 'Automatische Tabelle 2'; Break }
'en-' { 'Automatic Table 2'; Break }
'es-' { 'Tabla automática 2'; Break }
'fi-' { 'Automaattinen taulukko 2'; Break }
# 'fr-' { 'Sommaire Automatique 2'; Break }
'fr-' { 'Table automatique 2'; Break } #changed 10-feb-2017 david
roquier and samuel legrand
'nb-' { 'Automatisk tabell 2'; Break }
'nl-' { 'Automatische inhoudsopgave 2'; Break }
'pt-' { 'Sumário Automático 2'; Break }
'sv-' { 'Automatisk innehållsförteckning2'; Break }
'zh-' { '自动目录 2'; Break }
}
)
$Script:myHash = @{}
$Script:myHash.Word_TableOfContents = $toc
$Script:myHash.Word_NoSpacing = $wdStyleNoSpacing
$Script:myHash.Word_Heading1 = $wdStyleheading1
$Script:myHash.Word_Heading2 = $wdStyleheading2
$Script:myHash.Word_Heading3 = $wdStyleheading3
$Script:myHash.Word_Heading4 = $wdStyleheading4
$Script:myHash.Word_TableGrid = $wdTableGrid
}
Function GetCulture
{
Param([int]$WordValue)
#ca - Catalan
#da - Danish
#de - German
#en - English
#es - Spanish
#fi - Finnish
#fr - French
#nb - Norwegian
#nl - Dutch
#pt - Portuguese
#sv - Swedish
#zh - Chinese
Switch ($WordValue)
{
{$CatalanArray -contains $_} {$CultureCode = "ca-"}
{$ChineseArray -contains $_} {$CultureCode = "zh-"}
{$DanishArray -contains $_} {$CultureCode = "da-"}
{$DutchArray -contains $_} {$CultureCode = "nl-"}
{$EnglishArray -contains $_} {$CultureCode = "en-"}
{$FinnishArray -contains $_} {$CultureCode = "fi-"}
{$FrenchArray -contains $_} {$CultureCode = "fr-"}
{$GermanArray -contains $_} {$CultureCode = "de-"}
{$NorwegianArray -contains $_} {$CultureCode = "nb-"}
{$PortugueseArray -contains $_} {$CultureCode = "pt-"}
{$SpanishArray -contains $_} {$CultureCode = "es-"}
{$SwedishArray -contains $_} {$CultureCode = "sv-"}
Default {$CultureCode = "en-"}
}
Return $CultureCode
}
Function ValidateCoverPage
{
Param([int]$xWordVersion, [string]$xCP, [string]$CultureCode)
$xArray = ""
Switch ($CultureCode)
{
'ca-' {
If($xWordVersion -eq $wdWord2016)
{
$xArray = ("Austin", "En bandes", "Faceta",
"Filigrana",
"Integral", "Ió (clar)", "Ió (fosc)", "Línia
lateral",
"Moviment", "Quadrícula", "Retrospectiu", "Sector
(clar)",
"Sector (fosc)", "Semàfor", "Visualització
principal", "Whisp")
}
ElseIf($xWordVersion -eq $wdWord2013)
{
$xArray = ("Austin", "En bandes", "Faceta",
"Filigrana",
"Integral", "Ió (clar)", "Ió (fosc)", "Línia
lateral",
"Moviment", "Quadrícula", "Retrospectiu", "Sector
(clar)",
"Sector (fosc)", "Semàfor", "Visualització", "Whisp")
}
ElseIf($xWordVersion -eq $wdWord2010)
{
$xArray = ("Alfabet", "Anual", "Austin",
"Conservador",
"Contrast", "Cubicles", "Diplomàtic", "Exposició",
"Línia lateral", "Mod", "Mosiac", "Moviment", "Paper
de diari",
"Perspectiva", "Piles", "Quadrícula", "Sobri",
"Transcendir", "Trencaclosques")
}
}
'da-' {
If($xWordVersion -eq $wdWord2016)
{
$xArray = ("Austin", "BevægElse", "Brusen", "Facet",
"Filigran",
"Gitter", "Integral", "Ion (lys)", "Ion (mørk)",
"Retro", "Semafor", "Sidelinje", "Stribet",
"Udsnit (lys)", "Udsnit (mørk)", "Visningsmaster")
}
ElseIf($xWordVersion -eq $wdWord2013)
{
$xArray = ("BevægElse", "Brusen", "Ion (lys)",
"Filigran",
"Retro", "Semafor", "Visningsmaster", "Integral",
"Facet", "Gitter", "Stribet", "Sidelinje", "Udsnit
(lys)",
"Udsnit (mørk)", "Ion (mørk)", "Austin")
}
ElseIf($xWordVersion -eq $wdWord2010)
{
$xArray = ("BevægElse", "Moderat", "Perspektiv",
"Firkanter",
"Overskrid", "Alfabet", "Kontrast", "Stakke",
"Fliser", "Gåde",
"Gitter", "Austin", "Eksponering", "Sidelinje",
"Enkel",
"Nålestribet", "Årlig", "Avispapir", "Tradionel")
}
}
'de-' {
If($xWordVersion -eq $wdWord2016)
{
$xArray = ("Austin", "Bewegung", "Facette",
"Filigran",
"Gebändert", "Integral", "Ion (dunkel)", "Ion
(hell)",
"Pfiff", "Randlinie", "Raster", "Rückblick",
"Segment (dunkel)", "Segment (hell)", "Semaphor",
"ViewMaster")
}
ElseIf($xWordVersion -eq $wdWord2013)
{
$xArray = ("Semaphor", "Segment (hell)", "Ion
(hell)",
"Raster", "Ion (dunkel)", "Filigran", "Rückblick",
"Pfiff",
"ViewMaster", "Segment (dunkel)", "Verbunden",
"Bewegung",
"Randlinie", "Austin", "Integral", "Facette")
}
ElseIf($xWordVersion -eq $wdWord2010)
{
$xArray = ("Alphabet", "Austin", "Bewegung",
"Durchscheinend",
"Herausgestellt", "Jährlich", "Kacheln", "Kontrast",
"Kubistisch",
"Modern", "Nadelstreifen", "Perspektive", "Puzzle",
"Randlinie",
"Raster", "Schlicht", "Stapel", "Traditionell",
"Zeitungspapier")
}
}
'en-' {
If($xWordVersion -eq $wdWord2013 -or $xWordVersion -eq
$wdWord2016)
{
$xArray = ("Austin", "Banded", "Facet", "Filigree",
"Grid",
"Integral", "Ion (Dark)", "Ion (Light)", "Motion",
"Retrospect",
"Semaphore", "Sideline", "Slice (Dark)", "Slice
(Light)", "ViewMaster",
"Whisp")
}
ElseIf($xWordVersion -eq $wdWord2010)
{
$xArray = ("Alphabet", "Annual", "Austere", "Austin",
"Conservative",
"Contrast", "Cubicles", "Exposure", "Grid", "Mod",
"Motion", "Newsprint",
"Perspective", "Pinstripes", "Puzzle", "Sideline",
"Stacks", "Tiles", "Transcend")
}
}
'es-' {
If($xWordVersion -eq $wdWord2016)
{
$xArray = ("Austin", "Con bandas", "Cortar (oscuro)",
"Cuadrícula",
"Whisp", "Faceta", "Filigrana", "Integral", "Ion
(claro)",
"Ion (oscuro)", "Línea lateral", "Movimiento",
"Retrospectiva",
"Semáforo", "Slice (luz)", "Vista principal",
"Whisp")
}
ElseIf($xWordVersion -eq $wdWord2013)
{
$xArray = ("Whisp", "Vista principal", "Filigrana",
"Austin",
"Slice (luz)", "Faceta", "Semáforo", "Retrospectiva",
"Cuadrícula",
"Movimiento", "Cortar (oscuro)", "Línea lateral",
"Ion (oscuro)",
"Ion (claro)", "Integral", "Con bandas")
}
ElseIf($xWordVersion -eq $wdWord2010)
{
$xArray = ("Alfabeto", "Anual", "Austero", "Austin",
"Conservador",
"Contraste", "Cuadrícula", "Cubículos", "Exposición",
"Línea lateral",
"Moderno", "Mosaicos", "Movimiento", "Papel
periódico",
"Perspectiva", "Pilas", "Puzzle", "Rayas",
"Sobrepasar")
}
}
'fi-' {
If($xWordVersion -eq $wdWord2016)
{
$xArray = ("Filigraani", "Integraali", "Ioni
(tumma)",
"Ioni (vaalea)", "Opastin", "Pinta", "Retro",
"Sektori (tumma)",
"Sektori (vaalea)", "Vaihtuvavärinen", "ViewMaster",
"Austin",
"Kuiskaus", "Liike", "Ruudukko", "Sivussa")
}
ElseIf($xWordVersion -eq $wdWord2013)
{
$xArray = ("Filigraani", "Integraali", "Ioni
(tumma)",
"Ioni (vaalea)", "Opastin", "Pinta", "Retro",
"Sektori (tumma)",
"Sektori (vaalea)", "Vaihtuvavärinen", "ViewMaster",
"Austin",
"Kiehkura", "Liike", "Ruudukko", "Sivussa")
}
ElseIf($xWordVersion -eq $wdWord2010)
{
$xArray = ("Aakkoset", "Askeettinen", "Austin",
"Kontrasti",
"Laatikot", "Liike", "Liituraita", "Mod", "Osittain
peitossa",
"Palapeli", "Perinteinen", "Perspektiivi", "Pinot",
"Ruudukko",
"Ruudut", "Sanomalehtipaperi", "Sivussa",
"Vuotuinen", "Ylitys")
}
}
'fr-' {
If($xWordVersion -eq $wdWord2013 -or $xWordVersion -eq
$wdWord2016)
{
$xArray = ("À bandes", "Austin", "Facette",
"Filigrane",
"Guide", "Intégrale", "Ion (clair)", "Ion (foncé)",
"Lignes latérales", "Quadrillage", "Rétrospective",
"Secteur (clair)",
"Secteur (foncé)", "Sémaphore", "ViewMaster",
"Whisp")
}
ElseIf($xWordVersion -eq $wdWord2010)
{
$xArray = ("Alphabet", "Annuel", "Austère", "Austin",
'nb-' {
If($xWordVersion -eq $wdWord2013 -or $xWordVersion -eq
$wdWord2016)
{
$xArray = ("Austin", "BevegElse", "Dempet", "Fasett",
"Filigran",
"Integral", "Ion (lys)", "Ion (mørk)", "Retrospekt",
"Rutenett",
"Sektor (lys)", "Sektor (mørk)", "Semafor",
"Sidelinje", "Stripet",
"ViewMaster")
}
ElseIf($xWordVersion -eq $wdWord2010)
{
$xArray = ("Alfabet", "Årlig", "Avistrykk", "Austin",
"Avlukker",
"BevegElse", "Engasjement", "Enkel", "Fliser",
"Konservativ",
"Kontrast", "Mod", "Perspektiv", "Puslespill",
"Rutenett", "Sidelinje",
"Smale striper", "Stabler", "Transcenderende")
}
}
'nl-' {
If($xWordVersion -eq $wdWord2013 -or $xWordVersion -eq
$wdWord2016)
{
$xArray = ("Austin", "Beweging", "Facet",
"Filigraan", "Gestreept",
"Integraal", "Ion (donker)", "Ion (licht)", "Raster",
"Segment (Light)", "Semafoor", "Slice (donker)",
"Spriet",
"Terugblik", "Terzijde", "ViewMaster")
}
ElseIf($xWordVersion -eq $wdWord2010)
{
$xArray = ("Aantrekkelijk", "Alfabet", "Austin",
"Bescheiden",
"Beweging", "Blikvanger", "Contrast", "Eenvoudig",
"Jaarlijks",
"Krantenpapier", "Krijtstreep", "Kubussen", "Mod",
"Perspectief",
"Puzzel", "Raster", "Stapels",
"Tegels", "Terzijde")
}
}
'pt-' {
If($xWordVersion -eq $wdWord2013 -or $xWordVersion -eq
$wdWord2016)
{
$xArray = ("Animação", "Austin", "Em Tiras",
"Exibição Mestra",
"Faceta", "Fatia (Clara)", "Fatia (Escura)",
"Filete", "Filigrana",
"Grade", "Integral", "Íon (Claro)", "Íon (Escuro)",
"Linha Lateral",
"Retrospectiva", "Semáforo")
}
ElseIf($xWordVersion -eq $wdWord2010)
{
$xArray = ("Alfabeto", "Animação", "Anual",
"Austero", "Austin", "Baias",
"Conservador", "Contraste", "Exposição", "Grade",
"Ladrilhos",
"Linha Lateral", "Listras", "Mod", "Papel Jornal",
"Perspectiva", "Pilhas",
"Quebra-cabeça", "Transcend")
}
}
'sv-' {
If($xWordVersion -eq $wdWord2013 -or $xWordVersion -eq
$wdWord2016)
{
$xArray = ("Austin", "Band", "Fasett", "Filigran",
"Integrerad", "Jon (ljust)",
"Jon (mörkt)", "Knippe", "Rutnät", "RörElse", "Sektor
(ljus)", "Sektor (mörk)",
"Semafor", "Sidlinje", "VisaHuvudsida", "Återblick")
}
ElseIf($xWordVersion -eq $wdWord2010)
{
$xArray = ("Alfabetmönster", "Austin", "Enkelt",
"Exponering", "Konservativt",
"Kontrast", "Kritstreck", "Kuber", "Perspektiv",
"Plattor", "Pussel", "Rutnät",
"RörElse", "Sidlinje", "Sobert", "Staplat",
"Tidningspapper", "Årligt",
"Övergående")
}
}
'zh-' {
If($xWordVersion -eq $wdWord2010 -or $xWordVersion -eq
$wdWord2013 -or $xWordVersion -eq $wdWord2016)
{
$xArray = ('奥斯汀', '边线型', '花丝', '怀旧', '积分',
'离子(浅色)', '离子(深色)', '母版型', '平面', '切片(浅色)',
'切片(深色)', '丝状', '网格', '镶边', '信号灯',
'运动型')
}
}
Default {
If($xWordVersion -eq $wdWord2013 -or $xWordVersion
-eq $wdWord2016)
{
$xArray = ("Austin", "Banded", "Facet",
"Filigree", "Grid",
"Integral", "Ion (Dark)", "Ion (Light)",
"Motion", "Retrospect",
"Semaphore", "Sideline", "Slice (Dark)", "Slice
(Light)", "ViewMaster",
"Whisp")
}
ElseIf($xWordVersion -eq $wdWord2010)
{
$xArray = ("Alphabet", "Annual", "Austere",
"Austin", "Conservative",
"Contrast", "Cubicles", "Exposure", "Grid",
"Mod", "Motion", "Newsprint",
"Perspective", "Pinstripes", "Puzzle",
"Sideline", "Stacks", "Tiles", "Transcend")
}
}
}
Function ConvertTo-ScriptBlock
{
#by Jeff Wouters, PowerShell MVP
Param([string]$string)
$ScriptBlock = $executioncontext.invokecommand.NewScriptBlock($string)
Return $ScriptBlock
}
Function SWExclusions
{
# original work by Shaun Ritchie
# performance improvements by Jeff Wouters, PowerShell MVP
# modified by Webster
# modified 3-jan-2014 to add displayversion
# bug found 30-jul-2014 by Sam Jacobs
# this function did not work if the SoftwareExlusions.txt file contained only
one line
$var = ""
$Tmp = '$InstalledApps | Where {'
$Exclusions = Get-Content "$($pwd.path)\SoftwareExclusions.txt" -EA 0
If($? -and $Null -ne $Exclusions)
{
If($Exclusions -is [array])
{
ForEach($Exclusion in $Exclusions)
{
$Tmp += "(`$`_.DisplayName -notlike ""$($Exclusion)"") -and
"
}
$var += $Tmp.Substring(0,($Tmp.Length - 6))
}
Else
{
# added 30-jul-2014 to handle if the file contained only one line
$tmp += "(`$`_.DisplayName -notlike ""$($Exclusions)"")"
$var = $tmp
}
$var += "} | Select-Object DisplayName, DisplayVersion | Sort
DisplayName -unique"
}
return $var
}
Function CheckWordPrereq
{
If((Test-Path REGISTRY::HKEY_CLASSES_ROOT\Word.Application) -eq $False)
{
$ErrorActionPreference = $SaveEAPreference
Write-Host "`n`n`t`tThis script directly outputs to Microsoft Word,
please install Microsoft Word`n`n" -BackgroundColor Black -ForegroundColor Yellow
Exit
}
Function ValidateCompanyName
{
[bool]$xResult = Test-RegistryValue
"HKCU:\Software\Microsoft\Office\Common\UserInfo" "CompanyName"
If($xResult)
{
Return Get-RegistryValue
"HKCU:\Software\Microsoft\Office\Common\UserInfo" "CompanyName"
}
Else
{
$xResult = Test-RegistryValue
"HKCU:\Software\Microsoft\Office\Common\UserInfo" "Company"
If($xResult)
{
Return Get-RegistryValue
"HKCU:\Software\Microsoft\Office\Common\UserInfo" "Company"
}
Else
{
Return ""
}
}
}
Function Set-DocumentProperty {
<#
.SYNOPSIS
Function to set the Title Page document properties in MS Word
.DESCRIPTION
Long description
.PARAMETER Document
Current Document Object
.PARAMETER DocProperty
Parameter description
.PARAMETER Value
Parameter description
.EXAMPLE
Set-DocumentProperty -Document $Script:Doc -DocProperty Title -Value
'MyTitle'
.EXAMPLE
Set-DocumentProperty -Document $Script:Doc -DocProperty Company -Value
'MyCompany'
.EXAMPLE
Set-DocumentProperty -Document $Script:Doc -DocProperty Author -Value 'Jim
Moyle'
.EXAMPLE
Set-DocumentProperty -Document $Script:Doc -DocProperty Subject -Value
'MySubjectTitle'
.NOTES
Function Created by Jim Moyle June 2017
Twitter : @JimMoyle
#>
param (
[object]$Document,
[String]$DocProperty,
[string]$Value
)
try {
$binding = "System.Reflection.BindingFlags" -as [type]
$builtInProperties = $Document.BuiltInDocumentProperties
$property = [System.__ComObject].invokemember("item",
$binding::GetProperty, $null, $BuiltinProperties, $DocProperty)
[System.__ComObject].invokemember("value", $binding::SetProperty, $null,
$property, $Value)
}
catch {
Write-Warning "Failed to set $DocProperty to $Value"
}
}
Function FindWordDocumentEnd
{
#Return focus to main document
$Script:Doc.ActiveWindow.ActivePane.view.SeekView = $wdSeekMainDocument
#move to the end of the current document
$Script:Selection.EndKey($wdStory,$wdMove) | Out-Null
}
Function SetupWord
{
Write-Host "$(Get-Date): Setting up Word" -BackgroundColor Black
-ForegroundColor Yellow
SetWordHashTable $Script:WordCultureCode
[int]$Script:WordVersion = [int]$Script:Word.Version
If($Script:WordVersion -eq $wdWord2016)
{
$Script:WordProduct = "Word 2016"
}
ElseIf($Script:WordVersion -eq $wdWord2013)
{
$Script:WordProduct = "Word 2013"
}
ElseIf($Script:WordVersion -eq $wdWord2010)
{
$Script:WordProduct = "Word 2010"
}
ElseIf($Script:WordVersion -eq $wdWord2007)
{
$ErrorActionPreference = $SaveEAPreference
Write-Error "`n`n`t`tMicrosoft Word 2007 is no longer
supported.`n`n`t`tScript will end.`n`n"
AbortScript
}
Else
{
$ErrorActionPreference = $SaveEAPreference
Write-Error "`n`n`t`tYou are running an untested or unsupported version
of Microsoft Word.`n`n`t`tScript will end.`n`n`t`tPlease send info on your version
of Word to webster@carlwebster.com`n`n"
AbortScript
}
If([String]::IsNullOrEmpty($TmpName))
{
Write-Warning "`n`n`t`tCompany Name is blank so Cover Page will
not show a Company Name."
Write-Warning "`n`t`tCheck
HKCU:\Software\Microsoft\Office\Common\UserInfo for Company or CompanyName value."
Write-Warning "`n`t`tYou may want to use the -CompanyName
parameter if you need a Company Name on the cover page.`n`n"
}
Else
{
$Script:CoName = $TmpName
Write-Host "$(Get-Date): Updated company name to $
($Script:CoName)" -BackgroundColor Black -ForegroundColor Yellow
}
}
'da-' {
If($CoverPage -eq "Sideline")
{
$CoverPage = "Sidelinje"
$CPChanged = $True
}
}
'de-' {
If($CoverPage -eq "Sideline")
{
$CoverPage = "Randlinie"
$CPChanged = $True
}
}
'es-' {
If($CoverPage -eq "Sideline")
{
$CoverPage = "Línea lateral"
$CPChanged = $True
}
}
'fi-' {
If($CoverPage -eq "Sideline")
{
$CoverPage = "Sivussa"
$CPChanged = $True
}
}
'fr-' {
If($CoverPage -eq "Sideline")
{
If($Script:WordVersion -eq $wdWord2013 -or
$Script:WordVersion -eq $wdWord2016)
{
$CoverPage = "Lignes latérales"
$CPChanged = $True
}
Else
{
$CoverPage = "Ligne latérale"
$CPChanged = $True
}
}
}
'nb-' {
If($CoverPage -eq "Sideline")
{
$CoverPage = "Sidelinje"
$CPChanged = $True
}
}
'nl-' {
If($CoverPage -eq "Sideline")
{
$CoverPage = "Terzijde"
$CPChanged = $True
}
}
'pt-' {
If($CoverPage -eq "Sideline")
{
$CoverPage = "Linha Lateral"
$CPChanged = $True
}
}
'sv-' {
If($CoverPage -eq "Sideline")
{
$CoverPage = "Sidlinje"
$CPChanged = $True
}
}
'zh-' {
If($CoverPage -eq "Sideline")
{
$CoverPage = "边线型"
$CPChanged = $True
}
}
}
If($CPChanged)
{
Write-Host "$(Get-Date): Changed Default Cover Page from Sideline
to $($CoverPage)" -BackgroundColor Black -ForegroundColor Yellow
}
}
If(!$ValidCP)
{
$ErrorActionPreference = $SaveEAPreference
Write-Host "$(Get-Date): Word language value $
($Script:WordLanguageValue)" -BackgroundColor Black -ForegroundColor Yellow
Write-Host "$(Get-Date): Culture code $($Script:WordCultureCode)"
-BackgroundColor Black -ForegroundColor Yellow
Write-Error "`n`n`t`tFor $($Script:WordProduct), $($CoverPage) is not a
valid Cover Page option.`n`n`t`tScript cannot continue.`n`n"
AbortScript
}
ShowScriptOptions
$Script:Word.Visible = $False
#http://jdhitsolutions.com/blog/2012/05/san-diego-2012-powershell-deep-dive-
slides-and-demos/
#using Jeff's Demo-WordReport.ps1 file for examples
Write-Host "$(Get-Date): Load Word Templates" -BackgroundColor Black
-ForegroundColor Yellow
[bool]$Script:CoverPagesExist = $False
[bool]$BuildingBlocksExist = $False
$Script:Word.Templates.LoadBuildingBlocks()
#word 2010/2013/2016
$BuildingBlocksCollection = $Script:Word.Templates | Where-Object{$_.name -eq
"Built-In Building Blocks.dotx"}
$BuildingBlocksCollection |
ForEach-Object {
If ($_.BuildingBlockEntries.Item($CoverPage).Name -eq $CoverPage)
{
$BuildingBlocks = $_
}
}
Try
{
$part = $BuildingBlocks.BuildingBlockEntries.Item($CoverPage)
}
Catch
{
$part = $Null
}
If($Null -ne $part)
{
$Script:CoverPagesExist = $True
}
}
If(!$Script:CoverPagesExist)
{
Write-Host "$(Get-Date): Cover Pages are not installed or the Cover
Page $($CoverPage) does not exist." -BackgroundColor Black -ForegroundColor Yellow
Write-Warning "Cover Pages are not installed or the Cover Page $
($CoverPage) does not exist."
Write-Warning "This report will not have a Cover Page."
}
$Script:Selection = $Script:Word.Selection
If($Null -eq $Script:Selection)
{
Write-Host "$(Get-Date): " -BackgroundColor Black -ForegroundColor
Yellow
$ErrorActionPreference = $SaveEAPreference
Write-Error "`n`n`t`tAn unknown error happened selecting the entire
Word document for default formatting options.`n`n`t`tScript cannot continue.`n`n"
AbortScript
}
#set Default tab stops to 1/2 inch (this line is not from Jeff Hicks)
#36 = .50"
$Script:Word.ActiveDocument.DefaultTabStop = 36
#Disable Spell and Grammar Check to resolve issue and improve performance
(from Pat Coughlin)
Write-Host "$(Get-Date): Disable grammar and spell checking" -BackgroundColor
Black -ForegroundColor Yellow
#bug reported 1-Apr-2014 by Tim Mangan
#save current options first before turning them off
$Script:CurrentGrammarOption = $Script:Word.Options.CheckGrammarAsYouType
$Script:CurrentSpellingOption = $Script:Word.Options.CheckSpellingAsYouType
$Script:Word.Options.CheckGrammarAsYouType = $False
$Script:Word.Options.CheckSpellingAsYouType = $False
If($BuildingBlocksExist)
{
#insert new page, getting ready for table of contents
Write-Host "$(Get-Date): Insert new page, getting ready for table of
contents" -BackgroundColor Black -ForegroundColor Yellow
$part.Insert($Script:Selection.Range,$True) | Out-Null
$Script:Selection.InsertNewPage()
#table of contents
Write-Host "$(Get-Date): Table of Contents - $
($Script:MyHash.Word_TableOfContents)" -BackgroundColor Black -ForegroundColor
Yellow
$toc =
$BuildingBlocks.BuildingBlockEntries.Item($Script:MyHash.Word_TableOfContents)
If($Null -eq $toc)
{
Write-Host "$(Get-Date): " -BackgroundColor Black
-ForegroundColor Yellow
Write-Host "$(Get-Date): Table of Content - $
($Script:MyHash.Word_TableOfContents) could not be retrieved." -BackgroundColor
Black -ForegroundColor Yellow
Write-Warning "This report will not have a Table of Contents."
}
Else
{
$toc.insert($Script:Selection.Range,$True) | Out-Null
}
}
Else
{
Write-Host "$(Get-Date): Table of Contents are not installed."
-BackgroundColor Black -ForegroundColor Yellow
Write-Warning "Table of Contents are not installed so this report will
not have a Table of Contents."
}
FindWordDocumentEnd
Write-Host "$(Get-Date):" -BackgroundColor Black -ForegroundColor Yellow
#end of Jeff Hicks
}
Function UpdateDocumentProperties
{
Param([string]$AbstractTitle, [string]$SubjectTitle)
#updated 8-Jun-2017 with additional cover page fields
#Update document properties
If($MSWORD -or $PDF)
{
If($Script:CoverPagesExist)
{
Write-Host "$(Get-Date): Set Cover Page Properties"
-BackgroundColor Black -ForegroundColor Yellow
#8-Jun-2017 put these 4 items in alpha order
Set-DocumentProperty -Document $Script:Doc -DocProperty Author -Value
$UserName
Set-DocumentProperty -Document $Script:Doc -DocProperty Company -Value
$Script:CoName
Set-DocumentProperty -Document $Script:Doc -DocProperty Subject -Value
$SubjectTitle
Set-DocumentProperty -Document $Script:Doc -DocProperty Title -Value
$Script:title
#added 8-Jun-2017
$ab = $cp.documentelement.ChildNodes | Where-Object{$_.basename
-eq "CompanyAddress"}
#set the text
[string]$abstract = $CompanyAddress
$ab.Text = $abstract
#added 8-Jun-2017
$ab = $cp.documentelement.ChildNodes | Where-Object{$_.basename
-eq "CompanyEmail"}
#set the text
[string]$abstract = $CompanyEmail
$ab.Text = $abstract
#added 8-Jun-2017
$ab = $cp.documentelement.ChildNodes | Where-Object{$_.basename
-eq "CompanyFax"}
#set the text
[string]$abstract = $CompanyFax
$ab.Text = $abstract
#added 8-Jun-2017
$ab = $cp.documentelement.ChildNodes | Where-Object{$_.basename
-eq "CompanyPhone"}
#set the text
[string]$abstract = $CompanyPhone
$ab.Text = $abstract
Function Get-RegKeyToObject
{
#function contributed by Andrew Williamson @ Fujitsu Services
param([string]$RegPath,
[string]$RegKey,
[string]$ComputerName)
Function WriteWordLine
#Function created by Ryan Revord
#@rsrevord on Twitter
#Function created to make output to Word easy in this script
#updated 27-Mar-2014 to include font name, font size, italics and bold options
{
Param([int]$style=0,
[int]$tabs = 0,
[string]$name = '',
[string]$value = '',
[string]$fontName=$Null,
[int]$fontSize=0,
[bool]$italics=$False,
[bool]$boldface=$False,
[Switch]$nonewline)
If(![String]::IsNullOrEmpty($fontName))
{
$Script:Selection.Font.name = $fontName
}
If($fontSize -ne 0)
{
$Script:Selection.Font.size = $fontSize
}
#**********************************************************************************
*************************
# WriteHTMLLine
#**********************************************************************************
*************************
<#
.Synopsis
Writes a line of output for HTML output
.DESCRIPTION
This function formats an HTML line
.USAGE
WriteHTMLLine <Style> <Tabs> <Name> <Value> <Font Name> <Font Size> <Options>
0 for Font Size denotes using the default font size of 2 or 10 point
.EXAMPLE
WriteHTMLLine 0 0 " "
Writes a blank line with no style or tab stops, obviously none needed.
.EXAMPLE
WriteHTMLLine 0 1 "This is a regular line of text indented 1 tab stops"
.EXAMPLE
WriteHTMLLine 0 0 "This is a regular line of text in the default font in
italics" "" $Null 0 $htmlitalics
Writes a line omitting font and font size and setting the italics attribute
.EXAMPLE
WriteHTMLLine 0 0 "This is a regular line of text in the default font in
bold" "" $Null 0 $htmlbold
Writes a line omitting font and font size and setting the bold attribute
.EXAMPLE
WriteHTMLLine 0 0 "This is a regular line of text in the default font in bold
italics" "" $Null 0 ($htmlbold -bor $htmlitalics)
Writes a line omitting font and font size and setting both italics and bold
options
.EXAMPLE
WriteHTMLLine 0 0 "This is a regular line of text in the default font in 10
point" "" $Null 2 # 10 point font
.EXAMPLE
WriteHTMLLine 0 0 "This is a regular line of text in Courier New font" ""
"Courier New" 0
Writes a line using Courier New Font and 0 font point size (default = 2 if
set to 0)
.EXAMPLE
WriteHTMLLine 0 0 "This is a regular line of RED text indented 0 tab stops
with the computer name as data in 10 point Courier New bold italics: "
$env:computername "Courier New" 2 ($htmlbold -bor $htmlred -bor $htmlitalics)
Writes a line using Courier New Font with first and second string values to
be used, also uses 10 point font with bold, italics and red color options set.
.NOTES
Font Size - Unlike word, there is a limited set of font sizes that can be
used in HTML. They are:
0 - default which actually gives it a 2 or 10 point.
1 - 7.5 point font size
2 - 10 point
3 - 13.5 point
4 - 15 point
5 - 18 point
6 - 24 point
7 - 36 point
Any number larger than 7 defaults to 7
Style - Refers to the headers that are used with output and resemble the
headers in word, HTML supports headers h1-h6 and h1-h4 are more commonly used.
Unlike word, H1 will not give you
a blue colored font, you will have to set that yourself.
htmlbold
htmlitalics
htmlred
htmlcyan
htmlblue
htmldarkblue
htmllightblue
htmlpurple
htmlyellow
htmllime
htmlmagenta
htmlwhite
htmlsilver
htmlgray
htmlolive
htmlorange
htmlmaroon
htmlgreen
htmlblack
#>
Function WriteHTMLLine
#Function created by Ken Avram
#Function created to make output to HTML easy in this script
#headings fixed 12-Oct-2016 by Webster
#errors with $HTMLStyle fixed 7-Dec-2017 by Webster
{
Param([int]$style=0,
[int]$tabs = 0,
[string]$name = '',
[string]$value = '',
[string]$fontName="Calibri",
[int]$fontSize=1,
[int]$options=$htmlblack)
If([String]::IsNullOrEmpty($Name))
{
$HTMLBody = "<p></p>"
}
Else
{
$color = CheckHTMLColor $options
#build # of tabs
While($tabs -gt 0)
{
$output += " "; $tabs--;
}
$HTMLFontName = $fontName
$HTMLBody = ""
Switch ($style)
{
1 {$HTMLStyle = "<h1>"; Break}
2 {$HTMLStyle = "<h2>"; Break}
3 {$HTMLStyle = "<h3>"; Break}
4 {$HTMLStyle = "<h4>"; Break}
Default {$HTMLStyle = ""; Break}
}
Switch ($style)
{
1 {$HTMLStyle = "</h1>"; Break}
2 {$HTMLStyle = "</h2>"; Break}
3 {$HTMLStyle = "</h3>"; Break}
4 {$HTMLStyle = "</h4>"; Break}
Default {$HTMLStyle = ""; Break}
}
If($fixedInfo.Length -eq 0)
{
$htmlbody += "<td style=""background-color:$($tmp)""><font
face='$($fontName)' size='$($fontSize)'>"
}
Else
{
$htmlbody += "<td style=""width:$
($fixedInfo[$columnIndex/2]); background-color:$($tmp)""><font face='$($fontName)'
size='$($fontSize)'>"
}
#**********************************************************************************
*************************
# FormatHTMLTable
# Created by Ken Avram
# modified by Jake Rutski
#**********************************************************************************
*************************
<#
.Synopsis
Format table for HTML output document
.DESCRIPTION
This function formats a table for HTML from an array of strings
.PARAMETER noBorder
If set to $true, a table will be generated without a border (border='0')
.PARAMETER noHeadCols
This parameter should be used when generating tables without column headers
Set this parameter equal to the number of columns in the table
.PARAMETER rowArray
This parameter contains the row data array for the table
.PARAMETER columnArray
This parameter contains column header data for the table
.PARAMETER fixedWidth
This parameter contains widths for columns in pixel format ("100px") to
override auto column widths
The variable should contain a width for each column you wish to override the
auto-size setting
For example: $columnWidths = @("100px","110px","120px","130px","140px")
.USAGE
FormatHTMLTable <Table Header> <Table Format> <Font Name> <Font Size>
.EXAMPLE
FormatHTMLTable "Table Heading" "auto" "Calibri" 3
This example formats a table and writes it out into an html file. All of the
parameters are optional
defaults are used if not supplied.
for <Table format>, the default is auto which will autofit the text into the
columns and adjust to the longest text in that column. You can also use percentage
i.e. 25%
which will take only 25% of the line and will auto word wrap the text to the
next line in the column. Also, instead of using a percentage, you can use pixels
i.e. 400px.
This example creates an HTML table with a heading of 'Table Heading', auto
column spacing, column header data from $columnData and row data from $rowData
This example creates an HTML table with a heading of 'Table Heading', auto
column spacing, no header, and row data from $rowData
.NOTES
In order to use the formatted table it first has to be loaded with data.
Examples below will show how to load the table:
First, initialize the table array
$rowdata = @()
Then Load the array. If you are using column headers then load those into
the column headers array, otherwise the first line of the table goes into the
column headers array
and the second and subsequent lines go into the $rowdata table as shown
below:
The first column is the actual name to display, the second are the attributes
of the column i.e. color anded with bold or italics. For the anding, parens are
required or it will
not format correctly.
$rowdata = @()
$columnHeaders = @("User Name",($htmlsilver -bor $htmlbold),$UserName,
$htmlwhite)
$rowdata += @(,('Save as PDF',($htmlsilver -bor $htmlbold),$PDF.ToString(),
$htmlwhite))
$rowdata += @(,('Save as TEXT',($htmlsilver -bor $htmlbold),$TEXT.ToString(),
$htmlwhite))
$rowdata += @(,('Save as WORD',($htmlsilver -bor $htmlbold),
$MSWORD.ToString(),$htmlwhite))
$rowdata += @(,('Save as HTML',($htmlsilver -bor $htmlbold),$HTML.ToString(),
$htmlwhite))
$rowdata += @(,('Add DateTime',($htmlsilver -bor $htmlbold),
$AddDateTime.ToString(),$htmlwhite))
$rowdata += @(,('Hardware Inventory',($htmlsilver -bor $htmlbold),
$Hardware.ToString(),$htmlwhite))
$rowdata += @(,('Computer Name',($htmlsilver -bor $htmlbold),$ComputerName,
$htmlwhite))
$rowdata += @(,('Filename1',($htmlsilver -bor $htmlbold),
$Script:FileName1,$htmlwhite))
$rowdata += @(,('OS Detected',($htmlsilver -bor $htmlbold),$Script:RunningOS,
$htmlwhite))
$rowdata += @(,('PSUICulture',($htmlsilver -bor $htmlbold),$PSCulture,
$htmlwhite))
$rowdata += @(,('PoSH version',($htmlsilver -bor $htmlbold),
$Host.Version.ToString(),$htmlwhite))
FormatHTMLTable "Example of Horizontal AutoFitContents HTML Table" -rowArray
$rowdata
The 'rowArray' paramater is mandatory to build the table, but it is not set
as such in the function - if nothing is passed, the table will be empty.
htmlbold
htmlitalics
htmlred
htmlcyan
htmlblue
htmldarkblue
htmllightblue
htmlpurple
htmlyellow
htmllime
htmlmagenta
htmlwhite
htmlsilver
htmlgray
htmlolive
htmlorange
htmlmaroon
htmlgreen
htmlblack
#>
Function FormatHTMLTable
{
Param([string]$tableheader,
[string]$tablewidth="auto",
[string]$fontName="Calibri",
[int]$fontSize=2,
[switch]$noBorder=$false,
[int]$noHeadCols=1,
[object[]]$rowArray=@(),
[object[]]$fixedWidth=@(),
[object[]]$columnArray=@())
If($columnArray.Length -eq 0)
{
$NumCols = $noHeadCols + 1
} # means we have no column headers, just a table
Else
{
$NumCols = $columnArray.Length
} # need to add one for the color attrib
If($noBorder)
{
$htmlbody += "<table border='0' width='" + $tablewidth + "'>"
}
Else
{
$htmlbody += "<table border='1' width='" + $tablewidth + "'>"
}
If(!($columnArray.Length -eq 0))
{
$htmlbody += "<tr>"
Function SetupHTML
{
Write-Host "$(Get-Date): Setting up HTML" -BackgroundColor Black
-ForegroundColor Yellow
If($AddDateTime)
{
$Script:FileName1 += "_$(Get-Date -f yyyy-MM-dd_HHmm).html"
}
<#
.Synopsis
Add a table to a Microsoft Word document
.DESCRIPTION
This function adds a table to a Microsoft Word document from either an array
of
Hashtables or an array of PSCustomObjects.
Using this function is quicker than setting each table cell individually but
can
only utilise the built-in MS Word table autoformats. Individual tables cells
can
be altered after the table has been appended to the document (a table
reference
is Returned).
.EXAMPLE
AddWordTable -Hashtable $HashtableArray
This example adds table to the MS Word document, utilising all key/value
pairs in
the array of hashtables. Column headers will display the key names as
defined.
Note: the columns might not be displayed in the order that they were defined.
To
ensure columns are displayed in the required order utilise the -Columns
parameter.
.EXAMPLE
AddWordTable -Hashtable $HashtableArray -List
This example adds table to the MS Word document, utilising all key/value
pairs in
the array of hashtables. No column headers will be added, in a ListView
format.
Note: the columns might not be displayed in the order that they were defined.
To
ensure columns are displayed in the required order utilise the -Columns
parameter.
.EXAMPLE
AddWordTable -CustomObject $PSCustomObjectArray
This example adds table to the MS Word document, utilising all note property
names
the array of PSCustomObjects. Column headers will display the note property
names.
Note: the columns might not be displayed in the order that they were defined.
To
ensure columns are displayed in the required order utilise the -Columns
parameter.
.EXAMPLE
AddWordTable -Hashtable $HashtableArray -Columns
FirstName,LastName,EmailAddress
This example adds a table to the MS Word document, but only using the
specified
key names: FirstName, LastName and EmailAddress. If other keys are present in
the
array of Hashtables they will be ignored.
.EXAMPLE
AddWordTable -CustomObject $PSCustomObjectArray -Columns
FirstName,LastName,EmailAddress -Headers "First Name","Last Name","Email Address"
This example adds a table to the MS Word document, but only using the
specified
PSCustomObject note properties: FirstName, LastName and EmailAddress. If
other note
properties are present in the array of PSCustomObjects they will be ignored.
The
display names for each specified column header has been overridden to display
a
custom header. Note: the order of the header names must match the specified
columns.
#>
Function AddWordTable
{
[CmdletBinding()]
Param
(
# Array of Hashtable (including table headers)
[Parameter(Mandatory=$True, ValueFromPipelineByPropertyName=$True,
ParameterSetName='Hashtable', Position=0)]
[ValidateNotNullOrEmpty()] [System.Collections.Hashtable[]] $Hashtable,
# Array of PSCustomObjects
[Parameter(Mandatory=$True, ValueFromPipelineByPropertyName=$True,
ParameterSetName='CustomObject', Position=0)]
[ValidateNotNullOrEmpty()] [PSCustomObject[]] $CustomObject,
# Array of Hashtable key names or PSCustomObject property names to
include, in display order.
# If not supplied then all Hashtable keys or all PSCustomObject
properties will be displayed.
[Parameter(ValueFromPipelineByPropertyName=$True)] [AllowNull()]
[string[]] $Columns = $Null,
# Array of custom table header strings in display order.
[Parameter(ValueFromPipelineByPropertyName=$True)] [AllowNull()]
[string[]] $Headers = $Null,
# AutoFit table behavior.
[Parameter(ValueFromPipelineByPropertyName=$True)] [AllowNull()] [int]
$AutoFit = -1,
# List view (no headers)
[Switch] $List,
# Grid lines
[Switch] $NoGridLines,
[Switch] $NoInternalGridLines,
# Built-in Word table formatting style constant
# Would recommend only $wdTableFormatContempory for normal usage
(possibly $wdTableFormatList5 for List view)
[Parameter(ValueFromPipelineByPropertyName=$True)] [int] $Format = 0
)
Begin
{
Write-Debug ("Using parameter set '{0}'" -f
$PSCmdlet.ParameterSetName);
## Check if -Columns wasn't specified but -Headers were (saves some
additional parameter sets!)
If(($Null -eq $Columns) -and ($Null -eq $Headers))
{
Write-Warning "No columns specified and therefore, specified
headers will be ignored.";
$Columns = $Null;
}
ElseIf(($Null -ne $Columns) -and ($Null -ne $Headers))
{
## Check if number of specified -Columns matches number of
specified -Headers
If($Columns.Length -ne $Headers.Length)
{
Write-Error "The specified number of columns does not match
the specified number of headers.";
}
} ## end elseif
} ## end Begin
Process
{
## Build the Word table data string to be converted to a range and then
a table later.
[System.Text.StringBuilder] $WordRangeString = New-Object
System.Text.StringBuilder;
Switch ($PSCmdlet.ParameterSetName)
{
'CustomObject'
{
If($Null -eq $Columns)
{
## Build the available columns from all availble
PSCustomObject note properties
[string[]] $Columns = @();
## Add each NoteProperty name to the array
ForEach($Property in ($CustomObject | Get-Member
-MemberType NoteProperty))
{
$Columns += $Property.Name;
}
}
Default
{ ## Hashtable
If($Null -eq $Columns)
{
## Build the available columns from all available
hashtable keys. Hopefully
## all Hashtables have the same keys (they should for
a table).
$Columns = $Hashtable[0].Keys;
}
If(!$List)
{
#the next line causes the heading row to flow across page breaks
$WordTable.Rows.First.Headingformat = $wdHeadingFormatTrue;
}
If(!$NoGridLines)
{
$WordTable.Borders.InsideLineStyle = $wdLineStyleSingle;
$WordTable.Borders.OutsideLineStyle = $wdLineStyleSingle;
}
If($NoGridLines)
{
$WordTable.Borders.InsideLineStyle = $wdLineStyleNone;
$WordTable.Borders.OutsideLineStyle = $wdLineStyleNone;
}
If($NoInternalGridLines)
{
$WordTable.Borders.InsideLineStyle = $wdLineStyleNone;
$WordTable.Borders.OutsideLineStyle = $wdLineStyleSingle;
}
Return $WordTable;
} ## end Process
}
<#
.Synopsis
Sets the format of one or more Word table cells
.DESCRIPTION
This function sets the format of one or more table cells, either from a
collection
of Word COM object cell references, an individual Word COM object cell
reference or
a hashtable containing Row and Column information.
The font name, font size, bold, italic , underline and shading values can be
used.
.EXAMPLE
SetWordCellFormat -Hashtable $Coordinates -Table $TableReference -Bold
This example sets all text to bold that is contained within the
$TableReference
Word table, using an array of hashtables. Each hashtable contain a pair of
co-
ordinates that is used to select the required cells. Note: the hashtable must
contain the .Row and .Column key names. For example:
@ { Row = 7; Column = 3 } to set the cell at row 7 and column 3 to bold.
.EXAMPLE
$RowCollection = $Table.Rows.First.Cells
SetWordCellFormat -Collection $RowCollection -Bold -Size 10
This example sets all text to size 8 and bold for all cells that are
contained
within the first row of the table.
Note: the $Table.Rows.First.Cells Returns a collection of Word COM cells
objects
that are in the first table row.
.EXAMPLE
$ColumnCollection = $Table.Columns.Item(2).Cells
SetWordCellFormat -Collection $ColumnCollection -BackgroundColor 255
This example sets the background (shading) of all cells in the table's second
column to red.
Note: the $Table.Columns.Item(2).Cells Returns a collection of Word COM cells
objects
that are in the table's second column.
.EXAMPLE
SetWordCellFormat -Cell $Table.Cell(17,3) -Font "Tahoma" -Color 16711680
This example sets the font to Tahoma and the text color to blue for the cell
located
in the table's 17th row and 3rd column.
Note: the $Table.Cell(17,3) Returns a single Word COM cells object.
#>
Function SetWordCellFormat
{
[CmdletBinding(DefaultParameterSetName='Collection')]
Param (
# Word COM object cell collection reference
[Parameter(Mandatory=$True, ValueFromPipeline=$True,
ParameterSetName='Collection', Position=0)] [ValidateNotNullOrEmpty()] $Collection,
# Word COM object individual cell reference
[Parameter(Mandatory=$True, ParameterSetName='Cell', Position=0)]
[ValidateNotNullOrEmpty()] $Cell,
# Hashtable of cell co-ordinates
[Parameter(Mandatory=$True, ParameterSetName='Hashtable', Position=0)]
[ValidateNotNullOrEmpty()] [System.Collections.Hashtable[]] $Coordinates,
# Word COM object table reference
[Parameter(Mandatory=$True, ParameterSetName='Hashtable', Position=1)]
[ValidateNotNullOrEmpty()] $Table,
# Font name
[Parameter()] [AllowNull()] [string] $Font = $Null,
# Font color
[Parameter()] [AllowNull()] $Color = $Null,
# Font size
[Parameter()] [ValidateNotNullOrEmpty()] [int] $Size = 0,
# Cell background color
[Parameter()] [AllowNull()] $BackgroundColor = $Null,
# Force solid background color
[Switch] $Solid,
[Switch] $Bold,
[Switch] $Italic,
[Switch] $Underline
)
Begin
{
Write-Debug ("Using parameter set '{0}'." -f
$PSCmdlet.ParameterSetName);
}
Process
{
Switch ($PSCmdlet.ParameterSetName)
{
'Collection' {
ForEach($Cell in $Collection)
{
If($Null -ne $BackgroundColor)
{ $Cell.Shading.BackgroundPatternColor = $BackgroundColor; }
If($Bold) { $Cell.Range.Font.Bold = $True; }
If($Italic) { $Cell.Range.Font.Italic = $True; }
If($Underline) { $Cell.Range.Font.Underline = 1; }
If($Null -ne $Font) { $Cell.Range.Font.Name =
$Font; }
If($Null -ne $Color) { $Cell.Range.Font.Color =
$Color; }
If($Size -ne 0) { $Cell.Range.Font.Size = $Size; }
If($Solid) { $Cell.Shading.Texture = 0; } ##
wdTextureNone
} # end ForEach
} # end Collection
'Cell'
{
If($Bold) { $Cell.Range.Font.Bold = $True; }
If($Italic) { $Cell.Range.Font.Italic = $True; }
If($Underline) { $Cell.Range.Font.Underline = 1; }
If($Null -ne $Font) { $Cell.Range.Font.Name = $Font; }
If($Null -ne $Color) { $Cell.Range.Font.Color = $Color; }
If($Size -ne 0) { $Cell.Range.Font.Size = $Size; }
If($Null -ne $BackgroundColor)
{ $Cell.Shading.BackgroundPatternColor = $BackgroundColor; }
If($Solid) { $Cell.Shading.Texture = 0; } ## wdTextureNone
} # end Cell
'Hashtable'
{
ForEach($Coordinate in $Coordinates)
{
$Cell = $Table.Cell($Coordinate.Row,
$Coordinate.Column);
If($Bold) { $Cell.Range.Font.Bold = $True; }
If($Italic) { $Cell.Range.Font.Italic = $True; }
If($Underline) { $Cell.Range.Font.Underline = 1; }
If($Null -ne $Font) { $Cell.Range.Font.Name =
$Font; }
If($Null -ne $Color) { $Cell.Range.Font.Color =
$Color; }
If($Size -ne 0) { $Cell.Range.Font.Size = $Size; }
If($Null -ne $BackgroundColor)
{ $Cell.Shading.BackgroundPatternColor = $BackgroundColor; }
If($Solid) { $Cell.Shading.Texture = 0; } ##
wdTextureNone
}
} # end Hashtable
} # end switch
} # end process
}
<#
.Synopsis
Sets alternate row colors in a Word table
.DESCRIPTION
This function sets the format of alternate rows within a Word table using the
specified $BackgroundColor. This function is expensive (in performance terms)
as
it recursively sets the format on alternate rows. It would be better to pick
one
of the predefined table formats (if one exists)? Obviously the more rows, the
longer it takes :'(
This example sets every-other table (starting with the first) row and sets
the
background color to red (wdColorRed).
.EXAMPLE
SetWordTableAlternateRowColor -Table $TableReference -BackgroundColor 39423
-Seed Second
This example sets every other table (starting with the second) row and sets
the
background color to light orange (weColorLightOrange).
#>
Function SetWordTableAlternateRowColor
{
[CmdletBinding()]
Param (
# Word COM object table reference
[Parameter(Mandatory=$True, ValueFromPipeline=$True, Position=0)]
[ValidateNotNullOrEmpty()] $Table,
# Alternate row background color
[Parameter(Mandatory=$True, Position=1)] [ValidateNotNull()] [int]
$BackgroundColor,
# Alternate row starting seed
[Parameter(ValueFromPipelineByPropertyName=$True, Position=2)]
[ValidateSet('First','Second')] [string] $Seed = 'First'
)
Process
{
$StartDateTime = Get-Date;
Write-Debug ("{0}: `t`tSetting alternate table row colors.." -f
$StartDateTime);
## Determine the row seed (only really need to check for 'Second' and
default to 'First' otherwise
If($Seed.ToLower() -eq 'second')
{
$StartRowIndex = 2;
}
Else
{
$StartRowIndex = 1;
}
$Table.Rows.Item($AlternateRowIndex).Shading.BackgroundPatternColor =
$BackgroundColor;
}
## I've put verbose calls in here we can see how expensive this
functionality actually is.
$EndDateTime = Get-Date;
$ExecutionTime = New-TimeSpan -Start $StartDateTime -End $EndDateTime;
Write-Debug ("{0}: `t`tDone setting alternate row style color in '{1}'
seconds" -f $EndDateTime, $ExecutionTime.TotalSeconds);
}
}
#endregion
{
Param([parameter(Mandatory = $True)][alias("Module")][string]$ModuleName)
#$LoadedModules = Get-Module | Select-Object Name
#following line changed at the recommendation of @andyjmorgan
$LoadedModules = Get-Module | ForEach-Object { $_.Name.ToString() }
#bug reported on 21-JAN-2013 by @schose
#the following line did not work if the citrix.grouppolicy.commands.psm1
module
#was manually loaded from a non Default folder
#$ModuleFound = (!$LoadedModules -like "*$ModuleName*")
Function SaveandCloseDocumentandShutdownWord
{
#bug fix 1-Apr-2014
#reset Grammar and Spelling options back to their original settings
$Script:Word.Options.CheckGrammarAsYouType = $Script:CurrentGrammarOption
$Script:Word.Options.CheckSpellingAsYouType = $Script:CurrentSpellingOption
Function SaveandCloseTextDocument
{
If($AddDateTime)
{
$Script:FileName1 += "_$(Get-Date -f yyyy-MM-dd_HHmm).txt"
}
Function SaveandCloseHTMLDocument
{
Out-File -FilePath $Script:FileName1 -Append -InputObject
"<p></p></body></html>"
}
Function SetFileName1andFileName2
{
Param([string]$OutputFileName)
If($pwdpath.EndsWith("\"))
{
#remove the trailing \
$pwdpath = $pwdpath.SubString(0, ($pwdpath.Length - 1))
}
If(!$AddDateTime)
{
[string]$Script:FileName1 = "$($pwdpath)\$($OutputFileName).docx"
If($PDF)
{
[string]$Script:FileName2 = "$($pwdpath)\$
($OutputFileName).pdf"
}
}
SetupWord
}
ElseIf($Text)
{
If(!$AddDateTime)
{
[string]$Script:FileName1 = "$($pwdpath)\$($OutputFileName).txt"
}
ShowScriptOptions
}
ElseIf($HTML)
{
If(!$AddDateTime)
{
[string]$Script:FileName1 = "$($pwdpath)\$($OutputFileName).html"
}
SetupHTML
ShowScriptOptions
}
}
Function ProcessDocumentOutput
{
If($MSWORD -or $PDF)
{
SaveandCloseDocumentandShutdownWord
}
ElseIf($Text)
{
SaveandCloseTextDocument
}
ElseIf($HTML)
{
SaveandCloseHTMLDocument
}
$GotFile = $False
If($PDF)
{
If(Test-Path "$($Script:FileName2)")
{
Write-Host "$(Get-Date): $($Script:FileName2) is ready for use"
-BackgroundColor Black -ForegroundColor Yellow
$GotFile = $True
}
Else
{
Write-Warning "$(Get-Date): Unable to save the output file, $
($Script:FileName2)"
Write-Error "Unable to save the output file, $
($Script:FileName2)"
}
}
Else
{
If(Test-Path "$($Script:FileName1)")
{
Write-Host "$(Get-Date): $($Script:FileName1) is ready for use"
-BackgroundColor Black -ForegroundColor Yellow
$GotFile = $True
}
Else
{
Write-Warning "$(Get-Date): Unable to save the output file, $
($Script:FileName1)"
Write-Error "Unable to save the output file, $
($Script:FileName1)"
}
}
}
Function ShowScriptOptions
{
Write-Host "$(Get-Date): " -BackgroundColor Black -ForegroundColor Yellow
Write-Host "$(Get-Date): " -BackgroundColor Black -ForegroundColor Yellow
Write-Host "$(Get-Date): Add DateTime : $($AddDateTime)"
-BackgroundColor Black -ForegroundColor Yellow
Write-Host "$(Get-Date): AdminAddress : $($AdminAddress)"
-BackgroundColor Black -ForegroundColor Yellow
Write-Host "$(Get-Date): Administrators : $($Administrators)"
-BackgroundColor Black -ForegroundColor Yellow
Write-Host "$(Get-Date): Applications : $($Applications)"
-BackgroundColor Black -ForegroundColor Yellow
Write-Host "$(Get-Date): Company Name : $($Script:CoName)"
-BackgroundColor Black -ForegroundColor Yellow
Write-Host "$(Get-Date): Company Address : $($CompanyAddress)"
-BackgroundColor Black -ForegroundColor Yellow
Write-Host "$(Get-Date): Company Email : $($CompanyEmail)"
-BackgroundColor Black -ForegroundColor Yellow
Write-Host "$(Get-Date): Company Fax : $($CompanyFax)"
-BackgroundColor Black -ForegroundColor Yellow
Write-Host "$(Get-Date): Company Phone : $($CompanyPhone)"
-BackgroundColor Black -ForegroundColor Yellow
Write-Host "$(Get-Date): Cover Page : $($CoverPage)" -BackgroundColor
Black -ForegroundColor Yellow
If($Dev)
{
Write-Host "$(Get-Date): DevErrorFile : $($Script:DevErrorFile)"
-BackgroundColor Black -ForegroundColor Yellow
}
Write-Host "$(Get-Date): Farm name : $($Script:FarmName)"
-BackgroundColor Black -ForegroundColor Yellow
Write-Host "$(Get-Date): Filename1 : $($Script:filename1)"
-BackgroundColor Black -ForegroundColor Yellow
If($PDF)
{
Write-Host "$(Get-Date): Filename2 : $($Script:Filename2)"
-BackgroundColor Black -ForegroundColor Yellow
}
Write-Host "$(Get-Date): Folder : $($Folder)" -BackgroundColor
Black -ForegroundColor Yellow
Write-Host "$(Get-Date): HW Inventory : $($Hardware)" -BackgroundColor
Black -ForegroundColor Yellow
Write-Host "$(Get-Date): Log : $($Log)" -BackgroundColor Black
-ForegroundColor Yellow
Write-Host "$(Get-Date): Logging : $($Logging)" -BackgroundColor
Black -ForegroundColor Yellow
If($Logging)
{
Write-Host "$(Get-Date): Start Date : $($StartDate)"
-BackgroundColor Black -ForegroundColor Yellow
Write-Host "$(Get-Date): End Date : $($EndDate)"
-BackgroundColor Black -ForegroundColor Yellow
}
Write-Host "$(Get-Date): MaxDetail : $($MaxDetails)"
-BackgroundColor Black -ForegroundColor Yellow
Write-Host "$(Get-Date): NoADPolicies : $($NoADPolicies)"
-BackgroundColor Black -ForegroundColor Yellow
Write-Host "$(Get-Date): NoPolicies : $($NoPolicies)"
-BackgroundColor Black -ForegroundColor Yellow
Write-Host "$(Get-Date): Policies : $($Policies)" -BackgroundColor
Black -ForegroundColor Yellow
Write-Host "$(Get-Date): Save As PDF : $($PDF)" -BackgroundColor Black
-ForegroundColor Yellow
Write-Host "$(Get-Date): Save As HTML : $($HTML)" -BackgroundColor
Black -ForegroundColor Yellow
Write-Host "$(Get-Date): Save As TEXT : $($TEXT)" -BackgroundColor
Black -ForegroundColor Yellow
Write-Host "$(Get-Date): Save As WORD : $($MSWORD)" -BackgroundColor
Black -ForegroundColor Yellow
Write-Host "$(Get-Date): ScriptInfo : $($ScriptInfo)"
-BackgroundColor Black -ForegroundColor Yellow
Write-Host "$(Get-Date): Section : $($Section)" -BackgroundColor
Black -ForegroundColor Yellow
Write-Host "$(Get-Date): Summary : $($Summary)" -BackgroundColor
Black -ForegroundColor Yellow
Write-Host "$(Get-Date): Title : $($Script:Title)"
-BackgroundColor Black -ForegroundColor Yellow
Write-Host "$(Get-Date): User Name : $($UserName)" -BackgroundColor
Black -ForegroundColor Yellow
Write-Host "$(Get-Date): " -BackgroundColor Black -ForegroundColor Yellow
Write-Host "$(Get-Date): OS Detected : $($Script:RunningOS)"
-BackgroundColor Black -ForegroundColor Yellow
Write-Host "$(Get-Date): PoSH version : $($Host.Version)"
-BackgroundColor Black -ForegroundColor Yellow
Write-Host "$(Get-Date): PSCulture : $($PSCulture)" -BackgroundColor
Black -ForegroundColor Yellow
Write-Host "$(Get-Date): PSUICulture : $($PSUICulture)"
-BackgroundColor Black -ForegroundColor Yellow
If($MSWORD -or $PDF)
{
Write-Host "$(Get-Date): Word language : $
($Script:WordLanguageValue)" -BackgroundColor Black -ForegroundColor Yellow
Write-Host "$(Get-Date): Word version : $($Script:WordProduct)"
-BackgroundColor Black -ForegroundColor Yellow
}
Write-Host "$(Get-Date): " -BackgroundColor Black -ForegroundColor Yellow
Write-Host "$(Get-Date): Script start : $($Script:StartTime)"
-BackgroundColor Black -ForegroundColor Yellow
Write-Host "$(Get-Date): " -BackgroundColor Black -ForegroundColor Yellow
Write-Host "$(Get-Date): " -BackgroundColor Black -ForegroundColor Yellow
}
Function AbortScript
{
If($MSWord -or $PDF)
{
$Script:Word.quit()
Write-Host "$(Get-Date): System Cleanup" -BackgroundColor Black
-ForegroundColor Yellow
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($Script:Word) |
Out-Null
If(Test-Path variable:global:word)
{
Remove-Variable -Name word -Scope Global
}
}
[gc]::collect()
[gc]::WaitForPendingFinalizers()
Write-Host "$(Get-Date): Script has been aborted" -BackgroundColor Black
-ForegroundColor Yellow
$ErrorActionPreference = $SaveEAPreference
Exit
}
Function OutputWarning
{
Param([string] $txt)
Write-Warning $txt
If($MSWord -or $PDF)
{
WriteWordLine 0 1 $txt
WriteWordLIne 0 0 ""
}
ElseIf($Text)
{
Line 1 $txt
Line 0 ""
}
ElseIf($HTML)
{
WriteHTMLLine 0 1 $txt
WriteHTMLLine 0 0 " "
}
}
Function TranscriptLogging
{
If($Log)
{
try
{
If($Script:StartLog -eq $false)
{
Start-Transcript -Path $Script:LogPath -Force -Verbose:
$false | Out-Null
}
Else
{
Start-Transcript -Path $Script:LogPath -Append -Verbose:
$false | Out-Null
}
Write-Host "$(Get-Date): Transcript/log started at
$Script:LogPath" -BackgroundColor Black -ForegroundColor Yellow
$Script:StartLog = $true
}
catch
{
Write-Host "$(Get-Date): Transcript/log failed at
$Script:LogPath" -BackgroundColor Black -ForegroundColor Yellow
$Script:StartLog = $false
}
}
}
Function Get-IPAddress
{
Param([string]$ComputerName)
Try
{
$IP = Test-Connection -ComputerName $ComputerName -Count 1 | Select-
Object IPV4Address
}
Catch
{
$IP = $Null
}
Return $IPAddress
}
#endregion
$Script:DoPolicies = $True
If($NoPolicies)
{
Write-Host "$(Get-Date): NoPolicies was specified so do not search for
Citrix.GroupPolicy.Commands.psm1" -BackgroundColor Black -ForegroundColor Yellow
$Script:DoPolicies = $False
}
ElseIf(!(Check-LoadedModule "Citrix.GroupPolicy.Commands") -and $Policies -eq
$False)
{
Write-Warning "The Citrix Group Policy module
Citrix.GroupPolicy.Commands.psm1 could not be loaded `n
Please see the Prerequisites section in the ReadMe file
(https://carlwebster.sharefile.com/d-s8e92231489542428).
`nCitrix Policy documentation will not take place"
Write-Host "$(Get-Date): " -BackgroundColor Black -ForegroundColor
Yellow
$Script:DoPolicies = $False
}
ElseIf(!(Check-LoadedModule "Citrix.GroupPolicy.Commands") -and $Policies -eq
$True)
{
Write-Error "The Citrix Group Policy module
Citrix.GroupPolicy.Commands.psm1 could not be loaded
`nPlease see the Prerequisites section in the ReadMe file
(https://carlwebster.sharefile.com/d-s8e92231489542428).
`n
`n
`t`tBecause the Policies parameter was used the script will now close.
`n
`n"
Write-Host "$(Get-Date): " -BackgroundColor Black -ForegroundColor
Yellow
Exit
}
If($Policies -eq $False -and $NoPolicies -eq $False -and $NoADPolicies -eq
$False)
{
#script defaults, so don't process policies
$Script:DoPolicies = $False
}
If($NoPolicies -eq $True)
{
#don't process policies
$Script:DoPolicies = $False
}
[bool]$Script:Remoting = $False
[string]$Script:RemoteXAServer = ""
If([String]::IsNullOrEmpty($AdminAddress))
{
#see if a remote connection was establish outside of the script
$Script:RemoteXAServer = Get-XADefaultComputerName -EA 0
If(![String]::IsNullOrEmpty($Script:RemoteXAServer))
{
$Script:Remoting = $True
}
}
ElseIf($AdminAddress -ne "LocalHost")
{
#do nothing if $AdminAddress is LocalHost
Set-XADefaultComputerName $AdminAddress -Scope LocalMachine -EA 0
$Script:RemoteXAServer = Get-XADefaultComputerName -EA 0
$Script:Remoting = $True
}
If($Script:Remoting)
{
Write-Host "$(Get-Date): Remoting is enabled to XenApp server
$Script:RemoteXAServer" -BackgroundColor Black -ForegroundColor Yellow
#now need to make sure the script is not being run against a session-
only host
$Server = Get-XAServer -ServerName $Script:RemoteXAServer -EA 0
If($Server.ElectionPreference -eq "WorkerMode")
{
$ErrorActionPreference = $SaveEAPreference
Write-Warning "This script cannot be run remotely against a
Session-only Host Server."
Write-Warning "Use Set-XADefaultComputerName
XA65ControllerServerName or run the script on a controller."
Write-Error "Script cannot continue. See messages above."
Exit
}
}
Else
{
Write-Host "$(Get-Date): Remoting is not being used" -BackgroundColor
Black -ForegroundColor Yellow
#now need to make sure the script is not being run on a session-only
host
$ServerName = $env:computername
$Server = Get-XAServer -ServerName $ServerName -EA 0
If($Server.ElectionPreference -eq "WorkerMode")
{
$ErrorActionPreference = $SaveEAPreference
Write-Warning "This script cannot be run on a Session-only Host
Server if Remoting is not enabled."
Write-Warning "Use Set-XADefaultComputerName
XA65ControllerServerName or run the script on a controller."
Write-Error "Script cannot continue. See messages above."
Exit
}
}
Function OutputConfigLogSettings
{
Param([object] $ConfigurationLogging )
If($MSWord -or $PDF)
{
$selection.InsertNewPage()
WriteWordLine 1 0 "Configuration Logging"
}
ElseIf($Text)
{
Line 0 "Configuration Logging"
}
ElseIf($HTML)
{
WriteHTMLLine 1 0 "Configuration Logging"
}
If($ConfigurationLogging.LoggingEnabled)
{
$Script:ConfigLog = $True
[array]$ConString = $ConfigurationLogging.ConnectionString.Split(";")
If($MSWord -or $PDF)
{
[System.Collections.Hashtable[]] $ScriptInformation = @()
$ScriptInformation += @{ Data = "Configuration Logging"; Value =
"Enabled"; }
$ScriptInformation += @{ Data = "Allow changes to the farm when
logging database is disconnected"; Value =
$ConfigurationLogging.ChangesWhileDisconnectedAllowed; }
$ScriptInformation += @{ Data = "Require administrator to enter
credentials before clearing the log"; Value =
$ConfigurationLogging.CredentialsOnClearLogRequired; }
$ScriptInformation += @{ Data = "Database type"; Value =
$ConfigurationLogging.DatabaseType; }
$ScriptInformation += @{ Data = "Authentication mode"; Value =
$ConfigurationLogging.AuthenticationMode; }
$ScriptInformation += @{ Data = "Connection string"; Value =
$ConString[0]; }
$cnt = -1
ForEach($tmp in $ConString)
{
$cnt++
If($cnt -gt 0)
{
$ScriptInformation += @{ Data = ""; Value = $tmp; }
}
}
$Table.Columns.Item(1).Width = 300;
$Table.Columns.Item(2).Width = 200;
$Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
FindWordDocumentEnd
$Table = $Null
WriteWordLine 0 0 ""
}
ElseIf($Text)
{
Line 1 "Configuration Logging`t`t`t`t`t`t`t: Enabled"
Line 1 "Allow changes to the farm when logging database is
disconnected`t`t: " $ConfigurationLogging.ChangesWhileDisconnectedAllowed
Line 1 "Require administrator to enter credentials before
clearing the log`t: " $ConfigurationLogging.CredentialsOnClearLogRequired
Line 1 "Database type`t`t`t`t`t`t`t`t: "
$ConfigurationLogging.DatabaseType
Line 1 "Authentication mode`t`t`t`t`t`t`t: "
$ConfigurationLogging.AuthenticationMode
Line 1 "Connection string`t`t`t`t`t`t`t: " $ConString[0]
$cnt = -1
ForEach($tmp in $ConString)
{
$cnt++
If($cnt -gt 0)
{
Line 10 " " $tmp
}
}
Line 1 "User name`t`t`t`t`t`t`t`t: "
$ConfigurationLogging.UserName
Line 0 ""
}
ElseIf($HTML)
{
$rowdata = @()
$columnHeaders = @("Configuration Logging",($htmlsilver -bor
$htmlbold),"Enabled",$htmlwhite)
$rowdata += @(,('Allow changes to the farm when logging database
is disconnected',($htmlsilver -bor $htmlbold),
$ConfigurationLogging.ChangesWhileDisconnectedAllowed,$htmlwhite))
$rowdata += @(,('Require administrator to enter credentials
before clearing the log',($htmlsilver -bor $htmlbold),
$ConfigurationLogging.CredentialsOnClearLogRequired,$htmlwhite))
$rowdata += @(,('Database type',($htmlsilver -bor $htmlbold),
$ConfigurationLogging.DatabaseType,$htmlwhite))
$rowdata += @(,('Authentication mode',($htmlsilver -bor
$htmlbold),$ConfigurationLogging.AuthenticationMode,$htmlwhite))
$rowdata += @(,('Connection string',($htmlsilver -bor $htmlbold),
$ConString[0],$htmlwhite))
$cnt = -1
ForEach($tmp in $ConString)
{
$cnt++
If($cnt -gt 0)
{
$rowdata += @(,('',($htmlsilver -bor $htmlbold),$tmp,
$htmlwhite))
}
}
$rowdata += @(,('User name',($htmlsilver -bor $htmlbold),
$ConfigurationLogging.UserName,$htmlwhite))
$msg = ""
$columnWidths = @("300","200")
FormatHTMLTable $msg -rowArray $rowdata -columnArray
$columnHeaders -fixedWidth $columnWidths
}
}
Else
{
If($MSWord -or $PDF)
{
WriteWordLine 0 1 "Configuration Logging is disabled."
}
ElseIf($Text)
{
Line 1 "Configuration Logging is disabled."
Line 0 ""
}
ElseIf($HTML)
{
WriteHTMLLine 0 1 "Configuration Logging is disabled."
WriteHTMLLine 0 0 ""
}
}
}
#endregion
Function OutputSummaryAdministrators
{
Param([object] $Administrators)
ForEach($Administrator in $Administrators)
{
Write-Host "$(Get-Date): `t`tProcessing administrator $
($Administrator.AdministratorName)" -BackgroundColor Black -ForegroundColor Yellow
If($MSWord -or $PDF)
{
WriteWordLine 0 0
$WordTableRowHash = @{
AdminName = $Administrator.AdministratorName;
}
$AdminsWordTable += $WordTableRowHash;
$CurrentServiceIndex++;
}
ElseIf($Text)
{
Line 0 $Administrator.AdministratorName
}
ElseIf($HTML)
{
$rowdata += @(,(
$Administrator.AdministratorName,$htmlwhite))
}
$Script:TotalAdmins++
}
$Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
FindWordDocumentEnd
$Table = $Null
WriteWordLine 0 0 ""
}
ElseIf($Text)
{
Line 0 ""
}
ElseIf($HTML)
{
$columnHeaders = @(
'Name',($htmlsilver -bor $htmlbold))
$msg = ""
FormatHTMLTable $msg "auto" -rowArray $rowdata -columnArray
$columnHeaders
}
}
Function OutputAdministrators
{
Param([object] $Administrators)
ForEach($Administrator in $Administrators)
{
Write-Host "$(Get-Date): `t`tProcessing administrator $
($Administrator.AdministratorName)" -BackgroundColor Black -ForegroundColor Yellow
$xAdminType = ""
Switch ($Administrator.AdministratorType)
{
"Unknown" {$xAdminType = "Unknown"; Break}
"Full" {$xAdminType = "Full Administration";
$Script:TotalFullAdmins++; Break}
"ViewOnly" {$xAdminType = "View Only"; $Script:TotalViewAdmins++;
Break}
"Custom" {$xAdminType = "Custom"; $Script:TotalCustomAdmins++;
Break}
Default {$xAdminType = "Administrator type could not be
determined: $($Administrator.AdministratorType)"; Break}
}
$xAdminEnabled = ""
If($Administrator.Enabled)
{
$xAdminEnabled = "Enabled"
}
Else
{
$xAdminEnabled = "Disabled"
}
$Table.Columns.Item(1).Width = 75;
$Table.Columns.Item(2).Width = 425;
$Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
FindWordDocumentEnd
$Table = $Null
WriteWordLine 0 0 ""
}
ElseIf($Text)
{
Line 1 "Name`t`t: " $Administrator.AdministratorName
Line 1 "Type`t`t: " $xAdminType
Line 1 "Account`t`t: " $xAdminEnabled
If($Administrator.AdministratorType -eq "Custom")
{
Line 1 "Privileges`t: " $xFarmPrivileges[0]
$cnt = -1
ForEach($tmp in $xFarmPrivileges)
{
$cnt++
If($cnt -gt 0)
{
Line 3 " " $tmp
}
}
Line 1 "Permissions`t: " $xFolderPermissions[0]
$cnt = -1
ForEach($tmp in $xFolderPermissions)
{
$cnt++
If($cnt -gt 0)
{
Line 3 " " $tmp
}
}
}
Line 0 ""
}
ElseIf($HTML)
{
$columnHeaders = @()
$rowdata = @()
}
#endregion
Function OutputApplications
{
Param([object] $Applications)
ForEach($Application in $Applications)
{
Write-Host "$(Get-Date): `t`tProcessing application $
($Application.BrowserName)" -BackgroundColor Black -ForegroundColor Yellow
If(!$Summary)
{
If($Application.ApplicationType -ne "ServerDesktop" -and
$Application.ApplicationType -ne "Content")
{
#create array for appendix A
#these items are taken from
http://support.citrix.com/article/CTX159159
#Some properties that must match on both Applications for
Session Sharing to Function are:
#
#Color depth
#Screen Size
#Access Control Filters (for SmartAccess)
#Sound (unexplained in article)
#Drive Mapping (unexplained in article)
#Printer Mapping (unexplained in article)
#Encryption
If($Application.AccessSessionConditionsEnabled)
{
$tmp = @()
ForEach($filter in
$Application.AccessSessionConditions)
{
$tmp += $filter
}
$obj | Add-Member -MemberType NoteProperty -Name
AccessControlFilters -Value $tmp
}
Else
{
$obj | Add-Member -MemberType NoteProperty -Name
AccessControlFilters -Value "None"
}
$tmp = $Null
#type properties
$tmp = ""
Switch ($Application.ApplicationType)
{
"Unknown" {$Tmp =
"Unknown"; Break}
"ServerInstalled" {$Tmp =
"Installed application"; $Script:TotalPublishedApps++; Break}
"ServerDesktop" {$Tmp =
"Server desktop"; $Script:TotalPublishedDesktops++; Break}
"Content" {$Tmp =
"Content"; $Script:TotalPublishedContent++; Break}
"StreamedToServer" {$Tmp =
"Streamed to server"; $Script:TotalStreamedApps++; Break}
"StreamedToClient" {$Tmp =
"Streamed to client"; $Script:TotalStreamedApps++; Break}
"StreamedToClientOrInstalled" {$Tmp =
"Streamed if possible, otherwise accessed from server as Installed application";
$Script:TotalStreamedApps++; Break}
"StreamedToClientOrStreamedToServer" {$Tmp =
"Streamed if possible, otherwise Streamed to server"; $Script:TotalStreamedApps++;
Break}
Default
{$Tmp = "Application Type could not be determined: $
($Application.ApplicationType)"; Break}
}
$ScriptInformation += @{ Data = "Application Type"; Value =
$tmp; }
$ScriptInformation += @{ Data = "Folder path"; Value =
$Application.FolderPath; }
$ScriptInformation += @{ Data = "Content Address"; Value =
$Application.ContentAddress; }
$tmp = $Null
#location properties
If(!$streamedapp)
{
$ScriptInformation += @{ Data = "Command Line"; Value
= $Application.CommandLineExecutable; }
$ScriptInformation += @{ Data = "Working directory";
Value = $Application.WorkingDirectory; }
#servers properties
If($AppServerInfoResults)
{
If(!
[String]::IsNullOrEmpty($AppServerInfo.ServerNames))
{
$TempArray = @($AppServerInfo.ServerNames
| Sort-Object ServerNames)
$ScriptInformation += @{ Data =
"Servers"; Value = $TempArray[0]; }
$cnt = -1
ForEach($Item in $TempArray)
{
$cnt++
If($cnt -gt 0)
{
$ScriptInformation += @{ Data
= ""; Value = $Item; }
}
}
$TempArray = $Null
}
If(!
[String]::IsNullOrEmpty($AppServerInfo.WorkerGroupNames))
{
$TempArray =
@($AppServerInfo.WorkerGroupNames | Sort-Object WorkerGroupNames)
$ScriptInformation += @{ Data = "Worker
Groups"; Value = $TempArray[0]; }
$cnt = -1
ForEach($Item in $TempArray)
{
$cnt++
If($cnt -gt 0)
{
$ScriptInformation += @{ Data
= ""; Value = $Item; }
}
}
$TempArray = $Null
}
}
Else
{
$ScriptInformation += @{ Data = "Unable to
retrieve a list of Servers or Worker Groups for this application"; Value = ""; }
}
}
#users properties
If($Application.AnonymousConnectionsAllowed)
{
$ScriptInformation += @{ Data = "Allow anonymous
users"; Value = $Application.AnonymousConnectionsAllowed; }
}
Else
{
If($AppServerInfoResults)
{
$TempArray = @($AppServerInfo.Accounts | Sort-
Object AccountName)
$ScriptInformation += @{ Data = "Users"; Value
= $TempArray[0]; }
$cnt = -1
ForEach($Item in $TempArray)
{
$cnt++
If($cnt -gt 0)
{
$ScriptInformation += @{ Data = "";
Value = $Item; }
}
}
$TempArray = $Null
}
Else
{
$ScriptInformation += @{ Data = "Unable to
retrieve a list of Users for this application"; Value = ""; }
}
}
If($Application.ConnectionsThroughAccessGatewayAllowed)
{
$tmp = "Yes"
}
Else
{
$tmp = "No"
}
$ScriptInformation += @{ Data = "Allow connections
made through AGAE"; Value = $tmp; }
$tmp = $Null
}
If($Application.OtherConnectionsAllowed)
{
If($Application.OtherConnectionsAllowed)
{
$tmp = "Yes"
}
Else
{
$tmp = "No"
}
$ScriptInformation += @{ Data = "Any connection";
Value = $tmp; }
$tmp = $Null
}
If($Application.AccessSessionConditionsEnabled)
{
$ScriptInformation += @{ Data = "Any connection that
meets any of the following filters"; Value =
$Application.AccessSessionConditionsEnabled; }
$ScriptInformation += @{ Data = " Access Gateway
Filters"; Value = ""; }
ForEach($AccessCondition in
$Application.AccessSessionConditions)
{
[string]$Tmp = $AccessCondition
[string]$AGFarm = $Tmp.substring(0,
$Tmp.indexof(":"))
[string]$AGFilter =
$Tmp.substring($Tmp.indexof(":")+1)
$tmp = "Farm name: $AGFarm Filter: $AGFilter"
$ScriptInformation += @{ Data = ""; Value =
$tmp; }
}
$tmp = $Null
$AGFarm = $Null
$AGFilter = $Null
}
#limits properties
If($Application.InstanceLimit -eq -1)
{
$tmp = "No limit set"
}
Else
{
$tmp = $Application.InstanceLimit.ToString()
}
$ScriptInformation += @{ Data = "Limit instances allowed to
run in server farm"; Value = $tmp; }
$tmp = $Null
If($Application.MultipleInstancesPerUserAllowed)
{
$tmp = "No"
}
Else
{
$tmp = "Yes"
}
$ScriptInformation += @{ Data = "Allow only 1 instance of
app for each user"; Value = $tmp; }
$tmp = $Null
If($Application.CpuPriorityLevel)
{
Switch ($Application.CpuPriorityLevel)
{
"Unknown" {$Tmp = "Unknown"; Break}
"BelowNormal" {$Tmp = "Below Normal";
Break}
"Low" {$Tmp = "Low"; Break}
"Normal" {$Tmp = "Normal"; Break}
"AboveNormal" {$Tmp = "Above Normal";
Break}
"High" {$Tmp = "High"; Break}
Default {$Tmp = "Application
importance could not be determined: $($Application.CpuPriorityLevel)"; Break}
}
$ScriptInformation += @{ Data = "Application
importance"; Value = $tmp; }
}
If($Application.AudioRequired)
{
$tmp = "Enabled"
}
Else
{
$tmp = "Disabled"
}
$ScriptInformation += @{ Data = "Minimum requirement";
Value = $tmp; }
$tmp = $Null
If($Application.SslConnectionEnabled)
{
If($Application.SslConnectionEnabled)
{
$Tmp = "Enabled"
}
Else
{
$Tmp = "Disabled"
}
}
$ScriptInformation += @{ Data = "Enable SSL and TLS
protocols"; Value = $tmp; }
$tmp = $Null
If($Application.EncryptionLevel)
{
Switch ($Application.EncryptionLevel)
{
"Unknown" {$Tmp = "Unknown"; Break}
"Basic" {$Tmp = "Basic"; Break}
"LogOn" {$Tmp = "128-Bit Login Only (RC-
5)"; Break}
"Bits40" {$Tmp = "40-Bit (RC-5)"; Break}
"Bits56" {$Tmp = "56-Bit (RC-5)"; Break}
"Bits128" {$Tmp = "128-Bit (RC-5)"; Break}
Default {$Tmp = "Encryption could not
be determined: $($Application.EncryptionLevel)"; Break}
}
}
$ScriptInformation += @{ Data = "Encryption"; Value = $tmp;
}
$tmp = $Null
If($Application.EncryptionRequired)
{
If($Application.EncryptionRequired)
{
$Tmp = "Enabled"
}
Else
{
$Tmp = "Disabled"
}
}
$ScriptInformation += @{ Data = "Minimum requirement";
Value = $tmp; }
$tmp = $Null
#appearance properties
If($Application.WindowType)
{
$ScriptInformation += @{ Data = "Session window
size"; Value = $Application.WindowType; }
}
If($Application.ColorDepth)
{
Switch ($Application.ColorDepth)
{
"Unknown" {$Tmp = "Unknown color
depth"; Break}
"Colors8Bit" {$Tmp = "256-color (8-bit)";
Break}
"Colors16Bit" {$Tmp = "Better Speed (16-
bit)"; Break}
"Colors32Bit" {$Tmp = "Better Appearance
(32-bit)"; Break}
Default {$Tmp = "Maximum color
quality could not be determined: $($Application.ColorDepth)"; Break}
}
$ScriptInformation += @{ Data = "Maximum color
quality"; Value = $tmp; }
$tmp = $Null
}
If($Application.TitleBarHidden)
{
If($Application.TitleBarHidden)
{
$Tmp = "Enabled"
}
Else
{
$Tmp = "Disabled"
}
$ScriptInformation += @{ Data = "Hide application
title bar"; Value = $tmp; }
$tmp = $Null
}
If($Application.MaximizedOnStartup)
{
If($Application.MaximizedOnStartup)
{
$Tmp = "Enabled"
}
Else
{
$Tmp = "Disabled"
}
$ScriptInformation += @{ Data = "Maximize application
at startup"; Value = $tmp; }
$tmp = $Null
}
$AppServerInfo = $Null
$Table.Columns.Item(1).Width = 250;
$Table.Columns.Item(2).Width = 250;
$Table.Rows.SetLeftIndent($Indent0TabStops,
$wdAdjustProportional)
FindWordDocumentEnd
$Table = $Null
WriteWordLine 0 0 ""
}
ElseIf($Text)
{
Line 0 $Application.DisplayName
Line 1 "Application name`t`t: " $Application.BrowserName
Line 1 "Disable application`t`t: " -NoNewLine
#weird, if application is enabled, it is disabled!
If($Application.Enabled)
{
Line 0 "No"
}
Else
{
Line 0 "Yes"
Line 1 "Hide disabled application`t: " -nonewline
If($Application.HideWhenDisabled)
{
Line 0 "Yes"
}
Else
{
Line 0 "No"
}
}
If(![String]::IsNullOrEmpty($Application.Description))
{
Line 1 "Application description`t`t: "
$Application.Description
}
#type properties
Line 1 "Application Type`t`t: " -nonewline
Switch ($Application.ApplicationType)
{
"Unknown" {Line 0
"Unknown"; Break}
"ServerInstalled" {Line 0
"Installed application"; $Script:TotalPublishedApps++; Break}
"ServerDesktop" {Line 0
"Server desktop"; $Script:TotalPublishedDesktops++; Break}
"Content" {Line 0
"Content"; $Script:TotalPublishedContent++; Break}
"StreamedToServer" {Line 0
"Streamed to server"; $Script:TotalStreamedApps++; Break}
"StreamedToClient" {Line 0
"Streamed to client"; $Script:TotalStreamedApps++; Break}
"StreamedToClientOrInstalled" {Line 0
"Streamed if possible, otherwise accessed from server as Installed application";
$Script:TotalStreamedApps++; Break}
"StreamedToClientOrStreamedToServer" {Line 0
"Streamed if possible, otherwise Streamed to server"; $Script:TotalStreamedApps++;
Break}
Default
{Line 0 "Application Type could not be determined: $
($Application.ApplicationType)"; Break}
}
If(![String]::IsNullOrEmpty($Application.FolderPath))
{
Line 1 "Folder path`t`t`t: " $Application.FolderPath
}
If(![String]::IsNullOrEmpty($Application.ContentAddress))
{1
#servers properties
If($AppServerInfoResults)
{
If(!
[String]::IsNullOrEmpty($AppServerInfo.ServerNames))
{
Line 1 "Servers:"
$TempArray = $AppServerInfo.ServerNames |
Sort-Object ServerNames
ForEach($Item in $TempArray)
{
Line 2 $Item
}
$TempArray = $Null
}
If(!
[String]::IsNullOrEmpty($AppServerInfo.WorkerGroupNames))
{
Line 1 "Worker Groups:"
$TempArray =
$AppServerInfo.WorkerGroupNames | Sort-Object WorkerGroupNames
ForEach($Item in $TempArray)
{
Line 2 $Item
}
$TempArray = $Null
}
}
Else
{
Line 2 "Unable to retrieve a list of Servers or
Worker Groups for this application"
}
}
#users properties
If($Application.AnonymousConnectionsAllowed)
{
Line 1 "Allow anonymous users: "
$Application.AnonymousConnectionsAllowed
}
Else
{
If($AppServerInfoResults)
{
$TempArray = @($AppServerInfo.Accounts | Sort-
Object Accounts)
Line 1 "Users:"
ForEach($user in $TempArray)
{
Line 2 $user
}
}
Else
{
Line 2 "Unable to retrieve a list of Users for
this application"
}
}
If($Application.ConnectionsThroughAccessGatewayAllowed)
{
Line 0 "Yes"
}
Else
{
Line 0 "No"
}
}
If($Application.OtherConnectionsAllowed)
{
Line 1 "Any connection`t`t`t`t`t: " -nonewline
If($Application.OtherConnectionsAllowed)
{
Line 0 "Yes"
}
Else
{
Line 0 "No"
}
}
If($Application.AccessSessionConditionsEnabled)
{
Line 1 "Any connection that meets any of the
following filters: " $Application.AccessSessionConditionsEnabled
Line 1 "Access Gateway Filters:"
ForEach($AccessCondition in
$Application.AccessSessionConditions)
{
[string]$Tmp = $AccessCondition
[string]$AGFarm = $Tmp.substring(0,
$Tmp.indexof(":"))
[string]$AGFilter =
$Tmp.substring($Tmp.indexof(":")+1)
Line 2 "$($AGFarm) $($AGFilter)"
}
Line 0 ""
$tmp = $Null
$AGFarm = $Null
$AGFilter = $Null
}
#limits properties
Line 1 "Limit instances allowed to run in server farm`t: "
-NoNewLine
If($Application.MultipleInstancesPerUserAllowed)
{
Line 0 "No"
}
Else
{
Line 0 "Yes"
}
If($Application.CpuPriorityLevel)
{
Line 1 "Application importance`t`t`t`t: " -nonewline
Switch ($Application.CpuPriorityLevel)
{
"Unknown" {Line 0 "Unknown"; Break}
"BelowNormal" {Line 0 "Below Normal";
Break}
"Low" {Line 0 "Low"; Break}
"Normal" {Line 0 "Normal"; Break}
"AboveNormal" {Line 0 "Above Normal";
Break}
"High" {Line 0 "High"; Break}
Default {Line 0 "Application
importance could not be determined: $($Application.CpuPriorityLevel)"; Break}
}
}
#appearance properties
If($Application.WindowType)
{
Line 1 "Session window size`t`t`t`t: "
$Application.WindowType
}
If($Application.ColorDepth)
{
Line 1 "Maximum color quality`t`t`t`t: " -nonewline
Switch ($Application.ColorDepth)
{
"Unknown" {Line 0 "Unknown color
depth"; Break}
"Colors8Bit" {Line 0 "256-color (8-bit)";
Break}
"Colors16Bit" {Line 0 "Better Speed (16-
bit)"; Break}
"Colors32Bit" {Line 0 "Better Appearance
(32-bit)"; Break}
Default {Line 0 "Maximum color
quality could not be determined: $($Application.ColorDepth)"; Break}
}
}
If($Application.TitleBarHidden)
{
Line 1 "Hide application title bar`t`t`t: "
-nonewline
If($Application.TitleBarHidden)
{
Line 0 "Enabled"
}
Else
{
Line 0 "Disabled"
}
}
If($Application.MaximizedOnStartup)
{
Line 1 "Maximize application at startup`t`t`t: "
-nonewline
If($Application.MaximizedOnStartup)
{
Line 0 "Enabled"
}
Else
{
Line 0 "Disabled"
}
}
Line 0 ""
$AppServerInfo = $Null
}
ElseIf($HTML)
{
WriteHTMLLine 2 0 $Application.DisplayName
$columnHeaders = @()
$rowdata = @()
#type properties
$tmp = ""
Switch ($Application.ApplicationType)
{
"Unknown" {$Tmp =
"Unknown"; Break}
"ServerInstalled" {$Tmp =
"Installed application"; $Script:TotalPublishedApps++; Break}
"ServerDesktop" {$Tmp =
"Server desktop"; $Script:TotalPublishedDesktops++; Break}
"Content" {$Tmp =
"Content"; $Script:TotalPublishedContent++; Break}
"StreamedToServer" {$Tmp =
"Streamed to server"; $Script:TotalStreamedApps++; Break}
"StreamedToClient" {$Tmp =
"Streamed to client"; $Script:TotalStreamedApps++; Break}
"StreamedToClientOrInstalled" {$Tmp =
"Streamed if possible, otherwise accessed from server as Installed application";
$Script:TotalStreamedApps++; Break}
"StreamedToClientOrStreamedToServer" {$Tmp =
"Streamed if possible, otherwise Streamed to server"; $Script:TotalStreamedApps++;
Break}
Default
{$Tmp = "Application Type could not be determined: $
($Application.ApplicationType)"; Break}
}
$rowdata += @(,("Application Type",($htmlsilver -bor
$htmlbold),$tmp,$htmlwhite))
$rowdata += @(,("Folder path",($htmlsilver -bor $htmlbold),
$Application.FolderPath,$htmlwhite))
$rowdata += @(,("Content Address",($htmlsilver -bor
$htmlbold),$Application.ContentAddress,$htmlwhite))
$tmp = $Null
#location properties
If(!$streamedapp)
{
$rowdata += @(,("Command Line",($htmlsilver -bor
$htmlbold),$Application.CommandLineExecutable,$htmlwhite))
$rowdata += @(,("Working directory",($htmlsilver -bor
$htmlbold),$Application.WorkingDirectory,$htmlwhite))
#servers properties
If($AppServerInfoResults)
{
If(!
[String]::IsNullOrEmpty($AppServerInfo.ServerNames))
{
$TempArray = @($AppServerInfo.ServerNames
| Sort-Object ServerNames)
$rowdata += @(,("Servers",($htmlsilver
-bor $htmlbold),$TempArray[0],$htmlwhite))
$cnt = -1
ForEach($Item in $TempArray)
{
$cnt++
If($cnt -gt 0)
{
$rowdata += @(,("",
($htmlsilver -bor $htmlbold),$Item,$htmlwhite))
}
}
$TempArray = $Null
}
If(!
[String]::IsNullOrEmpty($AppServerInfo.WorkerGroupNames))
{
$TempArray =
@($AppServerInfo.WorkerGroupNames | Sort-Object WorkerGroupNames)
$rowdata += @(,("Worker Groups",
($htmlsilver -bor $htmlbold),$TempArray[0],$htmlwhite))
$cnt = -1
ForEach($Item in $TempArray)
{
$cnt++
If($cnt -gt 0)
{
$rowdata += @(,("",
($htmlsilver -bor $htmlbold),$Item,$htmlwhite))
}
}
$TempArray = $Null
}
}
Else
{
$rowdata += @(,("Unable to retrieve a list of
Servers or Worker Groups for this application",($htmlsilver -bor $htmlbold),"",
$htmlwhite))
}
}
#users properties
If($Application.AnonymousConnectionsAllowed)
{
$rowdata += @(,("Allow anonymous users",($htmlsilver
-bor $htmlbold),$Application.AnonymousConnectionsAllowed,$htmlwhite))
}
Else
{
If($AppServerInfoResults)
{
$TempArray = @($AppServerInfo.Accounts | Sort-
Object Accounts)
$rowdata += @(,("Users",($htmlsilver -bor
$htmlbold),$TempArray[0],$htmlwhite))
$cnt = -1
ForEach($Item in $TempArray)
{
$cnt++
If($cnt -gt 0)
{
$rowdata += @(,("",($htmlsilver
-bor $htmlbold),$Item,$htmlwhite))
}
}
$TempArray = $Null
}
Else
{
$rowdata += @(,("Unable to retrieve a list of
Users for this application",($htmlsilver -bor $htmlbold),"",$htmlwhite))
}
}
If($Application.ConnectionsThroughAccessGatewayAllowed)
{
$tmp = "Yes"
}
Else
{
$tmp = "No"
}
$rowdata += @(,("Allow connections made through
AGAE",($htmlsilver -bor $htmlbold),$tmp,$htmlwhite))
$tmp = $Null
}
If($Application.OtherConnectionsAllowed)
{
If($Application.OtherConnectionsAllowed)
{
$tmp = "Yes"
}
Else
{
$tmp = "No"
}
$rowdata += @(,("Any connection",($htmlsilver -bor
$htmlbold),$tmp,$htmlwhite))
$tmp = $Null
}
If($Application.AccessSessionConditionsEnabled)
{
$rowdata += @(,("Any connection that meets any of the
following filters",($htmlsilver -bor $htmlbold),
$Application.AccessSessionConditionsEnabled,$htmlwhite))
$rowdata += @(,(" Access Gateway Filters",
($htmlsilver -bor $htmlbold),"",$htmlwhite))
ForEach($AccessCondition in
$Application.AccessSessionConditions)
{
[string]$Tmp = $AccessCondition
[string]$AGFarm = $Tmp.substring(0,
$Tmp.indexof(":"))
[string]$AGFilter =
$Tmp.substring($Tmp.indexof(":")+1)
$tmp = "Farm name: $AGFarm Filter: $AGFilter"
$rowdata += @(,("",($htmlsilver -bor
$htmlbold),$tmp,$htmlwhite))
}
$tmp = $Null
$AGFarm = $Null
$AGFilter = $Null
}
#limits properties
If($Application.InstanceLimit -eq -1)
{
$tmp = "No limit set"
}
Else
{
$tmp = $Application.InstanceLimit.ToString()
}
$rowdata += @(,("Limit instances allowed to run in server
farm",($htmlsilver -bor $htmlbold),$tmp,$htmlwhite))
$tmp = $Null
If($Application.MultipleInstancesPerUserAllowed)
{
$tmp = "No"
}
Else
{
$tmp = "Yes"
}
$rowdata += @(,("Allow only 1 instance of app for each
user",($htmlsilver -bor $htmlbold),$tmp,$htmlwhite))
$tmp = $Null
If($Application.CpuPriorityLevel)
{
Switch ($Application.CpuPriorityLevel)
{
"Unknown" {$Tmp = "Unknown"; Break}
"BelowNormal" {$Tmp = "Below Normal";
Break}
"Low" {$Tmp = "Low"; Break}
"Normal" {$Tmp = "Normal"; Break}
"AboveNormal" {$Tmp = "Above Normal";
Break}
"High" {$Tmp = "High"; Break}
Default {$Tmp = "Application
importance could not be determined: $($Application.CpuPriorityLevel)"; Break}
}
$rowdata += @(,("Application importance",($htmlsilver
-bor $htmlbold),$tmp,$htmlwhite))
}
If($Application.AudioRequired)
{
$tmp = "Enabled"
}
Else
{
$tmp = "Disabled"
}
$rowdata += @(,("Minimum requirement",($htmlsilver -bor
$htmlbold),$tmp,$htmlwhite))
$tmp = $Null
If($Application.SslConnectionEnabled)
{
If($Application.SslConnectionEnabled)
{
$Tmp = "Enabled"
}
Else
{
$Tmp = "Disabled"
}
}
$rowdata += @(,("Enable SSL and TLS protocols",($htmlsilver
-bor $htmlbold),$tmp,$htmlwhite))
$tmp = $Null
If($Application.EncryptionLevel)
{
Switch ($Application.EncryptionLevel)
{
"Unknown" {$Tmp = "Unknown"; Break}
"Basic" {$Tmp = "Basic"; Break}
"LogOn" {$Tmp = "128-Bit Login Only (RC-
5)"; Break}
"Bits40" {$Tmp = "40-Bit (RC-5)"; Break}
"Bits56" {$Tmp = "56-Bit (RC-5)"; Break}
"Bits128" {$Tmp = "128-Bit (RC-5)"; Break}
Default {$Tmp = "Encryption could not
be determined: $($Application.EncryptionLevel)"; Break}
}
}
$rowdata += @(,("Encryption",($htmlsilver -bor $htmlbold),
$tmp,$htmlwhite))
$tmp = $Null
If($Application.EncryptionRequired)
{
If($Application.EncryptionRequired)
{
$Tmp = "Enabled"
}
Else
{
$Tmp = "Disabled"
}
}
$rowdata += @(,("Minimum requirement",($htmlsilver -bor
$htmlbold),$tmp,$htmlwhite))
$tmp = $Null
#appearance properties
If($Application.WindowType)
{
$rowdata += @(,("Session window size",($htmlsilver
-bor $htmlbold),$Application.WindowType,$htmlwhite))
}
If($Application.ColorDepth)
{
Switch ($Application.ColorDepth)
{
"Unknown" {$Tmp = "Unknown color
depth"; Break}
"Colors8Bit" {$Tmp = "256-color (8-bit)";
Break}
"Colors16Bit" {$Tmp = "Better Speed (16-
bit)"; Break}
"Colors32Bit" {$Tmp = "Better Appearance
(32-bit)"; Break}
Default {$Tmp = "Maximum color
quality could not be determined: $($Application.ColorDepth)"; Break}
}
$rowdata += @(,("Maximum color quality",($htmlsilver
-bor $htmlbold),$tmp,$htmlwhite))
$tmp = $Null
}
If($Application.TitleBarHidden)
{
If($Application.TitleBarHidden)
{
$Tmp = "Enabled"
}
Else
{
$Tmp = "Disabled"
}
$rowdata += @(,("Hide application title bar",
($htmlsilver -bor $htmlbold),$tmp,$htmlwhite))
$tmp = $Null
}
If($Application.MaximizedOnStartup)
{
If($Application.MaximizedOnStartup)
{
$Tmp = "Enabled"
}
Else
{
$Tmp = "Disabled"
}
$rowdata += @(,("Maximize application at startup",
($htmlsilver -bor $htmlbold),$tmp,$htmlwhite))
$tmp = $Null
}
$AppServerInfo = $Null
$msg = ""
$columnWidths = @("250","250")
FormatHTMLTable $msg -rowArray $rowdata -columnArray
$columnHeaders -fixedWidth $columnWidths
WriteHTMLLine 0 0 ""
}
}
Else
{
If($MSWord -or $PDF)
{
WriteWordLine 0 0 $Application.DisplayName
}
ElseIf($Text)
{
Line 0 $Application.DisplayName
}
ElseIf($HTML)
{
WriteHTMLLine 0 0 $Application.DisplayName
}
}
}
}
#endregion
If($ConfigLog)
{
Write-Host "$(Get-Date): Processing Configuration Logging/History
Report" -BackgroundColor Black -ForegroundColor Yellow
#history AKA Configuration Logging report
#only process if $ConfigLog = $True and XA65ConfigLog.udl file
exists
#build connection string
#User ID is account that has access permission for the
configuration logging database
#Initial Catalog is the name of the Configuration Logging SQL
Database
#bug fixed by Esther Barthel
If(Test-Path "$($pwd.path)\XA65ConfigLog.udl")
{
Write-Host "$(Get-Date): `tRetrieving logging data for date
range $($StartDate) through $($EndDate)" -BackgroundColor Black -ForegroundColor
Yellow
$ConnectionString = Get-Content "$
($pwd.path)\XA65ConfigLog.udl"| Select-Object -last 1
Function OutputConfigLogging
{
Param([object] $ConfigLogReport)
Write-Host "$(Get-Date): `tProcessing $($ConfigLogReport.Count) history
items" -BackgroundColor Black -ForegroundColor Yellow
$Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
FindWordDocumentEnd
$Table = $Null
WriteWordLine 0 0 ""
}
ElseIf($Text)
{
Line 0 "History"
Line 0 "For date range $($StartDate) through $($EndDate)"
Line 0 ""
ForEach($Item in $ConfigLogReport)
{
Line 1 "Date`t`t`t: " $Item.Date
Line 1 "Account`t`t`t: " $Item.Account
Line 1 "Change description`t: " $Item.Description
Line 1 "Type of change`t`t: " $Item.TaskType
Line 1 "Type of item`t`t: " $Item.ItemType
Line 1 "Name of item`t`t: " $Item.ItemName
Line 0 ""
}
}
ElseIf($HTML)
{
WriteHTMLLine 1 0 "History"
WriteHTMLLine 0 0 "For date range $($StartDate) through $($EndDate)"
$rowdata = @()
ForEach($Item in $ConfigLogReport)
{
$rowdata += @(,(
$Item.Date,$htmlwhite,
$Item.Account,$htmlwhite,
$Item.Description,$htmlwhite,
$Item.TaskType,$htmlwhite,
$Item.ItemType,$htmlwhite,
$Item.ItemName,$htmlwhite))
}
$columnHeaders = @(
'Date',($htmlsilver -bor $htmlbold),
'Account',($htmlsilver -bor $htmlbold),
'Change description',($htmlsilver -bor $htmlbold),
'Type of change',($htmlsilver -bor $htmlbold),
'Type of item',($htmlsilver -bor $htmlbold),
'Name of item',($htmlsilver -bor $htmlbold))
$msg = ""
FormatHTMLTable $msg "auto" -rowArray $rowdata -columnArray
$columnHeaders -fontsize 2
}
}
#endregion
Function OutputLoadBalancingPolicies
{
Param([object] $LoadBalancingPolicies)
ForEach($LoadBalancingPolicy in $LoadBalancingPolicies)
{
$Script:TotalLBPolicies++
Write-Host "$(Get-Date): `t`tProcessing Load Balancing Policy $
($LoadBalancingPolicy.PolicyName)" -BackgroundColor Black -ForegroundColor Yellow
$LoadBalancingPolicyConfiguration = Get-
XALoadBalancingPolicyConfiguration -PolicyName $LoadBalancingPolicy.PolicyName -EA
0
$LoadBalancingPolicyFilter = Get-XALoadBalancingPolicyFilter
-PolicyName $LoadBalancingPolicy.PolicyName -EA 0
If(!$Summary)
{
If($MSWord -or $PDF)
{
WriteWordLine 2 0 $LoadBalancingPolicy.PolicyName
If(!
[String]::IsNullOrEmpty($LoadBalancingPolicy.Description))
{
WriteWordLine 0 1 "Description`t: "
$LoadBalancingPolicy.Description
}
WriteWordLine 0 1 "Enabled`t`t: " -nonewline
If($LoadBalancingPolicy.Enabled)
{
WriteWordLine 0 0 "Yes"
}
Else
{
WriteWordLine 0 0 "No"
}
WriteWordLine 0 1 "Priority`t`t: "
$LoadBalancingPolicy.Priority
If($LoadBalancingPolicyFilter.AllowConnectionsThroughAccessGateway)
{
WriteWordLine 0 0 "Yes"
}
Else
{
WriteWordLine 0 0 "No"
}
If($LoadBalancingPolicyFilter.AllowConnectionsThroughAccessGateway)
{
WriteWordLine 0 1 "Any connection that meets
any of the following filters"
If($LoadBalancingPolicyFilter.AccessSessionConditions)
{
ForEach($AccessSessionCondition in
$LoadBalancingPolicyFilter.AccessSessionConditions)
{
[string]$Tmp =
$AccessSessionCondition
[string]$AGFarm = $Tmp.substring(0,
$Tmp.indexof(":"))
[string]$AGFilter =
$Tmp.substring($Tmp.indexof(":")+1)
WriteWordLine 0 2 "FarmName: "
$AGFarm
WriteWordLine 0 2 "Filter: "
$AGFilter
WriteWordLine 0 0 ""
}
$tmp = $Null
$AGFarm = $Null
$AGFilter = $Null
}
}
If($LoadBalancingPolicyFilter.AllowOtherConnections)
{
WriteWordLine 0 2 "Apply to all other
connections"
}
}
If($LoadBalancingPolicyFilter.ClientIPAddressEnabled)
{
WriteWordLine 0 1 "Filter based on client IP address"
If($LoadBalancingPolicyFilter.ApplyToAllClientIPAddresses)
{
WriteWordLine 0 2 "Apply to all client IP
addresses"
}
Else
{
If($LoadBalancingPolicyFilter.AllowedIPAddresses)
{
ForEach($AllowedIPAddress in
$LoadBalancingPolicyFilter.AllowedIPAddresses)
{
WriteWordLine 0 2 "Client IP
Address Matched: " $AllowedIPAddress
}
}
If($LoadBalancingPolicyFilter.DeniedIPAddresses)
{
ForEach($DeniedIPAddress in
$LoadBalancingPolicyFilter.DeniedIPAddresses)
{
WriteWordLine 0 2 "Client IP
Address Ignored: " $DeniedIPAddress
}
}
}
}
If($LoadBalancingPolicyFilter.ClientNameEnabled)
{
WriteWordLine 0 1 "Filter based on client name"
If($LoadBalancingPolicyFilter.ApplyToAllClientNames)
{
WriteWordLine 0 2 "Apply to all client names"
}
Else
{
If($LoadBalancingPolicyFilter.AllowedClientNames)
{
ForEach($AllowedClientName in
$LoadBalancingPolicyFilter.AllowedClientNames)
{
WriteWordLine 0 2 "Client Name
Matched: " $AllowedClientName
}
}
If($LoadBalancingPolicyFilter.DeniedClientNames)
{
ForEach($DeniedClientName in
$LoadBalancingPolicyFilter.DeniedClientNames)
{
WriteWordLine 0 2 "Client Name
Ignored: " $DeniedClientName
}
}
}
}
If($LoadBalancingPolicyFilter.AccountEnabled)
{
WriteWordLine 0 1 "Filter based on user"
WriteWordLine 0 2 "Apply to anonymous users: "
-nonewline
If($LoadBalancingPolicyFilter.ApplyToAnonymousAccounts)
{
WriteWordLine 0 0 "Yes"
}
Else
{
WriteWordLine 0 0 "No"
}
If($LoadBalancingPolicyFilter.ApplyToAllExplicitAccounts)
{
WriteWordLine 0 2 "Apply to all explicit (non-
anonymous) users"
}
Else
{
If($LoadBalancingPolicyFilter.AllowedAccounts)
{
ForEach($AllowedAccount in
$LoadBalancingPolicyFilter.AllowedAccounts)
{
WriteWordLine 0 2 "User Matched: "
$AllowedAccount
}
}
If($LoadBalancingPolicyFilter.DeniedAccounts)
{
ForEach($DeniedAccount in
$LoadBalancingPolicyFilter.DeniedAccounts)
{
WriteWordLine 0 2 "User Ignored: "
$DeniedAccount
}
}
}
}
If($LoadBalancingPolicyConfiguration.WorkerGroupPreferenceAndFailoverState)
{
WriteWordLine 0 1 "Configure application connection
preference based on worker group"
If($LoadBalancingPolicyConfiguration.WorkerGroupPreferences)
{
ForEach($WorkerGroupPreference in
$LoadBalancingPolicyConfiguration.WorkerGroupPreferences)
{
[string]$Tmp = $WorkerGroupPreference
[string]$WGName =
$Tmp.substring($Tmp.indexof("=")+1)
[string]$WGPriority =
$Tmp.substring($Tmp.indexof(":")+1, (($Tmp.indexof("=")-1)-$Tmp.indexof(":")))
WriteWordLine 0 2 "Worker Group: "
$WGName
WriteWordLine 0 2 "Priority: "
$WGPriority
WriteWordLine 0 0 ""
}
$tmp = $Null
$WGName = $Null
$WGPriority = $Null
}
}
If($LoadBalancingPolicyConfiguration.StreamingDeliveryProtocolState -eq
"Enabled")
{
WriteWordLine 0 1 "Set the delivery protocols for
applications streamed to client"
WriteWordLine 0 2 "" -nonewline
Switch
($LoadBalancingPolicyConfiguration.StreamingDeliveryOption)
{
"Unknown" {WriteWordLine 0 0
"Unknown"; Break}
"ForceServerAccess" {WriteWordLine 0 0 "Do
not allow applications to stream to the client"; Break}
"ForcedStreamedDelivery" {WriteWordLine 0 0
"Force applications to stream to the client"; Break}
Default {WriteWordLine 0 0 "Delivery protocol
could not be determined: $
($LoadBalancingPolicyConfiguration.StreamingDeliveryOption)"; Break}
}
}
Elseif($LoadBalancingPolicyConfiguration.StreamingDeliveryProtocolState -eq
"Disabled")
{
#In the GUI, if "Set the delivery protocols for
applications streamed to client" IS selected AND
#"Allow applications to stream to the client or run
on a Terminal Server (Default)" IS selected
#then "Set the delivery protocols for applications
streamed to client" is set to Disabled
WriteWordLine 0 1 "Set the delivery protocols for
applications streamed to client"
WriteWordLine 0 2 "Allow applications to stream to
the client or run on a Terminal Server (Default)"
}
Else
{
WriteWordLine 0 1 "Streamed App Delivery is not
configured"
}
$LoadBalancingPolicyConfiguration = $Null
$LoadBalancingPolicyFilter = $Null
WriteWordLine 0 0 ""
}
ElseIf($Text)
{
Line 0 $LoadBalancingPolicy.PolicyName
Line 1 "Description`t: " $LoadBalancingPolicy.Description
Line 1 "Enabled`t`t: " -nonewline
If($LoadBalancingPolicy.Enabled)
{
Line 0 "Yes"
}
Else
{
Line 0 "No"
}
Line 1 "Priority`t: " $LoadBalancingPolicy.Priority
Line 0 ""
If($LoadBalancingPolicyFilter.AllowConnectionsThroughAccessGateway)
{
Line 0 "Yes"
}
Else
{
Line 0 "No"
}
If($LoadBalancingPolicyFilter.AllowConnectionsThroughAccessGateway)
{
Line 1 "Any connection that meets any of the
following filters"
If($LoadBalancingPolicyFilter.AccessSessionConditions)
{
ForEach($AccessSessionCondition in
$LoadBalancingPolicyFilter.AccessSessionConditions)
{
[string]$Tmp =
$AccessSessionCondition
[string]$AGFarm = $Tmp.substring(0,
$Tmp.indexof(":"))
[string]$AGFilter =
$Tmp.substring($Tmp.indexof(":")+1)
Line 2 "Farm Name: " $AGFarm
Line 2 "Filter: " $AGFilter
}
$tmp = $Null
$AGFarm = $Null
$AGFilter = $Null
}
}
If($LoadBalancingPolicyFilter.AllowOtherConnections)
{
Line 2 "Apply to all other connections"
}
}
If($LoadBalancingPolicyFilter.ClientIPAddressEnabled)
{
Line 1 "Filter based on client IP address"
If($LoadBalancingPolicyFilter.ApplyToAllClientIPAddresses)
{
Line 2 "Apply to all client IP addresses"
}
Else
{
If($LoadBalancingPolicyFilter.AllowedIPAddresses)
{
ForEach($AllowedIPAddress in
$LoadBalancingPolicyFilter.AllowedIPAddresses)
{
Line 2 "Client IP Address Matched:
" $AllowedIPAddress
}
}
If($LoadBalancingPolicyFilter.DeniedIPAddresses)
{
ForEach($DeniedIPAddress in
$LoadBalancingPolicyFilter.DeniedIPAddresses)
{
Line 2 "Client IP Address Ignored:
" $DeniedIPAddress
}
}
}
}
If($LoadBalancingPolicyFilter.ClientNameEnabled)
{
Line 1 "Filter based on client name"
If($LoadBalancingPolicyFilter.ApplyToAllClientNames)
{
Line 2 "Apply to all client names"
}
Else
{
If($LoadBalancingPolicyFilter.AllowedClientNames)
{
ForEach($AllowedClientName in
$LoadBalancingPolicyFilter.AllowedClientNames)
{
Line 2 "Client Name Matched: "
$AllowedClientName
}
}
If($LoadBalancingPolicyFilter.DeniedClientNames)
{
ForEach($DeniedClientName in
$LoadBalancingPolicyFilter.DeniedClientNames)
{
Line 2 "Client Name Ignored: "
$DeniedClientName
}
}
}
}
If($LoadBalancingPolicyFilter.AccountEnabled)
{
Line 1 "Filter based on user"
Line 2 "Apply to anonymous users: " -nonewline
If($LoadBalancingPolicyFilter.ApplyToAnonymousAccounts)
{
Line 0 "Yes"
}
Else
{
Line 0 "No"
}
If($LoadBalancingPolicyFilter.ApplyToAllExplicitAccounts)
{
Line 2 "Apply to all explicit (non-anonymous)
users"
}
Else
{
If($LoadBalancingPolicyFilter.AllowedAccounts)
{
ForEach($AllowedAccount in
$LoadBalancingPolicyFilter.AllowedAccounts)
{
Line 2 "User Matched: "
$AllowedAccount
}
}
If($LoadBalancingPolicyFilter.DeniedAccounts)
{
ForEach($DeniedAccount in
$LoadBalancingPolicyFilter.DeniedAccounts)
{
Line 2 "User Ignored: "
$DeniedAccount
}
}
}
Line 0 ""
}
If($LoadBalancingPolicyConfiguration.WorkerGroupPreferenceAndFailoverState)
{
Line 1 "Configure application connection preference
based on worker group"
If($LoadBalancingPolicyConfiguration.WorkerGroupPreferences)
{
ForEach($WorkerGroupPreference in
$LoadBalancingPolicyConfiguration.WorkerGroupPreferences)
{
[string]$Tmp = $WorkerGroupPreference
[string]$WGName =
$Tmp.substring($Tmp.indexof("=")+1)
[string]$WGPriority =
$Tmp.substring($Tmp.indexof(":")+1, (($Tmp.indexof("=")-1)-$Tmp.indexof(":")))
Line 2 "Worker Group`t: " $WGName
Line 2 "Priority`t: " $WGPriority
Line 0 ""
}
$tmp = $Null
$WGName = $Null
$WGPriority = $Null
}
}
If($LoadBalancingPolicyConfiguration.StreamingDeliveryProtocolState -eq
"Enabled")
{
Line 1 "Set the delivery protocols for applications
streamed to client"
Line 2 "" -nonewline
Switch
($LoadBalancingPolicyConfiguration.StreamingDeliveryOption)
{
"Unknown" {Line 0
"Unknown"; Break}
"ForceServerAccess" {Line 0 "Do
not allow applications to stream to the client"; Break}
"ForcedStreamedDelivery" {Line 0 "Force
applications to stream to the client"; Break}
Default {Line
0 "Delivery protocol could not be determined: $
($LoadBalancingPolicyConfiguration.StreamingDeliveryOption)"; Break}
}
}
Elseif($LoadBalancingPolicyConfiguration.StreamingDeliveryProtocolState -eq
"Disabled")
{
#In the GUI, if "Set the delivery protocols for
applications streamed to client" IS selected AND
#"Allow applications to stream to the client or run
on a Terminal Server (Default)" IS selected
#then "Set the delivery protocols for applications
streamed to client" is set to Disabled
Line 1 "Set the delivery protocols for applications
streamed to client"
Line 2 "Allow applications to stream to the client or
run on a Terminal Server (Default)"
}
Else
{
Line 1 "Streamed App Delivery is not configured"
}
Line 0 ""
}
ElseIf($HTML)
{
WriteHTMLLine 2 0 $LoadBalancingPolicy.PolicyName
If(!
[String]::IsNullOrEmpty($LoadBalancingPolicy.Description))
{
WriteHTMLLine 0 1 "Description: "
$LoadBalancingPolicy.Description
}
If($LoadBalancingPolicy.Enabled)
{
$tmp = "Yes"
}
Else
{
$tmp = "No"
}
WriteHTMLLine 0 1 "Enabled: " $tmp
WriteHTMLLine 0 1 "Priority: "
$LoadBalancingPolicy.Priority
If($LoadBalancingPolicyFilter.AccessControlEnabled)
{
$tmp = "Yes"
}
Else
{
$tmp = "No"
}
WriteHTMLLine 0 1 "Filter based on Access Control: " $tmp
If($LoadBalancingPolicyFilter.AccessControlEnabled)
{
If($LoadBalancingPolicyFilter.AllowConnectionsThroughAccessGateway)
{
$tmp = "Yes"
}
Else
{
$tmp = "No"
}
WriteHTMLLine 0 1 "Apply to connections made through
Access Gateway: " $tmp
If($LoadBalancingPolicyFilter.AllowConnectionsThroughAccessGateway)
{
WriteHTMLLine 0 1 "Any connection that meets
any of the following filters"
If($LoadBalancingPolicyFilter.AccessSessionConditions)
{
ForEach($AccessSessionCondition in
$LoadBalancingPolicyFilter.AccessSessionConditions)
{
[string]$Tmp =
$AccessSessionCondition
[string]$AGFarm = $Tmp.substring(0,
$Tmp.indexof(":"))
[string]$AGFilter =
$Tmp.substring($Tmp.indexof(":")+1)
WriteHTMLLine 0 2 "FarmName: "
$AGFarm
WriteHTMLLine 0 2 "Filter: "
$AGFilter
WriteHTMLLine 0 0 ""
}
$tmp = $Null
$AGFarm = $Null
$AGFilter = $Null
}
}
If($LoadBalancingPolicyFilter.AllowOtherConnections)
{
WriteHTMLLine 0 2 "Apply to all other
connections"
}
}
If($LoadBalancingPolicyFilter.ClientIPAddressEnabled)
{
WriteHTMLLine 0 1 "Filter based on client IP address"
If($LoadBalancingPolicyFilter.ApplyToAllClientIPAddresses)
{
WriteHTMLLine 0 2 "Apply to all client IP
addresses"
}
Else
{
If($LoadBalancingPolicyFilter.AllowedIPAddresses)
{
ForEach($AllowedIPAddress in
$LoadBalancingPolicyFilter.AllowedIPAddresses)
{
WriteHTMLLine 0 2 "Client IP
Address Matched: " $AllowedIPAddress
}
}
If($LoadBalancingPolicyFilter.DeniedIPAddresses)
{
ForEach($DeniedIPAddress in
$LoadBalancingPolicyFilter.DeniedIPAddresses)
{
WriteHTMLLine 0 2 "Client IP
Address Ignored: " $DeniedIPAddress
}
}
}
}
If($LoadBalancingPolicyFilter.ClientNameEnabled)
{
WriteHTMLLine 0 1 "Filter based on client name"
If($LoadBalancingPolicyFilter.ApplyToAllClientNames)
{
WriteHTMLLine 0 2 "Apply to all client names"
}
Else
{
If($LoadBalancingPolicyFilter.AllowedClientNames)
{
ForEach($AllowedClientName in
$LoadBalancingPolicyFilter.AllowedClientNames)
{
WriteHTMLLine 0 2 "Client Name
Matched: " $AllowedClientName
}
}
If($LoadBalancingPolicyFilter.DeniedClientNames)
{
ForEach($DeniedClientName in
$LoadBalancingPolicyFilter.DeniedClientNames)
{
WriteHTMLLine 0 2 "Client Name
Ignored: " $DeniedClientName
}
}
}
}
If($LoadBalancingPolicyFilter.AccountEnabled)
{
WriteHTMLLine 0 1 "Filter based on user"
If($LoadBalancingPolicyFilter.ApplyToAnonymousAccounts)
{
$tmp = "Yes"
}
Else
{
$tmp = "No"
}
WriteHTMLLine 0 2 "Apply to anonymous users: " $tmp
If($LoadBalancingPolicyFilter.ApplyToAllExplicitAccounts)
{
WriteHTMLLine 0 2 "Apply to all explicit (non-
anonymous) users"
}
Else
{
If($LoadBalancingPolicyFilter.AllowedAccounts)
{
ForEach($AllowedAccount in
$LoadBalancingPolicyFilter.AllowedAccounts)
{
WriteHTMLLine 0 2 "User Matched: "
$AllowedAccount
}
}
If($LoadBalancingPolicyFilter.DeniedAccounts)
{
ForEach($DeniedAccount in
$LoadBalancingPolicyFilter.DeniedAccounts)
{
WriteHTMLLine 0 2 "User Ignored: "
$DeniedAccount
}
}
}
}
If($LoadBalancingPolicyConfiguration.WorkerGroupPreferenceAndFailoverState)
{
WriteHTMLLine 0 1 "Configure application connection
preference based on worker group"
If($LoadBalancingPolicyConfiguration.WorkerGroupPreferences)
{
ForEach($WorkerGroupPreference in
$LoadBalancingPolicyConfiguration.WorkerGroupPreferences)
{
[string]$Tmp = $WorkerGroupPreference
[string]$WGName =
$Tmp.substring($Tmp.indexof("=")+1)
[string]$WGPriority =
$Tmp.substring($Tmp.indexof(":")+1, (($Tmp.indexof("=")-1)-$Tmp.indexof(":")))
WriteHTMLLine 0 2 "Worker Group: "
$WGName
WriteHTMLLine 0 2 "Priority: "
$WGPriority
WriteHTMLLine 0 0 ""
}
$tmp = $Null
$WGName = $Null
$WGPriority = $Null
}
}
If($LoadBalancingPolicyConfiguration.StreamingDeliveryProtocolState -eq
"Enabled")
{
WriteHTMLLine 0 1 "Set the delivery protocols for
applications streamed to client"
Switch
($LoadBalancingPolicyConfiguration.StreamingDeliveryOption)
{
"Unknown" {$tmp =
"Unknown"; Break}
"ForceServerAccess" {$tmp = "Do
not allow applications to stream to the client"; Break}
"ForcedStreamedDelivery" {$tmp = "Force
applications to stream to the client"; Break}
Default {$tmp
= "Delivery protocol could not be determined: $
($LoadBalancingPolicyConfiguration.StreamingDeliveryOption)"; Break}
}
WriteHTMLLine 0 2 "" $tmp
}
Elseif($LoadBalancingPolicyConfiguration.StreamingDeliveryProtocolState -eq
"Disabled")
{
#In the GUI, if "Set the delivery protocols for
applications streamed to client" IS selected AND
#"Allow applications to stream to the client or run
on a Terminal Server (Default)" IS selected
#then "Set the delivery protocols for applications
streamed to client" is set to Disabled
WriteHTMLLine 0 1 "Set the delivery protocols for
applications streamed to client"
WriteHTMLLine 0 2 "Allow applications to stream to
the client or run on a Terminal Server (Default)"
}
Else
{
WriteHTMLLine 0 1 "Streamed App Delivery is not
configured"
}
$LoadBalancingPolicyConfiguration = $Null
$LoadBalancingPolicyFilter = $Null
WriteHTMLLine 0 0 ""
}
$LoadBalancingPolicyConfiguration = $Null
$LoadBalancingPolicyFilter = $Null
}
Else
{
If($MSWord -or $PDF)
{
WriteWordLine 0 0 $LoadBalancingPolicy.PolicyName
}
ElseIf($Text)
{
Line 0 $LoadBalancingPolicy.PolicyName
Line 0 ""
}
ElseIf($HTML)
{
WriteHTMLLine 0 0 $LoadBalancingPolicy.PolicyName
}
}
}
}
#endregion
Function OutputLoadEvaluators
{
Param([object] $LoadEvaluators)
If($MSWord -or $PDF)
{
$selection.InsertNewPage()
WriteWordLine 1 0 "Load Evaluators"
}
ElseIf($Text)
{
Line 0 "Load Evaluators"
}
ElseIf($HTML)
{
WriteHTMLLine 1 0 "Load Evaluators"
}
ForEach($LoadEvaluator in $LoadEvaluators)
{
$Script:TotalLoadEvaluators++
Write-Host "$(Get-Date): `t`tProcessing Load Evaluator $
($LoadEvaluator.LoadEvaluatorName)" -BackgroundColor Black -ForegroundColor Yellow
If(!$Summary)
{
If($MSWord -or $PDF)
{
WriteWordLine 2 0 $LoadEvaluator.LoadEvaluatorName
[System.Collections.Hashtable[]] $ScriptInformation = @()
$ScriptInformation += @{ Data = "Description"; Value =
$LoadEvaluator.Description; }
If($LoadEvaluator.IsBuiltIn)
{
$ScriptInformation += @{ Data = "Built-in Load
Evaluator"; Value = ""; }
}
Else
{
$ScriptInformation += @{ Data = "User created load
evaluator"; Value = ""; }
}
If($LoadEvaluator.ApplicationUserLoadEnabled)
{
$ScriptInformation += @{ Data = "Application User
Load Settings"; Value = ""; }
$ScriptInformation += @{ Data = " Report full
load when the # of users for this application equals"; Value =
$LoadEvaluator.ApplicationUserLoad; }
$ScriptInformation += @{ Data = " Application";
Value = $LoadEvaluator.ApplicationBrowserName; }
}
If($LoadEvaluator.ContextSwitchesEnabled)
{
$ScriptInformation += @{ Data = "Context Switches
Settings"; Value = ""; }
$ScriptInformation += @{ Data = " Report full
load when the # of context Switches per second is > than"; Value =
$LoadEvaluator.ContextSwitches[1]; }
$ScriptInformation += @{ Data = " Report no load
when the # of context Switches per second is <= to"; Value =
$LoadEvaluator.ContextSwitches[0]; }
}
If($LoadEvaluator.CpuUtilizationEnabled)
{
$ScriptInformation += @{ Data = "CPU Utilization
Settings"; Value = ""; }
$ScriptInformation += @{ Data = " Report full
load when the processor utilization % is > than"; Value =
$LoadEvaluator.CpuUtilization[1]; }
$ScriptInformation += @{ Data = " Report no load
when the processor utilization % is <= to"; Value =
$LoadEvaluator.CpuUtilization[0]; }
}
If($LoadEvaluator.DiskDataIOEnabled)
{
$ScriptInformation += @{ Data = "Disk Data I/O
Settings"; Value = ""; }
$ScriptInformation += @{ Data = " Report full
load when the total disk I/O in kbps is > than"; Value =
$LoadEvaluator.DiskDataIO[1]; }
$ScriptInformation += @{ Data = " Report no load
when the total disk I/O in kbps per second is <= to"; Value =
$LoadEvaluator.DiskDataIO[0]; }
}
If($LoadEvaluator.DiskOperationsEnabled)
{
$ScriptInformation += @{ Data = "Disk Operations
Settings"; Value = ""; }
$ScriptInformation += @{ Data = " Report full
load when the total # of R/W operations per second is > than"; Value =
$LoadEvaluator.DiskOperations[1]; }
$ScriptInformation += @{ Data = " Report no load
when the total # of R/W operations per second is <= to"; Value =
$LoadEvaluator.DiskOperations[0]; }
}
If($LoadEvaluator.IPRangesEnabled)
{
$ScriptInformation += @{ Data = "IP Range Settings";
Value = ""; }
If($LoadEvaluator.IPRangesAllowed)
{
$tmp - "Allow client connections from the
listed IP Ranges"
}
Else
{
$tmp = "Deny client connections from the listed
IP Ranges"
}
$ScriptInformation += @{ Data = $tmp; Value = ""; }
$ScriptInformation += @{ Data = "IP Address Ranges";
Value = $LoadEvaluator.IPRanges[0]; }
$cnt =-1
ForEach($IPRange in $LoadEvaluator.IPRanges)
{
$cnt++
If($cnt -gt 0)
{
$ScriptInformation += @{ Data = ""; Value
= $IPRange; }
}
}
$tmp = $Null
$cnt = $Null
}
If($LoadEvaluator.LoadThrottlingEnabled)
{
Switch ($LoadEvaluator.LoadThrottling)
{
"Unknown" {$tmp = "Unknown"; Break}
"Extreme" {$tmp = "Extreme"; Break}
"High" {$tmp = "High
(Default)"; Break}
"MediumHigh" {$tmp = "Medium High"; Break}
"Medium" {$tmp = "Medium"; Break}
"MediumLow" {$tmp = "Medium Low"; Break}
Default {$tmp = "Impact of
logons on load could not be determined: $($LoadEvaluator.LoadThrottling)"; Break}
}
$ScriptInformation += @{ Data = "Load Throttling
Settings"; Value = ""; }
$ScriptInformation += @{ Data = " Impact of
logons on load"; Value = $tmp; }
$tmp = $Null
}
If($LoadEvaluator.MemoryUsageEnabled)
{
$ScriptInformation += @{ Data = "Memory Usage
Settings"; Value = ""; }
$ScriptInformation += @{ Data = " Report full
load when the memory usage is > than"; Value = $LoadEvaluator.MemoryUsage[1]; }
$ScriptInformation += @{ Data = " Report no load
when the memory usage is <= to"; Value = $LoadEvaluator.MemoryUsage[0]; }
}
If($LoadEvaluator.PageFaultsEnabled)
{
$ScriptInformation += @{ Data = "Page Faults
Settings"; Value = ""; }
$ScriptInformation += @{ Data = " Report full
load when the # of page faults per second is > than"; Value =
$LoadEvaluator.PageFaults[1]; }
$ScriptInformation += @{ Data = " Report no load
when the # of page faults per second is <= to"; Value =
$LoadEvaluator.PageFaults[0]; }
}
If($LoadEvaluator.PageSwapsEnabled)
{
$ScriptInformation += @{ Data = "Page Swaps
Settings"; Value = ""; }
$ScriptInformation += @{ Data = " Report full
load when the # of page swaps per second is > than"; Value =
$LoadEvaluator.PageSwaps[1]; }
$ScriptInformation += @{ Data = " Report no load
when the # of page swaps per second is <= to"; Value = $LoadEvaluator.PageSwaps[0];
}
}
If($LoadEvaluator.ScheduleEnabled)
{
$ScriptInformation += @{ Data = "Scheduling
Settings"; Value = ""; }
$ScriptInformation += @{ Data = " Sunday
Schedule"; Value = $LoadEvaluator.SundaySchedule; }
$ScriptInformation += @{ Data = " Monday
Schedule"; Value = $LoadEvaluator.MondaySchedule; }
$ScriptInformation += @{ Data = " Tuesday
Schedule"; Value = $LoadEvaluator.TuesdaySchedule; }
$ScriptInformation += @{ Data = " Wednesday
Schedul"; Value = $LoadEvaluator.WednesdaySchedule; }
$ScriptInformation += @{ Data = " Thursday
Schedule"; Value = $LoadEvaluator.ThursdaySchedule; }
$ScriptInformation += @{ Data = " Friday
Schedule"; Value = $LoadEvaluator.FridaySchedule; }
$ScriptInformation += @{ Data = " Saturday
Schedule"; Value = $LoadEvaluator.SaturdaySchedule; }
}
If($LoadEvaluator.ServerUserLoadEnabled)
{
$ScriptInformation += @{ Data = "Server User Load
Settings"; Value = ""; }
$ScriptInformation += @{ Data = " Report full
load when the # of server users equals"; Value = $LoadEvaluator.ServerUserLoad; }
}
$Table.Columns.Item(1).Width = 325;
$Table.Columns.Item(2).Width = 175;
$Table.Rows.SetLeftIndent($Indent0TabStops,
$wdAdjustProportional)
FindWordDocumentEnd
$Table = $Null
WriteWordLine 0 0 ""
}
ElseIf($Text)
{
Line 0 $LoadEvaluator.LoadEvaluatorName
Line 1 "Description: " $LoadEvaluator.Description
If($LoadEvaluator.IsBuiltIn)
{
Line 1 "Built-in Load Evaluator"
}
Else
{
Line 1 "User created load evaluator"
}
If($LoadEvaluator.ApplicationUserLoadEnabled)
{
Line 1 "Application User Load Settings"
Line 2 "Report full load when the # of users for this
application equals: " $LoadEvaluator.ApplicationUserLoad
Line 2 "Application: "
$LoadEvaluator.ApplicationBrowserName
}
If($LoadEvaluator.ContextSwitchesEnabled)
{
Line 1 "Context Switches Settings"
Line 2 "Report full load when the # of context
Switches per second is > than: " $LoadEvaluator.ContextSwitches[1]
Line 2 "Report no load when the # of context Switches
per second is <= to: " $LoadEvaluator.ContextSwitches[0]
}
If($LoadEvaluator.CpuUtilizationEnabled)
{
Line 1 "CPU Utilization Settings"
Line 2 "Report full load when the processor
utilization % is > than: " $LoadEvaluator.CpuUtilization[1]
Line 2 "Report no load when the processor utilization
% is <= to: " $LoadEvaluator.CpuUtilization[0]
}
If($LoadEvaluator.DiskDataIOEnabled)
{
Line 1 "Disk Data I/O Settings"
Line 2 "Report full load when the total disk I/O in
kbps is > than: " $LoadEvaluator.DiskDataIO[1]
Line 2 "Report no load when the total disk I/O in
kbps per second is <= to: " $LoadEvaluator.DiskDataIO[0]
}
If($LoadEvaluator.DiskOperationsEnabled)
{
Line 1 "Disk Operations Settings"
Line 2 "Report full load when the total # of R/W
operations per second is > than: " $LoadEvaluator.DiskOperations[1]
Line 2 "Report no load when the total # of R/W
operations per second is <= to: " $LoadEvaluator.DiskOperations[0]
}
If($LoadEvaluator.IPRangesEnabled)
{
Line 1 "IP Range Settings"
If($LoadEvaluator.IPRangesAllowed)
{
Line 2 "Allow " -NoNewLine
}
Else
{
Line 2 "Deny " -NoNewLine
}
Line 0 "client connections from the listed IP Ranges"
ForEach($IPRange in $LoadEvaluator.IPRanges)
{
Line 3 "IP Address Ranges: " $IPRange
}
}
If($LoadEvaluator.LoadThrottlingEnabled)
{
Line 1 "Load Throttling Settings"
Line 2 "Impact of logons on load: " -nonewline
Switch ($LoadEvaluator.LoadThrottling)
{
"Unknown" {Line 0 "Unknown"; Break}
"Extreme" {Line 0 "Extreme"; Break}
"High" {Line 0 "High
(Default)"; Break}
"MediumHigh" {Line 0 "Medium High"; Break}
"Medium" {Line 0 "Medium"; Break}
"MediumLow" {Line 0 "Medium Low"; Break}
Default {Line 0 "Impact of
logons on load could not be determined: $($LoadEvaluator.LoadThrottling)"; Break}
}
}
If($LoadEvaluator.MemoryUsageEnabled)
{
Line 1 "Memory Usage Settings"
Line 2 "Report full load when the memory usage is >
than: " $LoadEvaluator.MemoryUsage[1]
Line 2 "Report no load when the memory usage is <=
to: " $LoadEvaluator.MemoryUsage[0]
}
If($LoadEvaluator.PageFaultsEnabled)
{
Line 1 "Page Faults Settings"
Line 2 "Report full load when the # of page faults
per second is > than: " $LoadEvaluator.PageFaults[1]
Line 2 "Report no load when the # of page faults per
second is <= to: " $LoadEvaluator.PageFaults[0]
}
If($LoadEvaluator.PageSwapsEnabled)
{
Line 1 "Page Swaps Settings"
Line 2 "Report full load when the # of page swaps per
second is > than: " $LoadEvaluator.PageSwaps[1]
Line 2 "Report no load when the # of page swaps per
second is <= to: " $LoadEvaluator.PageSwaps[0]
}
If($LoadEvaluator.ScheduleEnabled)
{
Line 1 "Scheduling Settings"
Line 2 "Sunday Schedule`t: "
$LoadEvaluator.SundaySchedule
Line 2 "Monday Schedule`t: "
$LoadEvaluator.MondaySchedule
Line 2 "Tuesday Schedule`t: "
$LoadEvaluator.TuesdaySchedule
Line 2 "Wednesday Schedule`t: "
$LoadEvaluator.WednesdaySchedule
Line 2 "Thursday Schedule`t: "
$LoadEvaluator.ThursdaySchedule
Line 2 "Friday Schedule`t`t: "
$LoadEvaluator.FridaySchedule
Line 2 "Saturday Schedule`t: "
$LoadEvaluator.SaturdaySchedule
}
If($LoadEvaluator.ServerUserLoadEnabled)
{
Line 1 "Server User Load Settings"
Line 2 "Report full load when the # of server users
equals: " $LoadEvaluator.ServerUserLoad
}
Line 0 ""
}
ElseIf($HTML)
{
WriteHTMLLine 2 0 $LoadEvaluator.LoadEvaluatorName
$columnHeaders = @()
$rowdata = @()
$columnHeaders = @("Description",($htmlsilver -bor
$htmlbold),$LoadEvaluator.Description,$htmlwhite)
If($LoadEvaluator.IsBuiltIn)
{
$rowdata += @(,("Built-in Load Evaluator",
($htmlsilver -bor $htmlbold),"",$htmlwhite))
}
Else
{
$rowdata += @(,("User created load evaluator",
($htmlsilver -bor $htmlbold),"",$htmlwhite))
}
If($LoadEvaluator.ApplicationUserLoadEnabled)
{
$rowdata += @(,("Application User Load Settings",
($htmlsilver -bor $htmlbold),"",$htmlwhite))
$rowdata += @(,(" Report full load when the # of
users for this application equals",($htmlsilver -bor $htmlbold),
$LoadEvaluator.ApplicationUserLoad,$htmlwhite))
$rowdata += @(,(" Application",($htmlsilver -bor
$htmlbold),$LoadEvaluator.ApplicationBrowserName,$htmlwhite))
}
If($LoadEvaluator.ContextSwitchesEnabled)
{
$rowdata += @(,("Context Switches Settings",
($htmlsilver -bor $htmlbold),"",$htmlwhite))
$rowdata += @(,(" Report full load when the # of
context Switches per second is > than",($htmlsilver -bor $htmlbold),
$LoadEvaluator.ContextSwitches[1],$htmlwhite))
$rowdata += @(,(" Report no load when the # of
context Switches per second is <= to",($htmlsilver -bor $htmlbold),
$LoadEvaluator.ContextSwitches[0],$htmlwhite))
}
If($LoadEvaluator.CpuUtilizationEnabled)
{
$rowdata += @(,("CPU Utilization Settings",
($htmlsilver -bor $htmlbold),"",$htmlwhite))
$rowdata += @(,(" Report full load when the
processor utilization % is > than",($htmlsilver -bor $htmlbold),
$LoadEvaluator.CpuUtilization[1],$htmlwhite))
$rowdata += @(,(" Report no load when the processor
utilization % is <= to",($htmlsilver -bor $htmlbold),
$LoadEvaluator.CpuUtilization[0],$htmlwhite))
}
If($LoadEvaluator.DiskDataIOEnabled)
{
$rowdata += @(,("Disk Data I/O Settings",($htmlsilver
-bor $htmlbold),"",$htmlwhite))
$rowdata += @(,(" Report full load when the total
disk I/O in kbps is > than",($htmlsilver -bor $htmlbold),
$LoadEvaluator.DiskDataIO[1],$htmlwhite))
$rowdata += @(,(" Report no load when the total disk
I/O in kbps per second is <= to",($htmlsilver -bor $htmlbold),
$LoadEvaluator.DiskDataIO[0],$htmlwhite))
}
If($LoadEvaluator.DiskOperationsEnabled)
{
$rowdata += @(,("Disk Operations Settings",
($htmlsilver -bor $htmlbold),"",$htmlwhite))
$rowdata += @(,(" Report full load when the total #
of R/W operations per second is > than",($htmlsilver -bor $htmlbold),
$LoadEvaluator.DiskOperations[1],$htmlwhite))
$rowdata += @(,(" Report no load when the total # of
R/W operations per second is <= to",($htmlsilver -bor $htmlbold),
$LoadEvaluator.DiskOperations[0],$htmlwhite))
}
If($LoadEvaluator.IPRangesEnabled)
{
$rowdata += @(,("IP Range Settings",($htmlsilver -bor
$htmlbold),"",$htmlwhite))
If($LoadEvaluator.IPRangesAllowed)
{
$tmp - "Allow client connections from the
listed IP Ranges"
}
Else
{
$tmp = "Deny client connections from the listed
IP Ranges"
}
$rowdata += @(,($tmp,($htmlsilver -bor $htmlbold),"",
$htmlwhite))
$rowdata += @(,("IP Address Ranges",($htmlsilver -bor
$htmlbold),$LoadEvaluator.IPRanges[0],$htmlwhite))
$cnt =-1
ForEach($IPRange in $LoadEvaluator.IPRanges)
{
$cnt++
If($cnt -gt 0)
{
$rowdata += @(,("",($htmlsilver -bor
$htmlbold),$IPRange,$htmlwhite))
}
}
$tmp = $Null
$cnt = $Null
}
If($LoadEvaluator.LoadThrottlingEnabled)
{
Switch ($LoadEvaluator.LoadThrottling)
{
"Unknown" {$tmp = "Unknown"; Break}
"Extreme" {$tmp = "Extreme"; Break}
"High" {$tmp = "High
(Default)"; Break}
"MediumHigh" {$tmp = "Medium High"; Break}
"Medium" {$tmp = "Medium"; Break}
"MediumLow" {$tmp = "Medium Low"; Break}
Default {$tmp = "Impact of
logons on load could not be determined: $($LoadEvaluator.LoadThrottling)"; Break}
}
$rowdata += @(,("Load Throttling Settings",
($htmlsilver -bor $htmlbold),"",$htmlwhite))
$rowdata += @(,(" Impact of logons on load",
($htmlsilver -bor $htmlbold),$tmp,$htmlwhite))
$tmp = $Null
}
If($LoadEvaluator.MemoryUsageEnabled)
{
$rowdata += @(,("Memory Usage Settings",($htmlsilver
-bor $htmlbold),"",$htmlwhite))
$rowdata += @(,(" Report full load when the memory
usage is > than",($htmlsilver -bor $htmlbold),$LoadEvaluator.MemoryUsage[1],
$htmlwhite))
$rowdata += @(,(" Report no load when the memory
usage is <= to",($htmlsilver -bor $htmlbold),$LoadEvaluator.MemoryUsage[0],
$htmlwhite))
}
If($LoadEvaluator.PageFaultsEnabled)
{
$rowdata += @(,("Page Faults Settings",($htmlsilver
-bor $htmlbold),"",$htmlwhite))
$rowdata += @(,(" Report full load when the # of
page faults per second is > than",($htmlsilver -bor $htmlbold),
$LoadEvaluator.PageFaults[1],$htmlwhite))
$rowdata += @(,(" Report no load when the # of page
faults per second is <= to",($htmlsilver -bor $htmlbold),
$LoadEvaluator.PageFaults[0],$htmlwhite))
}
If($LoadEvaluator.PageSwapsEnabled)
{
$rowdata += @(,("Page Swaps Settings",($htmlsilver
-bor $htmlbold),"",$htmlwhite))
$rowdata += @(,(" Report full load when the # of
page swaps per second is > than",($htmlsilver -bor $htmlbold),
$LoadEvaluator.PageSwaps[1],$htmlwhite))
$rowdata += @(,(" Report no load when the # of page
swaps per second is <= to",($htmlsilver -bor $htmlbold),
$LoadEvaluator.PageSwaps[0],$htmlwhite))
}
If($LoadEvaluator.ScheduleEnabled)
{
$rowdata += @(,("Scheduling Settings",($htmlsilver
-bor $htmlbold),"",$htmlwhite))
$rowdata += @(,(" Sunday Schedule",($htmlsilver -bor
$htmlbold),$LoadEvaluator.SundaySchedule,$htmlwhite))
$rowdata += @(,(" Monday Schedule",($htmlsilver -bor
$htmlbold),$LoadEvaluator.MondaySchedule,$htmlwhite))
$rowdata += @(,(" Tuesday Schedule",($htmlsilver
-bor $htmlbold),$LoadEvaluator.TuesdaySchedule,$htmlwhite))
$rowdata += @(,(" Wednesday Schedul",($htmlsilver
-bor $htmlbold),$LoadEvaluator.WednesdaySchedule,$htmlwhite))
$rowdata += @(,(" Thursday Schedule",($htmlsilver
-bor $htmlbold),$LoadEvaluator.ThursdaySchedule,$htmlwhite))
$rowdata += @(,(" Friday Schedule",($htmlsilver -bor
$htmlbold),$LoadEvaluator.FridaySchedule,$htmlwhite))
$rowdata += @(,(" Saturday Schedule",($htmlsilver
-bor $htmlbold),$LoadEvaluator.SaturdaySchedule,$htmlwhite))
}
If($LoadEvaluator.ServerUserLoadEnabled)
{
$rowdata += @(,("Server User Load Settings",
($htmlsilver -bor $htmlbold),"",$htmlwhite))
$rowdata += @(,(" Report full load when the # of
server users equals",($htmlsilver -bor $htmlbold),$LoadEvaluator.ServerUserLoad,
$htmlwhite))
}
$msg = ""
$columnWidths = @("325","175")
FormatHTMLTable $msg -rowArray $rowdata -columnArray
$columnHeaders -fixedWidth $columnWidths
WriteHTMLLine 0 0 ""
}
}
Else
{
If($MSWord -or $PDF)
{
WriteWordLine 0 0 $LoadEvaluator.LoadEvaluatorName
}
ElseIf($Text)
{
Line 0 $LoadEvaluator.LoadEvaluatorName
}
ElseIf($HTML)
{
WriteHTMLLine 0 0 $LoadEvaluator.LoadEvaluatorName
}
}
}
}
#endregion
ForEach($server in $servers)
{
Write-Host "$(Get-Date): `t`tProcessing server $($server.ServerName)"
-BackgroundColor Black -ForegroundColor Yellow
If(!$Summary)
{
[bool]$SvrOnline = $False
Write-Host "$(Get-Date): `t`t`tTesting to see if $
($server.ServerName) is online and reachable" -BackgroundColor Black
-ForegroundColor Yellow
If(Test-Connection -ComputerName $server.servername -quiet -EA 0)
{
$SvrOnline = $True
If($Hardware -and $Software)
{
Write-Host "$(Get-Date): `t`t`t`t$
($server.ServerName) is online." -BackgroundColor Black -ForegroundColor Yellow
Write-Host "$(Get-Date): `t`t`t`tHardware and
Software Inventory, Citrix Services and Hotfix areas will be processed."
-BackgroundColor Black -ForegroundColor Yellow
}
ElseIf($Hardware -and !($Software))
{
Write-Host "$(Get-Date): `t`t`t`t$
($server.ServerName) is online." -BackgroundColor Black -ForegroundColor Yellow
Write-Host "$(Get-Date): `t`t`t`tHardware inventory,
Citrix Services and Hotfix areas will be processed." -BackgroundColor Black
-ForegroundColor Yellow
}
ElseIf(!($Hardware) -and $Software)
{
Write-Host "$(Get-Date): `t`t`t`t$
($server.ServerName) is online." -BackgroundColor Black -ForegroundColor Yellow
Write-Host "$(Get-Date): `t`t`t`tSoftware Inventory,
Citrix Services and Hotfix areas will be processed." -BackgroundColor Black
-ForegroundColor Yellow
}
Else
{
Write-Host "$(Get-Date): `t`t`t`t$
($server.ServerName) is online." -BackgroundColor Black -ForegroundColor Yellow
Write-Host "$(Get-Date): `t`t`t`tCitrix Services and
Hotfix areas will be processed." -BackgroundColor Black -ForegroundColor Yellow
}
}
If($SvrOnline)
{
$Reg =
[Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine',
$server.ServerName)
Try
{
$RegKey=
$Reg.OpenSubKey("SYSTEM\\CurrentControlSet\\Control\\Citrix\\Wfshell\\TWI")
$SSDisabled = $RegKey.GetValue("SeamlessFlags")
If($SSDisabled -eq 1)
{
$obj | Add-Member -MemberType NoteProperty
-Name SessionSharing -Value "Disabled"
}
Else
{
$obj | Add-Member -MemberType NoteProperty
-Name SessionSharing -Value "Enabled"
}
}
Catch
{
$obj | Add-Member -MemberType NoteProperty
-Name SessionSharing -Value "Not Available"
}
}
Else
{
$obj | Add-Member -MemberType NoteProperty -Name
SessionSharing -Value "Server Offline"
}
$Script:ServerItems += $obj
Switch ($server.ElectionPreference)
{
"Unknown" {$tmp = "Unknown"; Break}
"MostPreferred" {$tmp = "Most Preferred";
$Script:TotalControllers++; Break}
"Preferred" {$tmp = "Preferred";
$Script:TotalControllers++; Break}
"DefaultPreference" {$tmp = "Default Preference";
$Script:TotalControllers++; Break}
"NotPreferred" {$tmp = "Not Preferred";
$Script:TotalControllers++; Break}
"WorkerMode" {$tmp = "Worker Mode";
$Script:TotalWorkers++; Break}
Default {$tmp = "Server election
preference could not be determined: $($server.ElectionPreference)"; Break}
}
If($server.LicenseServerName)
{
$ScriptInformation += @{ Data = "License Server
Name"; Value = $server.LicenseServerName; }
$ScriptInformation += @{ Data = "License Server
Port"; Value = $server.LicenseServerPortNumber; }
}
If($server.ICAPortNumber -gt 0)
{
$ScriptInformation += @{ Data = "ICA Port Number";
Value = $server.ICAPortNumber; }
}
$ScriptInformation += @{ Data = "Product Installation
Date"; Value = $server.CitrixInstallDate; }
$ScriptInformation += @{ Data = "Operating System Version";
Value = "$($server.OSVersion) $($server.OSServicePack)"; }
$ScriptInformation += @{ Data = "Zone"; Value =
$server.ZoneName; }
$ScriptInformation += @{ Data = "Election Preference";
Value = $tmp; }
$ScriptInformation += @{ Data = "Folder"; Value =
$server.FolderPath; }
$ScriptInformation += @{ Data = "Product Installation
Path"; Value = $server.CitrixInstallPath; }
$tmp = $Null
$Table.Columns.Item(1).Width = 250;
$Table.Columns.Item(2).Width = 250;
$Table.Rows.SetLeftIndent($Indent0TabStops,
$wdAdjustProportional)
FindWordDocumentEnd
$Table = $Null
WriteWordLine 0 0 ""
[int]$Rows = $Applications.count + 1
FindWordDocumentEnd
WriteWordLine 0 0 ""
}
$UninstallKey1="SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"
$UninstallKey2="SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstal
l"
$regkey2=$reg.OpenSubKey($UninstallKey2)
If($Null -ne $regkey2)
{
$subkeys2=$regkey2.GetSubKeyNames()
ForEach($key in $subkeys2)
{
$thisKey=$UninstallKey2+"\\"+$key
$thisSubKey=$reg.OpenSubKey($thisKey)
if(![String]::IsNullOrEmpty($
($thisSubKey.GetValue("DisplayName"))))
{
$obj = New-Object PSObject
$obj | Add-Member -MemberType
NoteProperty -Name "DisplayName" -Value $($thisSubKey.GetValue("DisplayName"))
$obj | Add-Member -MemberType
NoteProperty -Name "DisplayVersion" -Value $
($thisSubKey.GetValue("DisplayVersion"))
$InstalledApps += $obj
}
}
}
$tmp1 = SWExclusions
If($Tmp1 -ne "")
{
$Func = ConvertTo-ScriptBlock $tmp1
$tempapps = Invoke-Command {& $Func}
}
Else
{
$tempapps = $InstalledApps
}
FindWordDocumentEnd
WriteWordLine 0 0 ""
}
Try
{
#Iain Brighton optimization 5-Jun-2014
#Replaced with a single call to retrieve
services via WMI. The repeated
## "Get-WMIObject Win32_Service -Filter" calls
were the major delays in the script.
## If we need to retrieve the StartUp type
might as well just use WMI.
$Services = @(Get-WMIObject Win32_Service
-ComputerName $server.ServerName -EA 0 | Where-Object {$_.DisplayName -like
"*Citrix*"} | Sort-Object DisplayName)
}
Catch
{
$Services = $Null
}
ForEach($Service in $Services)
{
#Write-Host "$(Get-Date): `t`t`t
Processing service $($Service.DisplayName)";
FindWordDocumentEnd
$Table = $Null
WriteWordLine 0 0 ""
}
ElseIf(!$?)
{
Write-Warning "No services were retrieved."
WriteWordLine 0 0 "Warning: No Services were
retrieved" "" $Null 0 $False $True
WriteWordLine 0 1 "If this is a trusted Forest,
you may need to rerun the" "" $Null 0 $False $True
WriteWordLine 0 1 "script with Admin
credentials from the trusted Forest." "" $Null 0 $False $True
}
Else
{
Write-Warning "Services retrieval was
successful but no services were returned."
WriteWordLine 0 0 "Services retrieval was
successful but no services were returned." "" $Null 0 $False $True
}
#Citrix hotfixes installed
Write-Host "$(Get-Date): `t`tGet list of Citrix
hotfixes installed using Get-XAServerHotfix" -BackgroundColor Black
-ForegroundColor Yellow
Write-Host "$(Get-Date): `t`tGet list of Citrix
hotfixes installed using Get-XAServerHotfix" -BackgroundColor Black
-ForegroundColor Yellow
Try
{
$hotfixes = @((Get-XAServerHotfix -ServerName
$server.ServerName -EA 0 | Where-Object {$_.Valid -eq $True}) | Sort-Object
HotfixName)
}
Catch
{
$hotfixes = $Null
}
WriteWordLine 0 0 ""
WriteWordLine 0 1 "Citrix Installed Hotfixes ($
($Rows-1)):"
## Create an array of hashtables to store our
hotfixes
[System.Collections.Hashtable[]]
$hotfixesWordTable = @();
## Seed the row index from the second row
[int] $CurrentServiceIndex = 2;
ForEach($hotfix in $hotfixes)
{
$HotfixArray += $hotfix.HotfixName
Switch ($hotfix.HotfixName)
{
"XA650W2K8R2X64R02" {$HRP2Installed
= $True; Break}
"XA650W2K8R2X64R03" {$HRP3Installed
= $True; Break}
"XA650W2K8R2X64R04" {$HRP4Installed
= $True; Break}
"XA650W2K8R2X64R05" {$HRP5Installed
= $True; Break}
"XA650W2K8R2X64R06" {$HRP6Installed
= $True; Break}
"XA650W2K8R2X64R07" {$HRP7Installed
= $True; Break}
}
$InstallDate =
$hotfix.InstalledOn.ToString()
$CurrentServiceIndex++;
}
FindWordDocumentEnd
$Table = $Null
WriteWordLine 0 0 ""
If($RecommendedList.count -gt 0)
{
WriteWordLine 0 1 "Citrix Recommended
Hotfixes:"
## Create an array of hashtables to store
our hotfixes
[System.Collections.Hashtable[]]
$HotfixesWordTable = @();
## Create an array of hashtables to store
references of cells that we wish to highlight after the table has been added
[System.Collections.Hashtable[]]
$HighlightedCells = @();
## Seed the row index from the second row
[int] $CurrentServiceIndex = 2;
ForEach($element in $RecommendedList)
{
$Tmp = $Null
If(!($HotfixArray -contains
$element))
{
#missing a recommended Citrix
hotfix
$Tmp = "Not Installed"
}
Else
{
$Tmp = "Installed"
}
## Add the required key/values to
the hashtable
$WordTableRowHash = @{ CitrixHotfix
= $element; Status = $Tmp}
$Table.Rows.SetLeftIndent($Indent1TabStops,$wdAdjustProportional)
FindWordDocumentEnd
$Table = $Null
WriteWordLine 0 0 ""
}
#build list of installed Microsoft hotfixes
Write-Host "$(Get-Date): `t`tProcessing
Microsoft hotfixes for server $($server.ServerName)" -BackgroundColor Black
-ForegroundColor Yellow
[bool]$GotMSHotfixes = $True
Try
{
$results = Get-HotFix -computername
$Server.ServerName
$MSInstalledHotfixes = $results | select-
object -Expand HotFixID | Sort-Object HotFixID
$results = $Null
}
Catch
{
$GotMSHotfixes = $False
}
If($GotMSHotfixes)
{
If($server.OSServicePack.IndexOf('1') -gt
0)
{
#Server 2008 R2 SP1 installed
$RecommendedList = @("KB2620656",
"KB2647753", "KB2728738", "KB2748302",
"KB2775511",
"KB2778831", "KB2871131", "KB2896256",
"KB2908190",
"KB2920289", "KB917607")
}
Else
{
#Server 2008 R2 without SP1
installed
$RecommendedList = @("KB2265716",
"KB2383928", "KB2647753", "KB2728738",
"KB2748302",
"KB2775511", "KB2778831", "KB2871131",
"KB2896256",
"KB3014783", "KB917607", "KB975777",
"KB979530",
"KB980663", "KB983460")
}
If($RecommendedList.count -gt 0)
{
WriteWordLine 0 1 "Microsoft
Recommended Hotfixes (from CTX129229):"
## Create an array of hashtables to
store our hotfixes
[System.Collections.Hashtable[]]
$HotfixesWordTable = @();
## Create an array of hashtables to
store references of cells that we wish to highlight after the table has been added
[System.Collections.Hashtable[]]
$HighlightedCells = @();
## Seed the row index from the
second row
[int] $CurrentServiceIndex = 2;
ForEach($hotfix in
$RecommendedList)
{
$Tmp = $Null
If(!($MSInstalledHotfixes
-contains $hotfix))
{
$Tmp = "Not Installed"
}
Else
{
$Tmp = "Installed"
}
## Add the required
key/values to the hashtable
$WordTableRowHash =
@{ MicrosoftHotfix = $hotfix; Status = $Tmp}
$Table.Columns.Item(1).Width = 125;
$Table.Columns.Item(2).Width = 100;
$Table.Rows.SetLeftIndent($Indent1TabStops,$wdAdjustProportional)
FindWordDocumentEnd
$Table = $Null
WriteWordLine 0 1 "Not all missing
Microsoft hotfixes may be needed for this server `n`tor might already be replaced
and not recorded in CTX129229." -FontSize 8 -BoldFace $True
WriteWordLine 0 0 ""
}
}
Else
{
Write-Host "$(Get-Date): Get-HotFix
failed for $($server.ServerName)" -BackgroundColor Black -ForegroundColor Yellow
Write-Warning "Get-HotFix failed for $
($server.ServerName)"
WriteWordLine 0 0 "Get-HotFix failed for
$($server.ServerName)" "" $Null 0 $False $True
WriteWordLine 0 0 "On $
($server.ServerName) you may need to run winmgmt /verifyrepository and winmgmt
/salvagerepository"
}
}
ElseIf(!$?)
{
Write-Warning "No Citrix hotfixes were
retrieved"
WriteWordLine 0 0 "Warning: No Citrix hotfixes
were retrieved" "" $Null 0 $False $True
}
Else
{
Write-Warning "Citrix hotfix retrieval was
successful but no Citrix hotfixes were returned."
WriteWordLine 0 0 "Citrix hotfix retrieval was
successful but no Citrix hotfixes were returned." "" $Null 0 $False $True
}
}
Else
{
Write-Host "$(Get-Date): `t`t$($server.ServerName) is
offline or unreachable. Citrix Services and Hotfix areas skipped."
-BackgroundColor Black -ForegroundColor Yellow
WriteWordLine 0 0 "Server $($server.ServerName) was
offline or unreachable at "(Get-date).ToString()
WriteWordLine 0 0 "The Citrix Services and Hotfix
areas were skipped."
}
WriteWordLine 0 0 ""
}
ElseIf($Text)
{
Line 0 $server.ServerName
If($server.LogOnsEnabled)
{
$tmp = "Enabled"
}
Else
{
$tmp = "Disabled"
}
Switch ($Server.LogOnMode)
{
"Unknown" {$tmp2 = "Unknown";
Break}
"AllowLogOns" {$tmp2 = "Allow
logons and reconnections"; Break}
"ProhibitNewLogOnsUntilRestart" {$tmp2 = "Prohibit
logons until server restart"; Break}
"ProhibitNewLogOns " {$tmp2 = "Prohibit
logons only"; Break}
"ProhibitLogOns " {$tmp2 = "Prohibit
logons and reconnections"; Break}
Default {$tmp2
= "Logon control mode could not be determined: $($Server.LogOnMode)"; Break}
}
Line 1 "Product`t`t`t`t: " $server.CitrixProductName
Line 1 "Edition`t`t`t`t: " $server.CitrixEdition
Line 1 "Version`t`t`t`t: " $server.CitrixVersion
Line 1 "Service Pack`t`t`t: " $server.CitrixServicePack
Line 1 "IP Address`t`t`t: " $server.IPAddresses
Line 1 "Logons`t`t`t`t: " $tmp
Line 1 "Logon Control Mode`t`t: " $tmp2
$tmp = $Null
$tmp2 = $Null
Switch ($server.ElectionPreference)
{
"Unknown" {$tmp = "Unknown"; Break}
"MostPreferred" {$tmp = "Most Preferred";
$Script:TotalControllers++; Break}
"Preferred" {$tmp = "Preferred";
$Script:TotalControllers++; Break}
"DefaultPreference" {$tmp = "Default Preference";
$Script:TotalControllers++; Break}
"NotPreferred" {$tmp = "Not Preferred";
$Script:TotalControllers++; Break}
"WorkerMode" {$tmp = "Worker Mode";
$Script:TotalWorkers++; Break}
Default {$tmp = "Server election
preference could not be determined: $($server.ElectionPreference)"; Break}
}
If($server.LicenseServerName)
{
Line 1 "License Server Name`t`t: "
$server.LicenseServerName
Line 1 "License Server Port`t`t: "
$server.LicenseServerPortNumber
}
If($server.ICAPortNumber -gt 0)
{
Line 1 "ICA Port Number`t`t`t: "
$server.ICAPortNumber
}
Line 1 "Product Installation Date`t: "
$server.CitrixInstallDate
Line 1 "Operating System Version`t: $($server.OSVersion) $
($server.OSServicePack)"
Line 1 "Zone`t`t`t`t: " $server.ZoneName
Line 1 "Election Preference`t`t: " $tmp
Line 1 "Folder`t`t`t`t: " $server.FolderPath
Line 1 "Product Installation Path`t: "
$server.CitrixInstallPath
$tmp = $Null
Line 0 ""
$UninstallKey1="SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"
$reg=[microsoft.win32.registrykey]::OpenRemoteBaseKey('LocalMachine',
$Server.ServerName)
$UninstallKey2="SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstal
l"
$regkey2=$reg.OpenSubKey($UninstallKey2)
If($Null -ne $regkey2)
{
$subkeys2=$regkey2.GetSubKeyNames()
ForEach($key in $subkeys2)
{
$thisKey=$UninstallKey2+"\\"+$key
$thisSubKey=$reg.OpenSubKey($thisKey)
if(![String]::IsNullOrEmpty($
($thisSubKey.GetValue("DisplayName"))))
{
$obj = New-Object PSObject
$obj | Add-Member -MemberType
NoteProperty -Name "DisplayName" -Value $($thisSubKey.GetValue("DisplayName"))
$obj | Add-Member -MemberType
NoteProperty -Name "DisplayVersion" -Value $
($thisSubKey.GetValue("DisplayVersion"))
$InstalledApps += $obj
}
}
}
$tmp1 = SWExclusions
If($Tmp1 -ne "")
{
$Func = ConvertTo-ScriptBlock $tmp1
$tempapps = Invoke-Command {& $Func}
}
Else
{
$tempapps = $InstalledApps
}
Try
{
#Iain Brighton optimization 5-Jun-2014
#Replaced with a single call to retrieve
services via WMI. The repeated
## "Get-WMIObject Win32_Service -Filter" calls
were the major delays in the script.
## If we need to retrieve the StartUp type
might as well just use WMI.
$Services = @(Get-WMIObject Win32_Service
-ComputerName $server.ServerName -EA 0 | Where-Object {$_.DisplayName -like
"*Citrix*"} | Sort-Object DisplayName)
}
Catch
{
$Services = $Null
}
ForEach($Service in $Services)
{
Line 2 "Display Name`t: "
$Service.DisplayName
Line 2 "Status`t`t: " $Service.State
Line 2 "Startup Type`t: "
$Service.StartMode
Line 0 ""
}
}
ElseIf(!$?)
{
Write-Warning "No services were retrieved."
Line 0 "Warning: No Services were retrieved"
Line 1 "If this is a trusted Forest, you may
need to rerun the"
Line 1 "script with Admin credentials from the
trusted Forest."
}
Else
{
Write-Warning "Services retrieval was
successful but no services were returned."
Line 0 "Services retrieval was successful but
no services were returned."
}
Catch
{
$hotfixes = $Null
}
Line 0 ""
Line 1 "Citrix Installed Hotfixes ($($Rows)):"
ForEach($hotfix in $hotfixes)
{
$HotfixArray += $hotfix.HotfixName
Switch ($hotfix.HotfixName)
{
"XA650W2K8R2X64R02" {$HRP2Installed
= $True; Break}
"XA650W2K8R2X64R03" {$HRP3Installed
= $True; Break}
"XA650W2K8R2X64R04" {$HRP4Installed
= $True; Break}
"XA650W2K8R2X64R05" {$HRP5Installed
= $True; Break}
"XA650W2K8R2X64R06" {$HRP6Installed
= $True; Break}
"XA650W2K8R2X64R07" {$HRP7Installed
= $True; Break}
}
$InstallDate =
$hotfix.InstalledOn.ToString()
If($RecommendedList.count -gt 0)
{
Line 1 "Citrix Recommended Hotfixes:"
ForEach($element in $RecommendedList)
{
$Tmp = $Null
If(!($HotfixArray -contains
$element))
{
#missing a recommended Citrix
hotfix
$Tmp = "Not Installed"
}
Else
{
$Tmp = "Installed"
}
Line 2 "Citrix Hotfix`t: " $element
Line 2 "Status`t`t: " $Tmp
Line 0 ""
}
}
#build list of installed Microsoft hotfixes
Write-Host "$(Get-Date): `t`tProcessing
Microsoft hotfixes for server $($server.ServerName)" -BackgroundColor Black
-ForegroundColor Yellow
[bool]$GotMSHotfixes = $True
Try
{
$results = Get-HotFix -computername
$Server.ServerName
$MSInstalledHotfixes = $results | select-
object -Expand HotFixID | Sort-Object HotFixID
$results = $Null
}
Catch
{
$GotMSHotfixes = $False
}
If($GotMSHotfixes)
{
If($server.OSServicePack.IndexOf('1') -gt
0)
{
#Server 2008 R2 SP1 installed
$RecommendedList = @("KB2620656",
"KB2647753", "KB2728738", "KB2748302",
"KB2775511",
"KB2778831", "KB2871131", "KB2896256",
"KB2908190",
"KB2920289", "KB917607")
}
Else
{
#Server 2008 R2 without SP1
installed
$RecommendedList = @("KB2265716",
"KB2383928", "KB2647753", "KB2728738",
"KB2748302",
"KB2775511", "KB2778831", "KB2871131",
"KB2896256",
"KB3014783", "KB917607", "KB975777",
"KB979530",
"KB980663", "KB983460")
}
If($RecommendedList.count -gt 0)
{
Line 1 "Microsoft Recommended
Hotfixes (from CTX129229):"
ForEach($hotfix in
$RecommendedList)
{
$Tmp = $Null
If(!($MSInstalledHotfixes
-contains $hotfix))
{
$Tmp = "Not Installed"
}
Else
{
$Tmp = "Installed"
}
Line 2 "Microsoft Hotfix: "
$hotfix
Line 2 "Status`t`t: " $Tmp
Line 0 ""
}
Switch ($server.ElectionPreference)
{
"Unknown" {$tmp = "Unknown"; Break}
"MostPreferred" {$tmp = "Most Preferred";
$Script:TotalControllers++; Break}
"Preferred" {$tmp = "Preferred";
$Script:TotalControllers++; Break}
"DefaultPreference" {$tmp = "Default Preference";
$Script:TotalControllers++; Break}
"NotPreferred" {$tmp = "Not Preferred";
$Script:TotalControllers++; Break}
"WorkerMode" {$tmp = "Worker Mode";
$Script:TotalWorkers++; Break}
Default {$tmp = "Server election
preference could not be determined: $($server.ElectionPreference)"; Break}
}
If($server.LicenseServerName)
{
$rowdata += @(,("License Server Name",($htmlsilver
-bor $htmlbold),$server.LicenseServerName,$htmlwhite))
$rowdata += @(,("License Server Port",($htmlsilver
-bor $htmlbold),$server.LicenseServerPortNumber,$htmlwhite))
}
If($server.ICAPortNumber -gt 0)
{
$rowdata += @(,("ICA Port Number",($htmlsilver -bor
$htmlbold),$server.ICAPortNumber,$htmlwhite))
}
$rowdata += @(,("Product Installation Date",($htmlsilver
-bor $htmlbold),$server.CitrixInstallDate,$htmlwhite))
$rowdata += @(,("Operating System Version",($htmlsilver
-bor $htmlbold),"$($server.OSVersion) $($server.OSServicePack)",$htmlwhite))
$rowdata += @(,("Zone",($htmlsilver -bor $htmlbold),
$server.ZoneName,$htmlwhite))
$rowdata += @(,("Election Preference",($htmlsilver -bor
$htmlbold),$tmp,$htmlwhite))
$rowdata += @(,("Folder",($htmlsilver -bor $htmlbold),
$server.FolderPath,$htmlwhite))
$rowdata += @(,("Product Installation Path",($htmlsilver
-bor $htmlbold),$server.CitrixInstallPath,$htmlwhite))
$tmp = $Null
$msg = ""
$columnWidths = @("250","250")
FormatHTMLTable $msg -rowArray $rowdata -columnArray
$columnHeaders -fixedWidth $columnWidths
WriteHTMLLine 0 0 ""
$UninstallKey1="SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"
$reg=[microsoft.win32.registrykey]::OpenRemoteBaseKey('LocalMachine',
$Server.ServerName)
#Drill down into the Uninstall key using the
OpenSubKey Method
$regkey1=$reg.OpenSubKey($UninstallKey1)
$UninstallKey2="SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstal
l"
$regkey2=$reg.OpenSubKey($UninstallKey2)
If($Null -ne $regkey2)
{
$subkeys2=$regkey2.GetSubKeyNames()
ForEach($key in $subkeys2)
{
$thisKey=$UninstallKey2+"\\"+$key
$thisSubKey=$reg.OpenSubKey($thisKey)
if(![String]::IsNullOrEmpty($
($thisSubKey.GetValue("DisplayName"))))
{
$obj = New-Object PSObject
$obj | Add-Member -MemberType
NoteProperty -Name "DisplayName" -Value $($thisSubKey.GetValue("DisplayName"))
$obj | Add-Member -MemberType
NoteProperty -Name "DisplayVersion" -Value $
($thisSubKey.GetValue("DisplayVersion"))
$InstalledApps += $obj
}
}
}
#WriteHTMLLine 0 1 ":"
Write-Host "$(Get-Date): `t`tProcessing installed
applications for server $($server.ServerName)" -BackgroundColor Black
-ForegroundColor Yellow
$rowdata = @()
$columnHeaders = @(
'Application name',($htmlsilver -bor $htmlbold),
'Application version',($htmlsilver -bor $htmlbold))
ForEach($app in $JustApps)
{
Write-Host "$(Get-Date): `t`t`tProcessing
installed application $($app.DisplayName)" -BackgroundColor Black -ForegroundColor
Yellow
$rowdata += @(,(
$app.DisplayName,$htmlwhite,
$app.DisplayVersion,$htmlwhite))
}
$msg = "Installed applications"
FormatHTMLTable $msg "auto" -rowArray $rowdata
-columnArray $columnHeaders
WriteHTMLLine 0 0 ""
}
Try
{
#Iain Brighton optimization 5-Jun-2014
#Replaced with a single call to retrieve
services via WMI. The repeated
## "Get-WMIObject Win32_Service -Filter" calls
were the major delays in the script.
## If we need to retrieve the StartUp type
might as well just use WMI.
$Services = @(Get-WMIObject Win32_Service
-ComputerName $server.ServerName -EA 0 | Where-Object {$_.DisplayName -like
"*Citrix*"} | Sort-Object DisplayName)
}
Catch
{
$Services = $Null
}
#WriteHTMLLine 0 1 ""
$rowdata = @()
$columnHeaders = @(
'Display name',($htmlsilver -bor $htmlbold),
'Status',($htmlsilver -bor $htmlbold),
'Startup Type',($htmlsilver -bor $htmlbold))
ForEach($Service in $Services)
{
$rowdata += @(,(
$Service.DisplayName,$htmlwhite,
$Service.State,$htmlwhite,
$Service.StartMode,$htmlwhite))
}
Catch
{
$hotfixes = $Null
}
WriteHTMLLine 0 0 ""
#WriteHTMLLine 0 1 ":"
$rowdata = @()
$columnHeaders = @(
'Hotfix',($htmlsilver -bor $htmlbold),
'Installed By',($htmlsilver -bor $htmlbold),
'Install Date',($htmlsilver -bor $htmlbold),
'Type',($htmlsilver -bor $htmlbold))
ForEach($hotfix in $hotfixes)
{
$HotfixArray += $hotfix.HotfixName
Switch ($hotfix.HotfixName)
{
"XA650W2K8R2X64R02" {$HRP2Installed
= $True; Break}
"XA650W2K8R2X64R03" {$HRP3Installed
= $True; Break}
"XA650W2K8R2X64R04" {$HRP4Installed
= $True; Break}
"XA650W2K8R2X64R05" {$HRP5Installed
= $True; Break}
"XA650W2K8R2X64R06" {$HRP6Installed
= $True; Break}
"XA650W2K8R2X64R07" {$HRP7Installed
= $True; Break}
}
$InstallDate =
$hotfix.InstalledOn.ToString()
$rowdata += @(,(
$hotfix.HotfixName,$htmlwhite,
$hotfix.InstalledBy,$htmlwhite,
$InstallDate.SubString(0,$InstallDate.IndexOf(" ")),$htmlwhite,
$hotfix.HotfixType,$htmlwhite))
}
If($RecommendedList.count -gt 0)
{
#WriteHTMLLine 0 1 ":"
$rowdata = @()
$columnHeaders = @(
'Citrix Hotfix',($htmlsilver -bor
$htmlbold),
'Status',($htmlsilver -bor $htmlbold))
ForEach($element in $RecommendedList)
{
$Tmp = $Null
If(!($HotfixArray -contains
$element))
{
#missing a recommended Citrix
hotfix
$Tmp = "Not Installed"
}
Else
{
$Tmp = "Installed"
}
$rowdata += @(,(
$element,$htmlwhite,
$tmp,$htmlwhite))
}
Try
{
$results = Get-HotFix -computername
$Server.ServerName
$MSInstalledHotfixes = $results | select-
object -Expand HotFixID | Sort-Object HotFixID
$results = $Null
}
Catch
{
$GotMSHotfixes = $False
}
If($GotMSHotfixes)
{
If($server.OSServicePack.IndexOf('1') -gt
0)
{
#Server 2008 R2 SP1 installed
$RecommendedList = @("KB2620656",
"KB2647753", "KB2728738", "KB2748302",
"KB2775511",
"KB2778831", "KB2871131", "KB2896256",
"KB2908190",
"KB2920289", "KB917607")
}
Else
{
#Server 2008 R2 without SP1
installed
$RecommendedList = @("KB2265716",
"KB2383928", "KB2647753", "KB2728738",
"KB2748302",
"KB2775511", "KB2778831", "KB2871131",
"KB2896256",
"KB3014783", "KB917607", "KB975777",
"KB979530",
"KB980663", "KB983460")
}
If($RecommendedList.count -gt 0)
{
#WriteHTMLLine 0 1 ":"
$rowdata = @()
$columnHeaders = @(
'Microsoft Hotfix',($htmlsilver
-bor $htmlbold),
'Status',($htmlsilver -bor
$htmlbold))
ForEach($hotfix in
$RecommendedList)
{
$Tmp = $Null
If(!($MSInstalledHotfixes
-contains $hotfix))
{
$Tmp = "Not Installed"
}
Else
{
$Tmp = "Installed"
}
$rowdata += @(,(
$hotfix,$htmlwhite,
$Tmp,$htmlwhite))
}
Function OutputSummaryWorkerGroups
{
Param([object] $WorkerGroups)
ForEach($WorkerGroup in $WorkerGroups)
{
Write-Host "$(Get-Date): `t`tProcessing Worker Group $
($WorkerGroup.WorkerGroupName)" -BackgroundColor Black -ForegroundColor Yellow
$Script:TotalWGs++
If($MSWord -or $PDF)
{
$WordTableRowHash = @{
WGName = $WorkerGroup.WorkerGroupName;
}
$WordTable += $WordTableRowHash;
$CurrentServiceIndex++;
}
ElseIf($Text)
{
Line 0 $WorkerGroup.WorkerGroupName
}
ElseIf($HTML)
{
$rowdata += @(,(
$WorkerGroup.WorkerGroupName,$htmlwhite))
}
}
$Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
FindWordDocumentEnd
$Table = $Null
WriteWordLine 0 0 ""
}
ElseIf($Text)
{
Line 0 ""
}
ElseIf($HTML)
{
$columnHeaders = @(
'Name',($htmlsilver -bor $htmlbold))
$msg = ""
$columnWidths = @("100")
FormatHTMLTable $msg -rowArray $rowdata -columnArray $columnHeaders
-fixedWidth $columnWidths
WriteHTMLLine 0 0 ""
}
}
Function OutputWorkerGroups
{
Param([object] $WorkGroups)
ForEach($WorkerGroup in $WorkerGroups)
{
Write-Host "$(Get-Date): `t`tProcessing Worker Group $
($WorkerGroup.WorkerGroupName)" -BackgroundColor Black -ForegroundColor Yellow
If($MSWord -or $PDF)
{
WriteWordLine 2 0 $WorkerGroup.WorkerGroupName
[System.Collections.Hashtable[]] $ScriptInformation = @()
$ScriptInformation += @{ Data = "Description"; Value =
$WorkerGroup.Description; }
$ScriptInformation += @{ Data = "Folder Path"; Value =
$WorkerGroup.FolderPath; }
If($WorkerGroup.ServerNames)
{
$Script:TotalWGByServerName++
Write-Host "$(Get-Date): `t`tProcessing Worker Group by
Farm Servers" -BackgroundColor Black -ForegroundColor Yellow
$TempArray = @($WorkerGroup.ServerNames | Sort-Object)
$ScriptInformation += @{ Data = "Farm Servers"; Value =
$TempArray[0]; }
$cnt = -1
ForEach($Item in $TempARray)
{
$cnt++
If($cnt -gt 0)
{
$ScriptInformation += @{ Data = ""; Value =
$Item; }
}
}
$TempArray = $Null
}
If($WorkerGroup.ServerGroups)
{
$Script:TotalWGByServerGroup++
Write-Host "$(Get-Date): `t`tProcessing Worker Group by
Server Groups" -BackgroundColor Black -ForegroundColor Yellow
$TempArray = @($WorkerGroup.ServerGroups | Sort-Object)
$ScriptInformation += @{ Data = "Server Group Accounts";
Value = $TempArray[0]; }
$cnt = -1
ForEach($Item in $TempARray)
{
$cnt++
If($cnt -gt 0)
{
$ScriptInformation += @{ Data = ""; Value =
$Item; }
}
}
$TempArray = $Null
}
If($WorkerGroup.OUs)
{
$Script:TotalWGByOU++
Write-Host "$(Get-Date): `t`tProcessing Worker Group by
OUs" -BackgroundColor Black -ForegroundColor Yellow
$TempArray = @($WorkerGroup.OUs | Sort-Object {$_.Length})
$ScriptInformation += @{ Data = "Container"; Value =
$TempArray[0]; }
$cnt = -1
ForEach($Item in $TempARray)
{
$cnt++
If($cnt -gt 0)
{
$ScriptInformation += @{ Data = ""; Value =
$Item; }
}
}
$TempArray = $Null
}
$Table = AddWordTable -Hashtable $ScriptInformation `
-Columns Data,Value `
-List `
-Format $wdTableGrid `
-AutoFit $wdAutoFitFixed;
$Table.Columns.Item(1).Width = 150;
$Table.Columns.Item(2).Width = 250;
$Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
FindWordDocumentEnd
$Table = $Null
#applications published to worker group
$Applications = @(Get-XAApplication -WorkerGroup
$WorkerGroup.WorkerGroupName -EA 0| Sort-Object FolderPath, DisplayName)
If($? -and $Applications.Count -gt 0)
{
WriteWordLine 0 0 ""
WriteWordLine 0 0 "Published applications for Worker Group
$($WorkerGroup.WorkerGroupName)"
Write-Host "$(Get-Date): `t`tProcessing published
applications for Worker Group $($WorkerGroup.WorkerGroupName)" -BackgroundColor
Black -ForegroundColor Yellow
$TableRange = $doc.Application.Selection.Range
[int]$Columns = 2
[int]$Rows = $Applications.count + 1
FindWordDocumentEnd
}
}
ElseIf($Text)
{
Line 0 $WorkerGroup.WorkerGroupName
Line 1 "Description`t: " $WorkerGroup.Description
Line 1 "Folder Path`t: " $WorkerGroup.FolderPath
If($WorkerGroup.ServerNames)
{
$Script:TotalWGByServerName++
Write-Host "$(Get-Date): `t`tProcessing Worker Group by
Farm Servers" -BackgroundColor Black -ForegroundColor Yellow
$TempArray = @($WorkerGroup.ServerNames | Sort-Object)
Line 1 "Farm Servers`t: " $TempArray[0]
$cnt = -1
ForEach($Item in $TempArray)
{
$cnt++
If($cnt -gt 0)
{
Line 4 $Item
}
}
$TempArray = $Null
}
If($WorkerGroup.ServerGroups)
{
$Script:TotalWGByServerGroup++
Write-Host "$(Get-Date): `t`tProcessing Worker Group by
Server Groups" -BackgroundColor Black -ForegroundColor Yellow
$TempArray = @($WorkerGroup.ServerGroups | Sort-Object)
Line 1 "Server Group`t: " $TempArray[0]
$cnt = -1
ForEach($Item in $TempArray)
{
$cnt++
If($cnt -gt 0)
{
Line 4 $Item
}
}
$TempArray = $Null
}
If($WorkerGroup.OUs)
{
$Script:TotalWGByOU++
Write-Host "$(Get-Date): `t`tProcessing Worker Group by
OUs" -BackgroundColor Black -ForegroundColor Yellow
$TempArray = @($WorkerGroup.OUs | Sort-Object {$_.Length})
Line 1 "Container`t: " $TempArray[0]
$cnt = -1
ForEach($Item in $TempArray)
{
$cnt++
If($cnt -gt 0)
{
Line 4 $Item
}
}
$TempArray = $Null
}
Line 0 ""
If($cnt -gt 0)
{
$rowdata += @(,("",($htmlsilver -bor
$htmlbold),$Item,$htmlwhite))
}
}
$TempArray = $Null
}
If($WorkerGroup.ServerGroups)
{
$Script:TotalWGByServerGroup++
Write-Host "$(Get-Date): `t`tProcessing Worker Group by
Server Groups" -BackgroundColor Black -ForegroundColor Yellow
$TempArray = @($WorkerGroup.ServerGroups | Sort-Object)
$rowdata += @(,("Server Group Accounts",($htmlsilver -bor
$htmlbold),$TempArray[0],$htmlwhite))
$cnt = -1
ForEach($Item in $TempARray)
{
$cnt++
If($cnt -gt 0)
{
$rowdata += @(,("",($htmlsilver -bor
$htmlbold),$Item,$htmlwhite))
}
}
$TempArray = $Null
}
If($WorkerGroup.OUs)
{
$Script:TotalWGByOU++
Write-Host "$(Get-Date): `t`tProcessing Worker Group by
OUs" -BackgroundColor Black -ForegroundColor Yellow
$TempArray = @($WorkerGroup.OUs | Sort-Object {$_.Length})
$rowdata += @(,("Container",($htmlsilver -bor $htmlbold),
$TempArray[0],$htmlwhite))
$cnt = -1
ForEach($Item in $TempARray)
{
$cnt++
If($cnt -gt 0)
{
$rowdata += @(,("",($htmlsilver -bor
$htmlbold),$Item,$htmlwhite))
}
}
$TempArray = $Null
}
$msg = ""
$columnWidths = @("150","250")
FormatHTMLTable $msg -rowArray $rowdata -columnArray
$columnHeaders -fixedWidth $columnWidths
Function OutputSummaryZones
{
Param([object] $Zones)
ForEach($Zone in $Zones)
{
$Script:TotalZones++
Write-Host "$(Get-Date): `t`tProcessing Zone $($Zone.ZoneName)"
-BackgroundColor Black -ForegroundColor Yellow
If($MSWord -or $PDF)
{
$WordTableRowHash = @{
ZoneName = $Zone.ZoneName;
}
$WordTable += $WordTableRowHash;
$CurrentServiceIndex++;
}
ElseIf($Text)
{
Line 0 $Zone.ZoneName
}
ElseIf($HTML)
{
$rowdata += @(,(
$Zone.ZoneName,$htmlwhite))
}
}
$Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
FindWordDocumentEnd
$Table = $Null
WriteWordLine 0 0 ""
}
ElseIf($Text)
{
Line 0 ""
}
ElseIf($HTML)
{
$columnHeaders = @(
'Zone Name',($htmlsilver -bor $htmlbold))
$msg = ""
FormatHTMLTable $msg "auto" -rowArray $rowdata -columnArray
$columnHeaders
WriteHTMLLine 0 0 ""
}
}
Function OutputZones
{
Param([object] $Zones)
ForEach($Zone in $Zones)
{
$Script:TotalZones++
Write-Host "$(Get-Date): `t`tProcessing Zone $($Zone.ZoneName)"
-BackgroundColor Black -ForegroundColor Yellow
If($MSWord -or $PDF)
{
WriteWordLine 2 0 $Zone.ZoneName
WriteWordLine 0 0 "Current Data Collector: " $Zone.DataCollector
WriteWordLine 0 0 ""
}
ElseIf($Text)
{
Line 0 $Zone.ZoneName
Line 1 "Current Data Collector: " $Zone.DataCollector
Line 0 ""
}
ElseIf($HTML)
{
WriteHTMLLine 2 0 $Zone.ZoneName
WriteHTMLLine 0 0 "Current Data Collector: " $Zone.DataCollector
}
ForEach($Server in $Servers)
{
$ElectionPref = ""
Switch ($server.ElectionPreference)
{
"Unknown" {$ElectionPref = "Unknown";
Break}
"MostPreferred" {$ElectionPref = "Most
Preferred"; Break}
"Preferred" {$ElectionPref = "Preferred";
Break}
"DefaultPreference" {$ElectionPref = "Default
Preference"; Break}
"NotPreferred" {$ElectionPref = "Not Preferred";
Break}
"WorkerMode" {$ElectionPref = "Worker Mode";
Break}
Default {$ElectionPref = "Zone preference could not
be determined: $($server.ElectionPreference)"; Break}
}
If($MSWord -or $PDF)
{
$WordTableRowHash = @{
ServerName = $server.ServerName;
Pref = $ElectionPref;
}
$WordTable += $WordTableRowHash;
$CurrentServiceIndex++;
}
ElseIf($Text)
{
Line 2 "Server Name`t: " $server.ServerName
Line 2 "Preference`t: " $ElectionPref
Line 0 ""
}
ElseIf($HTML)
{
$rowdata += @(,(
$server.ServerName,$htmlwhite,
$ElectionPref,$htmlwhite))
}
}
If($MSWord -or $PDF)
{
## Add the table to the document, using the hashtable (-Alt
is short for -AlternateBackgroundColor!)
$Table = AddWordTable -Hashtable $WordTable `
-Columns ServerName, Pref `
-Headers "Server Name", "Preference" `
-Format $wdTableGrid `
-AutoFit $wdAutoFitFixed;
$Table.Rows.SetLeftIndent($Indent0TabStops,
$wdAdjustProportional)
FindWordDocumentEnd
$Table = $Null
WriteWordLine 0 0 ""
}
ElseIf($HTML)
{
$columnHeaders = @(
'Server Name',($htmlsilver -bor $htmlbold),
'Preference',($htmlsilver -bor $htmlbold))
}
#endregion
Function ConvertNumberToTime
{
Param([int]$val = 0)
#this is stored as a number between 0 (00:00 AM) and 1439 (23:59 PM)
#180 = 3AM
#900 = 3PM
#1027 = 5:07 PM
#[int] (1027/60) = 17 or 5PM
#1027 % 60 leaves 7 or 7 minutes
Function ConvertIntegerToDate
{
#thanks to MBS for helping me on this Function
Param([int]$DateAsInteger = 0)
Return "$Month/$Day/$Year"
}
Function ProcessPolicies
{
Write-Host "$(Get-Date): Processing Policies" -BackgroundColor Black
-ForegroundColor Yellow
[int]$Script:TotalComputerPolicies = 0
[int]$Script:TotalUserPolicies = 0
[int]$Script:TotalIMAPolicies = 0
[int]$Script:TotalADPolicies = 0
[int]$Script:TotalADPoliciesNotProcessed = 0
[int]$Script:TotalPolicies = 0
If($Policies)
{
ProcessCitrixPolicies "localfarmgpo" "Computer"
Write-Host "$(Get-Date): Finished Processing Citrix Site Computer
Policies" -BackgroundColor Black -ForegroundColor Yellow
Write-Host "$(Get-Date): " -BackgroundColor Black -ForegroundColor
Yellow
If($NoADPolicies)
{
#don't process AD policies
}
Else
{
#thanks to the Citrix Engineering Team for helping me solve
processing Citrix AD based Policies
Write-Host "$(Get-Date): " -BackgroundColor Black
-ForegroundColor Yellow
Write-Host "$(Get-Date): `tSee if there are any Citrix AD based
policies to process" -BackgroundColor Black -ForegroundColor Yellow
$CtxGPOArray = @()
$CtxGPOArray = GetCtxGPOsInAD
If($CtxGPOArray -is [Array] -and $CtxGPOArray.Count -gt 0)
{
Write-Host "$(Get-Date): " -BackgroundColor Black
-ForegroundColor Yellow
Write-Host "$(Get-Date): `tThere are $($CtxGPOArray.Count)
Citrix AD based policies to process" -BackgroundColor Black -ForegroundColor Yellow
Write-Host "$(Get-Date): " -BackgroundColor Black
-ForegroundColor Yellow
ForEach($CtxGPO in $CtxGPOArray)
{
Write-Host "$(Get-Date): `tCreating ADGpoDrv PSDrive
for Computer Policies" -BackgroundColor Black -ForegroundColor Yellow
New-PSDrive -Name ADGpoDrv -PSProvider
CitrixGroupPolicy -Root \ -DomainGpo $($CtxGPO) -Scope Global *>$Null
Function ProcessCitrixPolicies
{
Param([string]$xDriveName, [string]$xPolicyType)
SetWordCellFormat -Collection
$Table.Columns.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;
$Table.Columns.Item(1).Width = 90;
$Table.Columns.Item(2).Width = 200;
$Table.Rows.SetLeftIndent($Indent0TabStops,
$wdAdjustProportional)
FindWordDocumentEnd
$Table = $Null
}
ElseIf($Text)
{
If($xDriveName -eq "localfarmgpo")
{
Line 0 $Policy.PolicyName
Line 1 "IMA Farm based policy"
}
Else
{
Line 0 "$($Policy.PolicyName) in $($CtxGPO)"
Line 1 "Active Directory based policy"
}
Line 1 "Description`t: " $Policy.Description
Line 1 "Enabled`t`t: " $Policy.Enabled
Line 1 "Type`t`t: " $Policy.Type
Line 1 "Priority`t: " $Policy.Priority
}
ElseIf($HTML)
{
If($xDriveName -eq "localfarmgpo")
{
WriteHTMLLine 2 0 $Policy.PolicyName
WriteHTMLLine 0 0"IMA Farm based policy"
}
Else
{
WriteHTMLLine 2 0 "$($Policy.PolicyName) in $
($CtxGPO)"
WriteHTMLLine 0 0 "Active Directory based
policy"
}
$rowdata = @()
$columnHeaders = @("Description",($htmlsilver -bor
$htmlbold),$Policy.Description,$htmlwhite)
$rowdata += @(,('Enabled',($htmlsilver -bor
$htmlbold),$Policy.Enabled,$htmlwhite))
$rowdata += @(,('Type',($htmlsilver -bor $htmlbold),
$Policy.Type,$htmlwhite))
$rowdata += @(,('Priority',($htmlsilver -bor
$htmlbold),$Policy.Priority,$htmlwhite))
$msg = ""
$columnWidths = @("90","200")
FormatHTMLTable $msg -rowArray $rowdata -columnArray
$columnHeaders -fixedWidth $columnWidths -tablewidth "290"
WriteHTMLLine 0 0 " "
}
ForEach($Filter in $Filters)
{
$tmp = ""
#5-May-2017 add back the WorkerGroup
filter for xenapp 6.x
Switch($filter.FilterType)
{
"AccessControl" {$tmp = "Access
Control"; Break}
"BranchRepeater" {$tmp = "Citrix
CloudBridge"; Break}
"ClientIP" {$tmp = "Client IP
Address"; Break}
"ClientName" {$tmp = "Client
Name"; Break}
"DesktopGroup" {$tmp = "Delivery
Group"; Break}
"DesktopKind" {$tmp = "Delivery
GroupType"; Break}
"DesktopTag" {$tmp = "Tag";
Break}
"OU" {$tmp =
"Organizational Unit (OU)"; Break}
"User" {$tmp = "User or
group"; Break}
"WorkerGroup" {$tmp = "Worker
Group"; Break}
Default {$tmp = "Policy Filter Type
could not be determined: $($filter.FilterType)"; Break}
}
SetWordCellFormat -Collection
$Table.Rows.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;
$Table.Columns.Item(1).Width = 115;
$Table.Columns.Item(2).Width = 125;
$Table.Columns.Item(3).Width = 50;
$Table.Columns.Item(4).Width = 40;
$Table.Columns.Item(5).Width = 170;
$Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
FindWordDocumentEnd
$Table = $Null
}
ElseIf($HTML)
{
$columnHeaders = @(
'Name',($htmlsilver -bor $htmlbold),
'Type',($htmlsilver -bor $htmlbold),
'Enabled',($htmlsilver -bor $htmlbold),
'Mode',($htmlsilver -bor $htmlbold),
'Value',($htmlsilver -bor $htmlbold))
$msg = ""
$columnWidths =
@("115","125","50","40","170")
FormatHTMLTable $msg -rowArray $rowdata
-columnArray $columnHeaders -fixedWidth $columnWidths -tablewidth "500"
WriteHTMLLine 0 0 " "
}
}
Else
{
If($MSWord -or $PDF)
{
WriteWordLine 0 0 "Assigned to: None"
}
ElseIf($Text)
{
Line 0 "Assigned to`t`t: None"
}
ElseIf($HTML)
{
WriteHTMLLine 0 0 "Assigned to: None"
}
}
}
ElseIf($? -and $Null -eq $Filters)
{
$txt = "$($Policy.PolicyName) policy applies to all
objects in the Farm"
If($MSWord -or $PDF)
{
WriteWordLine 3 0 "Assigned to"
WriteWordLine 0 0 $txt
}
ElseIf($Text)
{
Line 0 "Assigned to: " $txt
}
ElseIf($HTML)
{
WriteHTMLLine 3 0 "Assigned to"
WriteHTMLLine 0 0 $txt
}
}
ElseIf($? -and $Policy.PolicyName -eq "Unfiltered")
{
$txt = "Unfiltered policy applies to all objects in
the Farm"
If($MSWord -or $PDF)
{
WriteWordLine 3 0 "Assigned to"
WriteWordLine 0 0 $txt
}
ElseIf($Text)
{
Line 0 "Assigned to: " $txt
}
ElseIf($HTML)
{
WriteHTMLLine 3 0 "Assigned to"
WriteHTMLLine 0 0 $txt
}
}
Else
{
$txt = "Unable to retrieve Filter settings"
If($MSWord -or $PDF)
{
WriteWordLine 0 0 $txt
}
ElseIf($Text)
{
Line 0 $txt
}
ElseIf($HTML)
{
WriteHTMLLine 0 0 $txt
}
}
$First = $True
ForEach($Setting in $Settings)
{
If($First)
{
$txt = "Policy settings"
If($MSWord -or $PDF)
{
WriteWordLine 3 0 $txt
}
ElseIf($Text)
{
Line 1 $txt
}
ElseIf($HTML)
{
WriteHTMLLine 3 0 $txt
}
}
$First = $False
$Setting.AdvanceWarningMessageTitle.Value,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.AdvanceWarningMessageTitle.Value
}
}
If((validStateProp $Setting AdvanceWarningPeriod
State ) -and ($Setting.AdvanceWarningPeriod.State -ne "NotConfigured"))
{
$txt = "Connector for Configuration Manager
2012\Advance warning time period"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.AdvanceWarningPeriod.Value;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.AdvanceWarningPeriod.Value,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.AdvanceWarningPeriod.Value
}
}
If((validStateProp $Setting
PvsImageUpdateDeadlinePeriod State ) -and
($Setting.PvsImageUpdateDeadlinePeriod.State -ne "NotConfigured"))
{
$txt = "Connector for Configuration Manager
2012\Deadline calculation time for newly available PVS images: "
$tmp =
$Setting.PvsImageUpdateDeadlinePeriod.Value
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value = $tmp;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$tmp))
}
ElseIf($Text)
{
OutputPolicySetting $txt $tmp
}
}
If((validStateProp $Setting
FinalForceLogoffMessageBody State ) -and
($Setting.FinalForceLogoffMessageBody.State -ne "NotConfigured"))
{
$txt = "Connector for Configuration Manager
2012\Final force logoff message box body text"
$tmpArray =
$Setting.FinalForceLogoffMessageBody.Value.Split("`n")
$tmp = ""
$cnt = 0
ForEach($Thing in $TmpArray)
{
If($Null -eq $Thing)
{
$Thing = ''
}
$cnt++
$tmp = "$($Thing) "
If($cnt -eq 1)
{
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value = $tmp;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$tmp,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt $tmp
}
}
Else
{
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = "";
Value = $tmp;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
"",$htmlbold,
$tmp,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting
"`t`t`t`t`t`t`t`t`t" $tmp
}
}
}
$TmpArray = $Null
$tmp = $Null
}
If((validStateProp $Setting
FinalForceLogoffMessageTitle State ) -and
($Setting.FinalForceLogoffMessageTitle.State -ne "NotConfigured"))
{
$txt = "Connector for Configuration Manager
2012\Final force logoff message box title"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.FinalForceLogoffMessageTitle.Value;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.FinalForceLogoffMessageTitle.Value,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.FinalForceLogoffMessageTitle.Value
}
}
If((validStateProp $Setting ForceLogoffGracePeriod
State ) -and ($Setting.ForceLogoffGracePeriod.State -ne "NotConfigured"))
{
$txt = "Connector for Configuration Manager
2012\Force logoff grace period"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.ForceLogoffGracePeriod.Value;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.ForceLogoffGracePeriod.Value,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.ForceLogoffGracePeriod.Value
}
}
If((validStateProp $Setting ForceLogoffMessageBody
State ) -and ($Setting.ForceLogoffMessageBody.State -ne "NotConfigured"))
{
$txt = "Connector for Configuration Manager
2012\Force logoff message box body text"
$tmpArray =
$Setting.ForceLogoffMessageBody.Value.Split("`n")
$tmp = ""
$cnt = 0
ForEach($Thing in $TmpArray)
{
If($Null -eq $Thing)
{
$Thing = ''
}
$cnt++
$tmp = "$($Thing) "
If($cnt -eq 1)
{
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value = $tmp;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$tmp,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt $tmp
}
}
Else
{
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = "";
Value = $tmp;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
"",$htmlbold,
$tmp,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting
"`t`t`t`t`t`t`t`t`t " $tmp
}
}
$txt = ""
}
$TmpArray = $Null
$tmp = $Null
}
If((validStateProp $Setting ForceLogoffMessageTitle
State ) -and ($Setting.ForceLogoffMessageTitle.State -ne "NotConfigured"))
{
$txt = "Connector for Configuration Manager
2012\Force logoff message box title"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.ForceLogoffMessageTitle.Value;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.ForceLogoffMessageTitle.Value,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.ForceLogoffMessageTitle.Value
}
}
If((validStateProp $Setting PvsIntegrationEnabled
State ) -and ($Setting.PvsIntegrationEnabled.State -ne "NotConfigured"))
{
$txt = "Connector for Configuration Manager
2012\PVS Integration enabled"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.PvsIntegrationEnabled.State;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.PvsIntegrationEnabled.State,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.PvsIntegrationEnabled.State
}
}
If((validStateProp $Setting RebootMessageBody State )
-and ($Setting.RebootMessageBody.State -ne "NotConfigured"))
{
$txt = "Connector for Configuration Manager
2012\Reboot message box body text"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value = $Setting.RebootMessageBody.Value;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.RebootMessageBody.Value,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.RebootMessageBody.Value
}
}
If((validStateProp $Setting AgentTaskInterval State )
-and ($Setting.AgentTaskInterval.State -ne "NotConfigured"))
{
$txt = "Connector for Configuration Manager
2012\Regular time interval at which the agent task is to run"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value = $Setting.AgentTaskInterval.Value;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.AgentTaskInterval.Value,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.AgentTaskInterval.Value
}
}
$Setting.NonPublishedProgramLaunching.State,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.NonPublishedProgramLaunching.State
}
}
$Setting.FlashBackwardsCompatibility.State,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.FlashBackwardsCompatibility.State
}
}
If((validStateProp $Setting FlashDefaultBehavior
State ) -and ($Setting.FlashDefaultBehavior.State -ne "NotConfigured"))
{
$txt = "ICA\Adobe Flash Delivery\Flash
Redirection\Flash default behavior"
$tmp = ""
Switch ($Setting.FlashDefaultBehavior.Value)
{
"Block" {$tmp = "Block Flash
player"; Break}
"Disable" {$tmp = "Disable Flash
acceleration"; Break}
"Enable" {$tmp = "Enable Flash
acceleration"; Break}
Default {$tmp = "Flash Default
behavior could not be determined: $($Setting.FlashDefaultBehavior.Value)"; Break}
}
$Setting.FileRedirectionBandwidthLimit.Value,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.FileRedirectionBandwidthLimit.Value
}
}
If((validStateProp $Setting
FileRedirectionBandwidthPercent State ) -and
($Setting.FileRedirectionBandwidthPercent.State -ne "NotConfigured"))
{
$txt = "ICA\Bandwidth\File redirection
bandwidth limit %"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.FileRedirectionBandwidthPercent.Value;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.FileRedirectionBandwidthPercent.Value,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.FileRedirectionBandwidthPercent.Value
}
}
If((validStateProp $Setting
HDXMultimediaBandwidthLimit State ) -and
($Setting.HDXMultimediaBandwidthLimit.State -ne "NotConfigured"))
{
$txt = "ICA\Bandwidth\HDX MediaStream
Multimedia Acceleration bandwidth limit (Kbps)"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.HDXMultimediaBandwidthLimit.Value;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.HDXMultimediaBandwidthLimit.Value,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.HDXMultimediaBandwidthLimit.Value
}
}
If((validStateProp $Setting
HDXMultimediaBandwidthPercent State ) -and
($Setting.HDXMultimediaBandwidthPercent.State -ne "NotConfigured"))
{
$txt = "ICA\Bandwidth\HDX MediaStream
Multimedia Acceleration bandwidth limit %"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.HDXMultimediaBandwidthPercent.Value;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.HDXMultimediaBandwidthPercent.Value,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.HDXMultimediaBandwidthPercent.Value
}
}
If((validStateProp $Setting LptBandwidthLimit State )
-and ($Setting.LptBandwidthLimit.State -ne "NotConfigured"))
{
$txt = "ICA\Bandwidth\LPT port redirection
bandwidth limit (Kbps)"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value = $Setting.LptBandwidthLimit.Value;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.LptBandwidthLimit.Value,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.LptBandwidthLimit.Value
}
}
If((validStateProp $Setting LptBandwidthLimitPercent
State ) -and ($Setting.LptBandwidthLimitPercent.State -ne "NotConfigured"))
{
$txt = "ICA\Bandwidth\LPT port redirection
bandwidth limit %"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.LptBandwidthLimitPercent.Value;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.LptBandwidthLimitPercent.Value,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.LptBandwidthLimitPercent.Value
}
}
If((validStateProp $Setting OverallBandwidthLimit
State ) -and ($Setting.OverallBandwidthLimit.State -ne "NotConfigured"))
{
$txt = "ICA\Bandwidth\Overall session bandwidth
limit (Kbps)"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.OverallBandwidthLimit.Value;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.OverallBandwidthLimit.Value,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.OverallBandwidthLimit.Value
}
}
If((validStateProp $Setting PrinterBandwidthLimit
State ) -and ($Setting.PrinterBandwidthLimit.State -ne "NotConfigured"))
{
$txt = "ICA\Bandwidth\Printer redirection
bandwidth limit (Kbps)"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.PrinterBandwidthLimit.Value;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.PrinterBandwidthLimit.Value,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.PrinterBandwidthLimit.Value
}
}
If((validStateProp $Setting PrinterBandwidthPercent
State ) -and ($Setting.PrinterBandwidthPercent.State -ne "NotConfigured"))
{
$txt = "ICA\Bandwidth\Printer redirection
bandwidth limit %"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.PrinterBandwidthPercent.Value;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.PrinterBandwidthPercent.Value,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.PrinterBandwidthPercent.Value
}
}
If((validStateProp $Setting TwainBandwidthLimit State
) -and ($Setting.TwainBandwidthLimit.State -ne "NotConfigured"))
{
$txt = "ICA\Bandwidth\TWAIN device redirection
bandwidth limit (Kbps)"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.TwainBandwidthLimit.Value;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.TwainBandwidthLimit.Value,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.TwainBandwidthLimit.Value
}
}
If((validStateProp $Setting TwainBandwidthPercent
State ) -and ($Setting.TwainBandwidthPercent.State -ne "NotConfigured"))
{
$txt = "ICA\Bandwidth\TWAIN device redirection
bandwidth limit %"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.TwainBandwidthPercent.Value;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.TwainBandwidthPercent.Value,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.TwainBandwidthPercent.Value
}
}
$Setting.WindowContentsVisibleWhileDragging.State,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.WindowContentsVisibleWhileDragging.State
}
}
$Setting.IcaRoundTripCalculationInterval.Value,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.IcaRoundTripCalculationInterval.Value
}
}
If((validStateProp $Setting
IcaRoundTripCalculationWhenIdle State ) -and
($Setting.IcaRoundTripCalculationWhenIdle.State -ne "NotConfigured"))
{
$txt = "ICA\End User Monitoring\ICA round trip
calculations for idle connections"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.IcaRoundTripCalculationWhenIdle.State;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.IcaRoundTripCalculationWhenIdle.State,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.IcaRoundTripCalculationWhenIdle.State
}
}
$Setting.ClientDriveLetterPreservation.State,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.ClientDriveLetterPreservation.State
}
}
If((validStateProp $Setting ReadOnlyMappedDrive State
) -and ($Setting.ReadOnlyMappedDrive.State -ne "NotConfigured"))
{
$txt = "ICA\File Redirection\Read-only client
drive access"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.ReadOnlyMappedDrive.State;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.ReadOnlyMappedDrive.State,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.ReadOnlyMappedDrive.State
}
}
If((validStateProp $Setting SpecialFolderRedirection
State ) -and ($Setting.SpecialFolderRedirection.State -ne "NotConfigured"))
{
$txt = "ICA\File Redirection\Special folder
redirection"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.SpecialFolderRedirection.State;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.SpecialFolderRedirection.State,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.SpecialFolderRedirection.State
}
}
If((validStateProp $Setting AsynchronousWrites
State ) -and ($Setting.AsynchronousWrites.State -ne "NotConfigured"))
{
$txt = "ICA\File Redirection\Use asynchronous
writes"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.AsynchronousWrites.State;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.AsynchronousWrites.State,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.AsynchronousWrites.State
}
}
$Setting.DisplayDegradeUserNotification.State,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.DisplayDegradeUserNotification.State
}
}
If((validStateProp $Setting QueueingAndTossing
State ) -and ($Setting.QueueingAndTossing.State -ne "NotConfigured"))
{
$txt = "ICA\Graphics\Queueing and tossing"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.QueueingAndTossing.State;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.QueueingAndTossing.State,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.QueueingAndTossing.State
}
}
$Setting.MultimediaAccelerationDefaultBufferSize.Value,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.MultimediaAccelerationDefaultBufferSize.Value
}
}
If((validStateProp $Setting
MultimediaAccelerationUseDefaultBufferSize State ) -and
($Setting.MultimediaAccelerationUseDefaultBufferSize.State -ne "NotConfigured"))
{
$txt = "ICA\Multimedia\Windows Media
redirection buffer size use"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.MultimediaAccelerationUseDefaultBufferSize.State;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.MultimediaAccelerationUseDefaultBufferSize.State,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.MultimediaAccelerationUseDefaultBufferSize.State
}
}
$SettingsWordTable += @{
Text = $txt2;
Value = "High";
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt1,$htmlbold,
"Default Port",$htmlwhite))
$rowdata += @(,(
$txt2,$htmlbold,
"High",$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt1 "Default Port"
OutputPolicySetting $txt2 "High"
}
$txt1 = $Null
$txt2 = $Null
[string]$Tmp = $Setting.MultiPortPolicy.Value
If($Tmp.Length -gt 0)
{
$Port1Priority = ""
$Port2Priority = ""
$Port3Priority = ""
[string]$cgpport1 = $Tmp.substring(0,
$Tmp.indexof(";"))
[string]$cgpport2 =
$Tmp.substring($cgpport1.length + 1 , ($Tmp.indexof(";")+1))
[string]$cgpport3 =
$Tmp.substring((($cgpport1.length + 1)+($cgpport2.length + 1)) , ($Tmp.indexof(";")
+1))
[string]$cgpport1priority =
$cgpport1.substring($cgpport1.length -1, 1)
[string]$cgpport2priority =
$cgpport2.substring($cgpport2.length -1, 1)
[string]$cgpport3priority =
$cgpport3.substring($cgpport3.length -1, 1)
$cgpport1 = $cgpport1.substring(0,
$cgpport1.indexof(","))
$cgpport2 = $cgpport2.substring(0,
$cgpport2.indexof(","))
$cgpport3 = $cgpport3.substring(0,
$cgpport3.indexof(","))
Switch ($cgpport1priority)
{
"0" {$Port1Priority = "Very
High"; Break}
"2" {$Port1Priority = "Medium";
Break}
"3" {$Port1Priority = "Low";
Break}
Default {$Port1Priority =
"Unknown"; Break}
}
Switch ($cgpport2priority)
{
"0" {$Port2Priority = "Very
High"; Break}
"2" {$Port2Priority = "Medium";
Break}
"3" {$Port2Priority = "Low";
Break}
Default {$Port2Priority =
"Unknown"; Break}
}
Switch ($cgpport3priority)
{
"0" {$Port3Priority = "Very
High"; Break}
"2" {$Port3Priority = "Medium";
Break}
"3" {$Port3Priority = "Low";
Break}
Default {$Port3Priority =
"Unknown"; Break}
}
$txt1 = "ICA\MultiStream
Connections\Multi-Port Policy\CGP port1"
$txt2 = "ICA\MultiStream
Connections\Multi-Port Policy\CGP port1 priority"
$txt3 = "ICA\MultiStream
Connections\Multi-Port Policy\CGP port2"
$txt4 = "ICA\MultiStream
Connections\Multi-Port Policy\CGP port2 priority"
$txt5 = "ICA\MultiStream
Connections\Multi-Port Policy\CGP port3"
$txt6 = "ICA\MultiStream
Connections\Multi-Port Policy\CGP port3 priority"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt1;
Value = $cgpport1;
}
$SettingsWordTable += @{
Text = $txt2;
Value = $port1priority;
}
$SettingsWordTable += @{
Text = $txt3;
Value = $cgpport2;
}
$SettingsWordTable += @{
Text = $txt4;
Value = $port2priority;
}
$SettingsWordTable += @{
Text = $txt5;
Value = $cgpport3;
}
$SettingsWordTable += @{
Text = $txt6;
Value = $port3priority;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt1,$htmlbold,
$cgpport1,$htmlwhite))
$rowdata += @(,(
$txt2,$htmlbold,
$port1priority,$htmlwhite))
$rowdata += @(,(
$txt3,$htmlbold,
$cgpport2,$htmlwhite))
$rowdata += @(,(
$txt4,$htmlbold,
$port2priority,$htmlwhite))
$rowdata += @(,(
$txt5,$htmlbold,
$cgpport3,$htmlwhite))
$rowdata += @(,(
$txt6,$htmlbold,
$port3priority,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt1 $cgpport1
OutputPolicySetting $txt2
$port1priority
OutputPolicySetting $txt3 $cgpport2
OutputPolicySetting $txt4
$port2priority
OutputPolicySetting $txt5 $cgpport3
OutputPolicySetting $txt6
$port3priority
}
}
$Tmp = $Null
$cgpport1 = $Null
$cgpport2 = $Null
$cgpport3 = $Null
$cgpport1priority = $Null
$cgpport2priority = $Null
$cgpport3priority = $Null
$Port1Priority = $Null
$Port2Priority = $Null
$Port3Priority = $Null
$txt1 = $Null
$txt2 = $Null
$txt3 = $Null
$txt4 = $Null
$txt5 = $Null
$txt6 = $Null
}
If((validStateProp $Setting MultiStreamPolicy State )
-and ($Setting.MultiStreamPolicy.State -ne "NotConfigured"))
{
$txt = "ICA\MultiStream Connections\Multi-
Stream computer setting"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value = $Setting.MultiStreamPolicy.State;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.MultiStreamPolicy.State,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.MultiStreamPolicy.State
}
}
If((validStateProp $Setting MultiStream State ) -and
($Setting.MultiStream.State -ne "NotConfigured"))
{
$txt = "ICA\MultiStream Connections\Multi-
Stream user setting"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value = $Setting.MultiStream.State;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.MultiStream.State,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.MultiStream.State
}
}
$Setting.ClientComPortsAutoConnection.State,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.ClientComPortsAutoConnection.State
}
}
If((validStateProp $Setting
ClientLptPortsAutoConnection State ) -and
($Setting.ClientLptPortsAutoConnection.State -ne "NotConfigured"))
{
$txt = "ICA\Port Redirection\Auto connect
client LPT ports"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.ClientLptPortsAutoConnection.State;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.ClientLptPortsAutoConnection.State,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.ClientLptPortsAutoConnection.State
}
}
If((validStateProp $Setting ClientComPortRedirection
State ) -and ($Setting.ClientComPortRedirection.State -ne "NotConfigured"))
{
$txt = "ICA\Port Redirection\Client COM port
redirection"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.ClientComPortRedirection.State;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.ClientComPortRedirection.State,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.ClientComPortRedirection.State
}
}
If((validStateProp $Setting ClientLptPortRedirection
State ) -and ($Setting.ClientLptPortRedirection.State -ne "NotConfigured"))
{
$txt = "ICA\Port Redirection\Client LPT port
redirection"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.ClientLptPortRedirection.State;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.ClientLptPortRedirection.State,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.ClientLptPortRedirection.State
}
}
ForEach($Filter in
$PrinterAssignment.Filters)
{
$Client += "$($Filter);
"
}
Switch
($PrinterAssignment.DefaultPrinterOption)
{
"ClientDefault"
{$DefaultPrinter = "Client main printer"; Break}
"NotConfigured"
{$DefaultPrinter = "<Not set>"; Break}
"DoNotAdjust"
{$DefaultPrinter = "Do not adjust"; Break}
"SpecificPrinter"
{$DefaultPrinter = $PrinterAssignment.SpecificDefaultPrinter; Break}
Default
{$DefaultPrinter = "<Not set>"; Break}
}
ForEach($SessionPrinter in
$PrinterAssignment.SessionPrinters)
{
$SessionPrinters +=
$SessionPrinter
}
$SettingsWordTable += @{
Text = "";
Value = $tmp2;
}
$SettingsWordTable += @{
Text = "";
Value = $tmp3;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$tmp1,$htmlwhite))
$rowdata += @(,(
"",$htmlbold,
$tmp2,$htmlwhite))
$rowdata += @(,(
"",$htmlbold,
$tmp3,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$tmp1
OutputPolicySetting
"`t`t`t`t" $tmp2
OutputPolicySetting
"`t`t`t`t" $tmp3
}
$tmp1 = $Null
$tmp2 = $Null
$tmp3 = $Null
}
}
}
Else
{
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.PrinterAssignments.State;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.PrinterAssignments.State,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.PrinterAssignments.State
}
}
}
If((validStateProp $Setting
AutoCreationEventLogPreference State ) -and
($Setting.AutoCreationEventLogPreference.State -ne "NotConfigured"))
{
$txt = "ICA\Printing\Printer auto-creation
event log preference"
$tmp = ""
Switch
($Setting.AutoCreationEventLogPreference.Value)
{
"LogErrorsOnly" {$tmp = "Log
errors only"; Break}
"LogErrorsAndWarnings" {$tmp = "Log
errors and warnings"; Break}
"DoNotLog" {$tmp = "Do not
log errors or warnings"; Break}
Default {$tmp = "Printer auto-creation
event log preference could not be determined: $
($Setting.AutoCreationEventLogPreference.Value)"; Break}
}
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value = $tmp;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$tmp,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt $tmp
}
$tmp = $Null
}
If((validStateProp $Setting SessionPrinters State )
-and ($Setting.SessionPrinters.State -ne "NotConfigured"))
{
$txt = "ICA\Printing\Session printers"
If(validStateProp $Setting SessionPrinters
Values )
{
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value = "";
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
"",$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt ""
}
$valArray =
$Setting.SessionPrinters.Values
$tmp = ""
ForEach($printer in $valArray)
{
$prArray = $printer.Split(',')
ForEach($element in $prArray)
{
If($element.SubString(0, 2)
-eq "\\")
{
$index =
$element.SubString(2).IndexOf('\')
If($index -ge 0)
{
$server =
$element.SubString(0, $index + 2)
$share =
$element.SubString($index + 3)
$tmp = "Server: $
($server)"
If($MSWord -or
$PDF)
{
$SettingsWordTable += @{
Text = "";
Value =
$tmp;
}
}
ElseIf($HTML)
{
$rowdata +=
@(,(
"",
$htmlbold,
$tmp,
$htmlwhite))
}
ElseIf($Text)
{
$SettingsWordTable += @{
Text = "";
Value =
$tmp;
}
}
ElseIf($HTML)
{
$rowdata +=
@(,(
"",
$htmlbold,
$tmp,
$htmlwhite))
}
ElseIf($Text)
{
$SettingsWordTable += @{
Text = "";
Value =
$tmp;
}
}
ElseIf($HTML)
{
$rowdata +=
@(,(
"",
$htmlbold,
$tmp,
$htmlwhite))
}
ElseIf($Text)
{
$valArray = $Null
$prArray = $Null
$tmp = $Null
}
Else
{
$tmp = "No Session printers were found"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value = $tmp;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$tmp,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt $tmp
}
}
}
If((validStateProp $Setting
WaitForPrintersToBeCreated State ) -and ($Setting.WaitForPrintersToBeCreated.State
-ne "NotConfigured"))
{
$txt = "ICA\Printing\Wait for printers to be
created (server desktop)"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.WaitForPrintersToBeCreated.State;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.WaitForPrintersToBeCreated.State,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.WaitForPrintersToBeCreated.State
}
}
$Setting.GenericUniversalPrinterAutoCreation.State,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.GenericUniversalPrinterAutoCreation.State
}
}
If((validStateProp $Setting ClientPrinterNames
State ) -and ($Setting.ClientPrinterNames.State -ne "NotConfigured"))
{
$txt = "ICA\Printing\Client Printers\Client
printer names"
$tmp = ""
Switch ($Setting.ClientPrinterNames.Value)
{
"StandardPrinterNames" {$tmp = "Standard
printer names"; Break}
"LegacyPrinterNames" {$tmp = "Legacy
printer names"; Break}
Default {$tmp = "Client printer names
could not be determined: $($Setting.ClientPrinterNames.Value)"; Break}
}
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value = $tmp;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$tmp,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt $tmp
}
$tmp = $Null
}
If((validStateProp $Setting
DirectConnectionsToPrintServers State ) -and
($Setting.DirectConnectionsToPrintServers.State -ne "NotConfigured"))
{
$txt = "ICA\Printing\Client Printers\Direct
connections to print servers"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.DirectConnectionsToPrintServers.State;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.DirectConnectionsToPrintServers.State,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.DirectConnectionsToPrintServers.State
}
}
If((validStateProp $Setting PrinterDriverMappings
State ) -and ($Setting.PrinterDriverMappings.State -ne "NotConfigured"))
{
$txt = "ICA\Printing\Client Printers\Printer
driver mapping and compatibility"
If(validStateProp $Setting
PrinterDriverMappings Values )
{
$array =
$Setting.PrinterDriverMappings.Values
$tmp = $array[0]
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value = $tmp;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$tmp,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt $tmp
}
$cnt = -1
ForEach($element in $array)
{
$cnt++
If($cnt -ne 0)
{
$Items = $element.Split(',')
$DriverName = $Items[0]
$Action = $Items[1]
If($Action -match 'Replace=')
{
$ServerDriver =
$Action.substring($Action.indexof("=")+1)
$Action = "Replace "
}
Else
{
$ServerDriver = ""
If($Action -eq "Allow")
{
$Action = "Allow "
}
ElseIf($Action -eq
"Deny")
{
$Action = "Do not
create "
}
ElseIf($Action -eq
"UPD_Only")
{
$Action = "Create
with universal driver "
}
}
$tmp = "Driver Name: $
($DriverName)"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = "";
Value = $tmp;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
"",$htmlbold,
$tmp,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting
"`t`t`t`t`t`t`t`t " $tmp
}
$tmp = "Action : $
($Action)"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = "";
Value = $tmp;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
"",$htmlbold,
$tmp,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting
"`t`t`t`t`t`t`t`t " $tmp
}
$tmp = "Settings : "
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = "";
Value = $tmp;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
"",$htmlbold,
$tmp,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting
"`t`t`t`t`t`t`t`t " $tmp
}
If($Items.count -gt 2)
{
[int]$BeginAt = 2
[int]$EndAt =
$Items.count
for ($i=$BeginAt;$i -lt
$EndAt; $i++)
{
$tmp2 =
$Items[$i].SubString(0, 4)
$tmp = Get-
PrinterModifiedSettings $tmp2 $Items[$i]
If(!
[String]::IsNullOrEmpty($tmp))
{
If($MSWord
-or $PDF)
{
$SettingsWordTable += @{
Text =
"";
Value
= $tmp;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
"",
$htmlbold,
$tmp,
$htmlwhite))
}
ElseIf($Text)
{
If(!
[String]::IsNullOrEmpty($ServerDriver))
{
$tmp = "Server Driver: $
($ServerDriver)"
If($MSWord -or $PDF)
{
$SettingsWordTable
+= @{
Text = "";
Value = $tmp;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
"",$htmlbold,
$tmp,$htmlwhite))
}
ElseIf($Text)
{
$Setting.RetainedAndRestoredClientPrinters.State,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.RetainedAndRestoredClientPrinters.State
}
}
$Setting.InboxDriverAutoInstallation.State,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.InboxDriverAutoInstallation.State
}
}
If((validStateProp $Setting UniversalDriverPriority
State ) -and ($Setting.UniversalDriverPriority.State -ne "NotConfigured"))
{
$txt = "ICA\Printing\Drivers\Universal driver
preference"
$Values =
$Setting.UniversalDriverPriority.Value.Split(';')
$tmp = ""
$cnt = 0
ForEach($Value in $Values)
{
If($Null -eq $Value)
{
$Value = ''
}
$cnt++
$tmp = "$($Value)"
If($cnt -eq 1)
{
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value = $tmp;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$tmp,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt $tmp
}
}
Else
{
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = "";
Value = $tmp;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
"",$htmlbold,
$tmp,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting
"`t`t`t`t`t`t" $tmp
}
}
}
$tmp = $Null
$Values = $Null
}
If((validStateProp $Setting UniversalPrintDriverUsage
State ) -and ($Setting.UniversalPrintDriverUsage.State -ne "NotConfigured"))
{
$txt = "ICA\Printing\Drivers\Universal print
driver usage"
$tmp = ""
Switch
($Setting.UniversalPrintDriverUsage.Value)
{
"SpecificOnly" {$tmp = "Use only
printer model specific drivers"; Break}
"UpdOnly" {$tmp = "Use
universal printing only"; Break}
"FallbackToUpd" {$tmp = "Use
universal printing only if requested driver is unavailable"; Break}
"FallbackToSpecific" {$tmp = "Use printer
model specific drivers only if universal printing is unavailable"; Break}
Default {$tmp = "Universal print driver
usage could not be determined: $($Setting.UniversalPrintDriverUsage.Value)"; Break}
}
$Setting.UpsPrintStreamInputBandwidthLimit.Value,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.UpsPrintStreamInputBandwidthLimit.Value
}
}
If((validStateProp $Setting UpsHttpPort State ) -and
($Setting.UpsHttpPort.State -ne "NotConfigured"))
{
$txt = "ICA\Printing\Universal Print
Server\Universal Print Server web service (HTTP/SOAP) port"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value = $Setting.UpsHttpPort.Value;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.UpsHttpPort.Value,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.UpsHttpPort.Value
}
}
$TmpArray =
$Setting.UPDCompressionDefaults.Value.Split(',')
$tmp = ""
ForEach($Thing in $TmpArray)
{
$TestLabel = $Thing.substring(0,
$Thing.indexof("="))
$TestSetting =
$Thing.substring($Thing.indexof("=")+1)
$TxtLabel = ""
$TxtSetting = ""
Switch($TestLabel)
{
"ImageCompression"
{
$TxtLabel = "Desired image
quality:"
Switch($TestSetting)
{
"StandardQuality"
{$TxtSetting = "Standard quality"; Break}
"BestQuality"
{$TxtSetting = "Best quality (lossless compression)"; Break}
"HighQuality"
{$TxtSetting = "High quality"; Break}
"ReducedQuality"
{$TxtSetting = "Reduced quality (maximum compression)"; Break}
}
}
"HeavyweightCompression"
{
$TxtLabel = "Enable
heavyweight compression:"
If($TestSetting -eq "True")
{
$TxtSetting = "Yes"
}
Else
{
$TxtSetting = "No"
}
}
"ImageCaching"
{
$TxtLabel = "Allow caching of
embedded images:"
If($TestSetting -eq "True")
{
$TxtSetting = "Yes"
}
Else
{
$TxtSetting = "No"
}
}
"FontCaching"
{
$TxtLabel = "Allow caching of
embedded fonts:"
If($TestSetting -eq "True")
{
$TxtSetting = "Yes"
}
Else
{
$TxtSetting = "No"
}
}
"AllowNonAdminsToModify"
{
$TxtLabel = "Allow non-
administrators to modify these settings:"
If($TestSetting -eq "True")
{
$TxtSetting = "Yes"
}
Else
{
$TxtSetting = "No"
}
}
}
$tmp = "$($TxtLabel) $TxtSetting "
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = "";
Value = $tmp;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
"",$htmlbold,
$tmp,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting
"`t`t`t`t`t`t`t`t`t" $tmp
}
}
$TmpArray = $Null
$tmp = $Null
$TestLabel = $Null
$TestSetting = $Null
$TxtLabel = $Null
$TxtSetting = $Null
}
If((validStateProp $Setting
UniversalPrintingPreviewPreference State ) -and
($Setting.UniversalPrintingPreviewPreference.State -ne "NotConfigured"))
{
$txt = "ICA\Printing\Universal
Printing\Universal printing preview preference"
$tmp = ""
Switch
($Setting.UniversalPrintingPreviewPreference.Value)
{
"NoPrintPreview" {$tmp = "Do not
use print preview for auto-created or generic universal printers"; Break}
"AutoCreatedOnly" {$tmp = "Use
print preview for auto-created printers only"; Break}
"GenericOnly" {$tmp = "Use
print preview for generic universal printers only"; Break}
"AutoCreatedAndGeneric" {$tmp = "Use
print preview for both auto-created and generic universal printers"; Break}
Default {$tmp = "Universal printing
preview preference could not be determined: $
($Setting.UniversalPrintingPreviewPreference.Value)"; Break}
}
$Setting.SessionDisconnectTimerInterval.Value,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.SessionDisconnectTimerInterval.Value
}
}
If((validStateProp $Setting SessionConnectionTimer
State ) -and ($Setting.SessionConnectionTimer.State -ne "NotConfigured"))
{
$txt = "ICA\Session Limits\Session connection
timer"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.SessionConnectionTimer.State;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.SessionConnectionTimer.State,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.SessionConnectionTimer.State
}
}
If((validStateProp $Setting
SessionConnectionTimerInterval State ) -and
($Setting.SessionConnectionTimerInterval.State -ne "NotConfigured"))
{
$txt = "ICA\Session Limits\Session connection
timer interval (minutes)"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.SessionConnectionTimerInterval.Value;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.SessionConnectionTimerInterval.Value,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.SessionConnectionTimerInterval.Value
}
}
If((validStateProp $Setting SessionIdleTimer State )
-and ($Setting.SessionIdleTimer.State -ne "NotConfigured"))
{
$txt = "ICA\Session Limits\Session idle timer"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value = $Setting.SessionIdleTimer.State;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.SessionIdleTimer.State,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.SessionIdleTimer.State
}
}
If((validStateProp $Setting SessionIdleTimerInterval
State ) -and ($Setting.SessionIdleTimerInterval.State -ne "NotConfigured"))
{
$txt = "ICA\Session Limits\Session idle timer
interval (minutes)"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.SessionIdleTimerInterval.Value;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.SessionIdleTimerInterval.Value,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.SessionIdleTimerInterval.Value
}
}
$Setting.SessionReliabilityConnections.State,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.SessionReliabilityConnections.State
}
}
If((validStateProp $Setting SessionReliabilityPort
State ) -and ($Setting.SessionReliabilityPort.State -ne "NotConfigured"))
{
$txt = "ICA\Session Reliability\Session
reliability port number"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.SessionReliabilityPort.Value;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.SessionReliabilityPort.Value,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.SessionReliabilityPort.Value
}
}
If((validStateProp $Setting SessionReliabilityTimeout
State ) -and ($Setting.SessionReliabilityTimeout.State -ne "NotConfigured"))
{
$txt = "ICA\Session Reliability\Session
reliability timeout (seconds)"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.SessionReliabilityTimeout.Value;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.SessionReliabilityTimeout.Value,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.SessionReliabilityTimeout.Value
}
}
$txt = ""
$cnt = -1
ForEach($element in $array)
{
$cnt++
If($cnt -ne 0)
{
$tmp = "$($element) "
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = "";
Value = $tmp;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
"",$htmlbold,
$tmp,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting ""
$tmp
}
}
}
$array = $Null
$tmp = $Null
}
Else
{
$tmp = "No Client USB device redirections
rules were found"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value = $tmp;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$tmp,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt $tmp
}
}
}
If((validStateProp $Setting UsbPlugAndPlayRedirection
State ) -and ($Setting.UsbPlugAndPlayRedirection.State -ne "NotConfigured"))
{
$txt = "ICA\USB devices\Client USB Plug and
Play device redirection"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.UsbPlugAndPlayRedirection.State;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.UsbPlugAndPlayRedirection.State,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.UsbPlugAndPlayRedirection.State
}
}
$Setting.MovingImageCompressionConfiguration.State,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.MovingImageCompressionConfiguration.State
}
}
If((validStateProp $Setting
ProgressiveCompressionLevel State ) -and
($Setting.ProgressiveCompressionLevel.State -ne "NotConfigured"))
{
$txt = "ICA\Visual Display\Moving
Images\Progressive compression level"
$tmp = ""
Switch
($Setting.ProgressiveCompressionLevel.Value)
{
"UltraHigh" {$tmp = "Ultra high"; Break}
"VeryHigh" {$tmp = "Very high"; Break}
"High" {$tmp = "High"; Break}
"Normal" {$tmp = "Normal"; Break}
"Low" {$tmp = "Low"; Break}
"None" {$tmp = "None"; Break}
Default {$tmp = "Progressive compression
level could not be determined: $($Setting.ProgressiveCompressionLevel.Value)";
Break}
}
$Setting.ProgressiveCompressionThreshold.Value,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.ProgressiveCompressionThreshold.Value
}
}
If((validStateProp $Setting
TargetedMinimumFramesPerSecond State ) -and
($Setting.TargetedMinimumFramesPerSecond.State -ne "NotConfigured"))
{
$txt = "ICA\Visual Display\Moving Images\Target
Minimum Frame Rate (fps)"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.TargetedMinimumFramesPerSecond.Value;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.TargetedMinimumFramesPerSecond.Value,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.TargetedMinimumFramesPerSecond.Value
}
}
$Setting.ExtraColorCompressionThreshold.Value,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.ExtraColorCompressionThreshold.Value
}
}
If((validStateProp $Setting
ProgressiveHeavyweightCompression State ) -and
($Setting.ProgressiveHeavyweightCompression.State -ne "NotConfigured"))
{
$txt = "ICA\Visual Display\Still
Images\Heavyweight compression"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.ProgressiveHeavyweightCompression.State;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.ProgressiveHeavyweightCompression.State,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.ProgressiveHeavyweightCompression.State
}
}
If((validStateProp $Setting LossyCompressionLevel
State ) -and ($Setting.LossyCompressionLevel.State -ne "NotConfigured"))
{
$txt = "ICA\Visual Display\Still Images\Lossy
compression level"
$tmp = ""
Switch ($Setting.LossyCompressionLevel.Value)
{
"None" {$tmp = "None"; Break}
"Low" {$tmp = "Low"; Break}
"Medium" {$tmp = "Medium"; Break}
"High" {$tmp = "High"; Break}
Default {$tmp = "Lossy
compression level could not be determined: $
($Setting.LossyCompressionLevel.Value)"; Break}
}
$Setting.AcceptWebSocketsConnections.State,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.AcceptWebSocketsConnections.State
}
}
If((validStateProp $Setting WebSocketsPort State )
-and ($Setting.WebSocketsPort.State -ne "NotConfigured"))
{
$txt = "ICA\WebSockets\WebSockets port number"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value = $Setting.WebSocketsPort.Value;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.WebSocketsPort.Value,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.WebSocketsPort.Value
}
}
If((validStateProp $Setting WSTrustedOriginServerList
State ) -and ($Setting.WSTrustedOriginServerList.State -ne "NotConfigured"))
{
$txt = "ICA\WebSockets\WebSockets trusted
origin server list"
$tmpArray =
$Setting.WSTrustedOriginServerList.Value.Split(",")
$tmp = ""
$cnt = 0
ForEach($Thing in $tmpArray)
{
$cnt++
$tmp = "$($Thing)"
If($cnt -eq 1)
{
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value = $tmp;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$tmp,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt $tmp
}
}
Else
{
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = "";
Value = $tmp;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
"",$htmlbold,
$tmp,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting "" $tmp
}
}
}
$tmpArray = $Null
$tmp = $Null
}
$Setting.UserSessionLimitAffectsAdministrators.State,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.UserSessionLimitAffectsAdministrators.State
}
}
If($Setting.UserSessionLimitLogging.State -ne
"NotConfigured")
{
$txt = "Server Settings\Connection
Limits\Logging of logon limit events"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.UserSessionLimitLogging.State;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.UserSessionLimitLogging.State,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.UserSessionLimitLogging.State
}
}
#the next 3 settings are available only for AD based
policies
If($Setting.InitialDatabaseName.State -ne
"NotConfigured")
{
$txt = "Server Settings\Database
Settings\Initial Database Name"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.InitialDatabaseName.Value;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.InitialDatabaseName.Value,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.InitialDatabaseName.Value
}
}
If($Setting.InitialDatabaseServerName.State -ne
"NotConfigured")
{
$txt = "Server Settings\Database
Settings\Initial Database Server Name"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.InitialDatabaseServerName.Value;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.InitialDatabaseServerName.Value,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.InitialDatabaseServerName.Value
}
}
If($Setting.InitialFailoverPartner.State -ne
"NotConfigured")
{
$txt = "Server Settings\Database
Settings\Initial Failover Partner"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.InitialFailoverPartner.Value;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.InitialFailoverPartner.Value,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.InitialFailoverPartner.Value
}
}
#the previous 3 settings are available only for AD
based policies
If($Setting.HealthMonitoring.State -ne
"NotConfigured")
{
$txt = "Server Settings\Health Monitoring and
Recovery\Health monitoring"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value = $Setting.HealthMonitoring.State;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.HealthMonitoring.State,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.HealthMonitoring.State
}
}
If($Setting.HealthMonitoringTests.State -ne
"NotConfigured")
{
$txt = "Server Settings\Health Monitoring and
Recovery\Health monitoring tests"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value = "";
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
"",$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt ""
}
[xml]$XML =
$Setting.HealthMonitoringTests.Value
ForEach($Test in $xml.hmrtests.tests.test)
{
Switch ($test.RecoveryAction)
{
"AlertOnly"
{$tmp = "Alert Only"}
"RemoveServerFromLoadBalancing"
{$tmp = "Remove Server from load balancing"}
"RestartIma"
{$tmp = "Restart IMA"}
"ShutdownIma"
{$tmp = "Shutdown IMA"}
"RebootServer"
{$tmp = "Reboot Server"}
Default {$tmp = "Recovery Action
could not be determined: $($test.RecoveryAction)"}
}
$tmparray = @()
$tmparray += "Name: $($test.name)"
$tmparray += "File Location: $
($test.file)"
$tmparray += "Arguments: $
($test.arguments)"
$tmparray += "Description: $
($test.description)"
$tmparray += "Interval: $
($test.interval)"
$tmparray += "Time-out: $($test.timeout)"
$tmparray += "Threshold: $
($test.threshold)"
$tmparray += "Recovery Action: $($tmp)"
ForEach($item in $tmparray)
{
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = "";
Value = $item;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
"",$htmlbold,
$item,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting
"`t`t`t`t`t`t`t`t`t" $item
}
}
#insert a blank line for spacing
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = "";
Value = "";
}
}
ElseIf($HTML)
{
$rowdata += @(,(
"",$htmlbold,
"",$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting "" ""
}
}
$XML = $Null
}
If($Setting.MaximumServersOfflinePercent.State -ne
"NotConfigured")
{
$txt = "Server Settings\Health Monitoring and
Recovery\Max % of servers with logon control"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.MaximumServersOfflinePercent.Value;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.MaximumServersOfflinePercent.Value,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.MaximumServersOfflinePercent.Value
}
}
If($Setting.CpuManagementServerLevel.State -ne
"NotConfigured")
{
Switch
($Setting.CpuManagementServerLevel.Value)
{
"NoManagement" {$tmp = "No CPU
utilization management"}
"Fair" {$tmp = "Fair sharing of
CPU between sessions"}
"Preferential" {$tmp = "Preferential Load
Balancing"}
Default {$tmp = "CPU management server
level could not be determined: $($Setting.CpuManagementServerLevel.Value)"}
}
$txt = "Server Settings\Memory/CPU\CPU
management server level"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value = $tmp;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$tmp,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt $tmp
}
$tmp = $Null
}
If($Setting.MemoryOptimization.State -ne
"NotConfigured")
{
$txt = "Server Settings\Memory/CPU\Memory
optimization"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.MemoryOptimization.State;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.MemoryOptimization.State,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.MemoryOptimization.State
}
}
If($Setting.MemoryOptimizationExcludedPrograms.State
-ne "NotConfigured")
{
$txt = "Server Settings\Memory/CPU\Memory
optimization application exclusion lis"
$tmpArray =
$Setting.MemoryOptimizationExcludedPrograms.Values
$tmp = ""
$cnt = 0
ForEach($Thing in $tmpArray)
{
$cnt++
$tmp = "$($Thing)"
If($cnt -eq 1)
{
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value = $tmp;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$tmp,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt $tmp
}
}
Else
{
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = "";
Value = $tmp;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
"",$htmlbold,
$tmp,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting "" $tmp
}
}
}
$tmpArray = $Null
$tmp = $Null
}
If($Setting.MemoryOptimizationIntervalType.State -ne
"NotConfigured")
{
Switch
($Setting.MemoryOptimizationIntervalType.Value)
{
"AtStartup" {$tmp = "Only at startup
time"}
"Daily" {$tmp = "Daily"}
"Weekly" {$tmp = "Weekly"}
"Monthly" {$tmp = "Monthly"}
Default {$tmp = " could not be
determined: $($Setting.MemoryOptimizationIntervalType.Value)"}
}
$txt = "Server Settings\Memory/CPU\Memory
optimization interval"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value = $tmp;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$tmp,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt $tmp
}
$tmp = $Null
}
If($Setting.MemoryOptimizationDayOfMonth.State -ne
"NotConfigured")
{
$txt = "Server Settings\Memory/CPU\Memory
optimization schedule\day of month"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.MemoryOptimizationDayOfMonth.Value;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.MemoryOptimizationDayOfMonth.Value,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.MemoryOptimizationDayOfMonth.Value
}
}
If($Setting.MemoryOptimizationDayOfWeek.State -ne
"NotConfigured")
{
$txt = "Server Settings\Memory/CPU\Memory
optimization schedule\day of week"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.MemoryOptimizationDayOfWeek.Value;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.MemoryOptimizationDayOfWeek.Value,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.MemoryOptimizationDayOfWeek.Value
}
}
If($Setting.MemoryOptimizationTime.State -ne
"NotConfigured")
{
$tmp = ConvertNumberToTime
$Setting.MemoryOptimizationTime.Value
$txt = "Server Settings\Memory/CPU\Memory
optimization schedule time"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value = $tmp;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$tmp,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt $tmp
}
$tmp = $Null
}
If($Setting.OfflineClientTrust.State -ne
"NotConfigured")
{
$txt = "Server Settings\Offline
Applications\Offline app client trust"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.OfflineClientTrust.State;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.OfflineClientTrust.State,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.OfflineClientTrust.State
}
}
If($Setting.OfflineEventLogging.State -ne
"NotConfigured")
{
$txt = "Server Settings\Offline
Applications\Offline app event logging"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.OfflineEventLogging.State;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.OfflineEventLogging.State,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.OfflineEventLogging.State
}
}
If($Setting.OfflineLicensePeriod.State -ne
"NotConfigured")
{
$txt = "Server Settings\Offline
Applications\Offline app license period - Days"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.OfflineLicensePeriod.Value;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.OfflineLicensePeriod.Value,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.OfflineLicensePeriod.Value
}
}
If($Setting.OfflineUsers.State -ne "NotConfigured")
{
$array = $Null
$txt = "Server Settings\Offline
Applications\Offline app users"
$tmpArray = $Setting.OfflineUsers.Values
$tmp = ""
$cnt = 0
ForEach($Thing in $tmpArray)
{
$cnt++
$tmp = "$($Thing)"
If($cnt -eq 1)
{
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value = $tmp;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$tmp,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt $tmp
}
}
Else
{
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = "";
Value = $tmp;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
"",$htmlbold,
$tmp,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting "" $tmp
}
}
}
$tmpArray = $Null
$tmp = $Null
}
If($Setting.RebootCustomMessage.State -ne
"NotConfigured")
{
$txt = "Server Settings\Reboot Behavior\Reboot
custom warning"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.RebootCustomMessage.State;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.RebootCustomMessage.State,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.RebootCustomMessage.State
}
}
If($Setting.RebootCustomMessageText.State -ne
"NotConfigured")
{
$txt = "Server Settings\Reboot Behavior\Reboot
custom warning text"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.RebootCustomMessageText.Value;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.RebootCustomMessageText.Value,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.RebootCustomMessageText.Value
}
}
If($Setting.RebootDisableLogOnTime.State -ne
"NotConfigured")
{
Switch ($Setting.RebootDisableLogOnTime.Value)
{
"DoNotDisableLogOnsBeforeReboot" {$tmp =
"Do not disable logons before reboot"}
"Disable5MinutesBeforeReboot" {$tmp =
"Disable 5 minutes before reboot"}
"Disable10MinutesBeforeReboot" {$tmp =
"Disable 10 minutes before reboot"}
"Disable15MinutesBeforeReboot" {$tmp =
"Disable 15 minutes before reboot"}
"Disable30MinutesBeforeReboot" {$tmp =
"Disable 30 minutes before reboot"}
"Disable60MinutesBeforeReboot" {$tmp =
"Disable 60 minutes before reboot"}
Default {$tmp = "Reboot logon disable
time could not be determined: $($Setting.RebootDisableLogOnTime.Value)"}
}
$txt = "Server Settings\Reboot Behavior\Reboot
logon disable time"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value = $tmp;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$tmp,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt $tmp
}
$tmp = $Null
}
If($Setting.RebootScheduleFrequency.State -ne
"NotConfigured")
{
$txt = "Server Settings\Reboot Behavior\Reboot
schedule frequency - Days"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.RebootScheduleFrequency.Value;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.RebootScheduleFrequency.Value,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.RebootScheduleFrequency.Value
}
}
If($Setting.RebootScheduleRandomizationInterval.State
-ne "NotConfigured")
{
$txt = "Server Settings\Reboot Behavior\Reboot
schedule randomization interval\Minutes"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.RebootScheduleRandomizationInterval.Value;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.RebootScheduleRandomizationInterval.Value,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.RebootScheduleRandomizationInterval.Value
}
}
If($Setting.RebootScheduleStartDate.State -ne
"NotConfigured")
{
$Tmp = ConvertIntegerToDate
$Setting.RebootScheduleStartDate.Value
$txt = "Server Settings\Reboot Behavior\Reboot
schedule start date"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value = $tmp;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$tmp,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt $tmp
}
$Tmp = $Null
}
If($Setting.RebootScheduleTime.State -ne
"NotConfigured")
{
$tmp = ConvertNumberToTime
$Setting.RebootScheduleTime.Value
$txt = "Server Settings\Reboot Behavior\Reboot
schedule time"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value = $tmp;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$tmp,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt $tmp
}
$Tmp = $Null
}
If($Setting.RebootWarningInterval.State -ne
"NotConfigured")
{
Switch ($Setting.RebootWarningInterval.Value)
{
"Every1Minute" {$tmp = "Every 1
Minute"}
"Every3Minutes" {$tmp = "Every 3
Minutes"}
"Every5Minutes" {$tmp = "Every 5
Minutes"}
"Every10Minutes" {$tmp = "Every 10
Minutes"}
"Every15Minutes" {$tmp = "Every 15
Minutes"}
Default {$tmp = "Reboot warning interval
could not be determined: $($Setting.RebootWarningInterval.Value)"}
}
$txt = "Server Settings\Reboot Behavior\Reboot
warning interval"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value = $tmp;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$tmp,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt $tmp
}
$Tmp = $Null
}
If($Setting.RebootWarningStartTime.State -ne
"NotConfigured")
{
Switch ($Setting.RebootWarningStartTime.Value)
{
"Start5MinutesBeforeReboot" {$tmp =
"Start 5 Minutes Before Reboot"}
"Start10MinutesBeforeReboot" {$tmp =
"Start 10 Minutes Before Reboot"}
"Start15MinutesBeforeReboot" {$tmp =
"Start 15 Minutes Before Reboot"}
"Start30MinutesBeforeReboot" {$tmp =
"Start 30 Minutes Before Reboot"}
"Start60MinutesBeforeReboot" {$tmp =
"Start 60 Minutes Before Reboot"}
Default {$tmp = "Reboot warning start
time could not be determined: $($Setting.RebootWarningStartTime.Value)"}
}
$txt = "Server Settings\Reboot Behavior\Reboot
warning start time"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value = $tmp;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$tmp,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt $tmp
}
$Tmp = $Null
}
If($Setting.RebootWarningMessage.State -ne
"NotConfigured")
{
$txt = "Server Settings\Reboot Behavior\Reboot
warning to users"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value =
$Setting.RebootWarningMessage.State;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.RebootWarningMessage.State,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.RebootWarningMessage.State
}
}
If($Setting.ScheduledReboots.State -ne
"NotConfigured")
{
$txt = "Server Settings\Reboot
Behavior\Scheduled reboots"
If($MSWord -or $PDF)
{
$SettingsWordTable += @{
Text = $txt;
Value = $Setting.ScheduledReboots.State;
}
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.ScheduledReboots.State,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.ScheduledReboots.State
}
}
Write-Host "$(Get-Date): `t`t`tVirtual Delivery Agent
Settings" -BackgroundColor Black -ForegroundColor Yellow
If((validStateProp $Setting
ControllerRegistrationPort State ) -and ($Setting.ControllerRegistrationPort.State
-ne "NotConfigured"))
{
#AD specific setting
$txt = "Virtual Delivery Agent
Settings\Controller registration port"
If($MSWord -or $PDF)
{
$WordTableRowHash = @{
Text = $txt;
Value =
$Setting.ControllerRegistrationPort.Value;
}
$SettingsWordTable += $WordTableRowHash;
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.ControllerRegistrationPort.Value,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.ControllerRegistrationPort.Value
}
}
If((validStateProp $Setting ControllerSIDs State )
-and ($Setting.ControllerSIDs.State -ne "NotConfigured"))
{
#AD specific setting
$txt = "Virtual Delivery Agent
Settings\Controller SIDs"
If($MSWord -or $PDF)
{
$WordTableRowHash = @{
Text = $txt;
Value = $Setting.ControllerSIDs.Value;
}
$SettingsWordTable += $WordTableRowHash;
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.ControllerSIDs.Value,
$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.ControllerSIDs.Value
}
}
If((validStateProp $Setting Controllers State ) -and
($Setting.Controllers.State -ne "NotConfigured"))
{
#AD specific setting
$txt = "Virtual Delivery Agent
Settings\Controllers"
If($MSWord -or $PDF)
{
$WordTableRowHash = @{
Text = $txt;
Value = $Setting.Controllers.Value;
}
$SettingsWordTable += $WordTableRowHash;
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.Controllers.Value,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.Controllers.Value
}
}
$Setting.CPUUsageMonitoring_Threshold.Value,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.CPUUsageMonitoring_Threshold.Value
}
}
$Setting.ICALatencyMonitoring_Enable.State,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.ICALatencyMonitoring_Enable.State
}
}
If((validStateProp $Setting
ICALatencyMonitoring_Period State ) -and
($Setting.ICALatencyMonitoring_Period.State -ne "NotConfigured"))
{
$txt = "Virtual Delivery Agent Settings\ICA
Latency Monitoring\Monitoring Period seconds"
If($MSWord -or $PDF)
{
$WordTableRowHash = @{
Text = $txt;
Value =
$Setting.ICALatencyMonitoring_Period.Value;
}
$SettingsWordTable += $WordTableRowHash;
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.ICALatencyMonitoring_Period.Value,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.ICALatencyMonitoring_Period.Value
}
}
If((validStateProp $Setting
ICALatencyMonitoring_Threshold State ) -and
($Setting.ICALatencyMonitoring_Threshold.State -ne "NotConfigured"))
{
$txt = "Virtual Delivery Agent Settings\ICA
Latency Monitoring\Threshold milliseconds"
If($MSWord -or $PDF)
{
$WordTableRowHash = @{
Text = $txt;
Value =
$Setting.ICALatencyMonitoring_Threshold.Value;
}
$SettingsWordTable += $WordTableRowHash;
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.ICALatencyMonitoring_Threshold.Value,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.ICALatencyMonitoring_Threshold.Value
}
}
$Setting.ProfileLoadTimeMonitoring_Enable.State,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.ProfileLoadTimeMonitoring_Enable.State
}
}
If((validStateProp $Setting
ProfileLoadTimeMonitoring_Threshold State ) -and
($Setting.ProfileLoadTimeMonitoring_Threshold.State -ne "NotConfigured"))
{
$txt = "Virtual Delivery Agent Settings\Profile
Load Time Monitoring\Threshold seconds"
If($MSWord -or $PDF)
{
$WordTableRowHash = @{
Text = $txt;
Value =
$Setting.ProfileLoadTimeMonitoring_Threshold.Value;
}
$SettingsWordTable += $WordTableRowHash;
}
ElseIf($HTML)
{
$rowdata += @(,(
$txt,$htmlbold,
$Setting.ProfileLoadTimeMonitoring_Threshold.Value,$htmlwhite))
}
ElseIf($Text)
{
OutputPolicySetting $txt
$Setting.ProfileLoadTimeMonitoring_Threshold.Value
}
}
SetWordCellFormat -Collection
$Table.Rows.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;
$Table.Columns.Item(1).Width = 300;
$Table.Columns.Item(2).Width = 200;
$Table.Rows.SetLeftIndent($Indent0TabStops,
$wdAdjustProportional)
}
Else
{
WriteWordLine 0 1 "There are no policy
settings"
}
FindWordDocumentEnd
$Table = $Null
}
ElseIf($Text)
{
Line 0 ""
}
ElseIf($HTML)
{
If($rowdata.count -gt 0)
{
$columnHeaders = @(
'Setting Key',($htmlsilver -bor $htmlbold),
'Value',($htmlsilver -bor $htmlbold))
$msg = ""
$columnWidths = @("400","300")
FormatHTMLTable $msg -rowArray $rowdata
-columnArray $columnHeaders -fixedWidth $columnWidths -tablewidth "700"
WriteHTMLLine 0 0 " "
}
}
}
Else
{
$txt = "Unable to retrieve settings"
If($MSWord -or $PDF)
{
WriteWordLine 0 1 $txt
}
ElseIf($Text)
{
Line 2 $txt
}
ElseIf($HTML)
{
WriteHTMLLine 0 1 $txt
}
}
$Filter = $Null
$Settings = $Null
Write-Host "$(Get-Date): `t`tFinished $($Policy.PolicyName)"
-BackgroundColor Black -ForegroundColor Yellow
Write-Host "$(Get-Date): " -BackgroundColor Black
-ForegroundColor Yellow
}
}
ElseIf(!$?)
{
Write-Warning "Citrix Policy information could not be retrieved"
}
Else
{
Write-Warning "No results Returned for Citrix Policy information"
}
$HDXPolicies = $Null
If($xDriveName -ne "localfarmgpo")
{
Write-Host "$(Get-Date): `tRemoving $($xDriveName) PSDrive"
-BackgroundColor Black -ForegroundColor Yellow
Remove-PSDrive $xDriveName -EA 0 4>Null
Write-Host "$(Get-Date): " -BackgroundColor Black -ForegroundColor
Yellow
}
}
Function OutputPolicySetting
{
Param([string] $outputText, [string] $outputData)
Function Get-PrinterModifiedSettings
{
Param([string]$Value, [string]$xelement)
[string]$ReturnStr = ""
Switch ($Value)
{
"copi"
{
$txt="Copies: "
$index = $xelement.SubString(0).IndexOf('=')
If($index -ge 0)
{
$tmp2 = $xelement.SubString($index + 1)
$ReturnStr = "$txt $tmp2"
}
}
"coll"
{
$txt="Collate: "
$index = $xelement.SubString(0).IndexOf('=')
If($index -ge 0)
{
$tmp2 = $xelement.SubString($index + 1)
$ReturnStr = "$txt $tmp2"
}
}
"scal"
{
$txt="Scale (%): "
$index = $xelement.SubString(0).IndexOf('=')
If($index -ge 0)
{
$tmp2 = $xelement.SubString($index + 1)
$ReturnStr = "$txt $tmp2"
}
}
"colo"
{
$txt="Color: "
$index = $xelement.SubString(0).IndexOf('=')
If($index -ge 0)
{
$tmp1 = $xelement.SubString($index + 1)
Switch ($tmp1)
{
1 {$tmp2 = "Monochrome"; Break}
2 {$tmp2 = "Color"; Break}
Default {$tmp2 = "Color could not be determined: $
($xelement) "; Break}
}
$ReturnStr = "$txt $tmp2"
}
}
"prin"
{
$txt="Print Quality: "
$index = $xelement.SubString(0).IndexOf('=')
If($index -ge 0)
{
$tmp1 = $xelement.SubString($index + 1)
Switch ($tmp1)
{
-1 {$tmp2 = "150 dpi"; Break}
-2 {$tmp2 = "300 dpi"; Break}
-3 {$tmp2 = "600 dpi"; Break}
-4 {$tmp2 = "1200 dpi"; Break}
Default {$tmp2 = "Custom...X resolution: $tmp1";
Break}
}
$ReturnStr = "$txt $tmp2"
}
}
"yres"
{
$txt="Y resolution: "
$index = $xelement.SubString(0).IndexOf('=')
If($index -ge 0)
{
$tmp2 = $xelement.SubString($index + 1)
$ReturnStr = "$txt $tmp2"
}
}
"orie"
{
$txt="Orientation: "
$index = $xelement.SubString(0).IndexOf('=')
If($index -ge 0)
{
$tmp1 = $xelement.SubString($index + 1)
Switch ($tmp1)
{
"portrait" {$tmp2 = "Portrait"; Break}
"landscape" {$tmp2 = "Landscape"; Break}
Default {$tmp2 = "Orientation could not be
determined: $($xelement) ; Break"}
}
$ReturnStr = "$txt $tmp2"
}
}
"dupl"
{
$txt="Duplex: "
$index = $xelement.SubString(0).IndexOf('=')
If($index -ge 0)
{
$tmp1 = $xelement.SubString($index + 1)
Switch ($tmp1)
{
1 {$tmp2 = "Simplex"; Break}
2 {$tmp2 = "Vertical"; Break}
3 {$tmp2 = "Horizontal"; Break}
Default {$tmp2 = "Duplex could not be determined: $
($xelement) "; Break}
}
$ReturnStr = "$txt $tmp2"
}
}
"pape"
{
$txt="Paper Size: "
$index = $xelement.SubString(0).IndexOf('=')
If($index -ge 0)
{
$tmp1 = $xelement.SubString($index + 1)
Switch ($tmp1)
{
1 {$tmp2 = "Letter"; Break}
2 {$tmp2 = "Letter Small"; Break}
3 {$tmp2 = "Tabloid"; Break}
4 {$tmp2 = "Ledger"; Break}
5 {$tmp2 = "Legal"; Break}
6 {$tmp2 = "Statement"; Break}
7 {$tmp2 = "Executive"; Break}
8 {$tmp2 = "A3"; Break}
9 {$tmp2 = "A4"; Break}
10 {$tmp2 = "A4 Small"; Break}
11 {$tmp2 = "A5"; Break}
12 {$tmp2 = "B4 (JIS)"; Break}
13 {$tmp2 = "B5 (JIS)"; Break}
14 {$tmp2 = "Folio"; Break}
15 {$tmp2 = "Quarto"; Break}
16 {$tmp2 = "10X14"; Break}
17 {$tmp2 = "11X17"; Break}
18 {$tmp2 = "Note"; Break}
19 {$tmp2 = "Envelope #9"; Break}
20 {$tmp2 = "Envelope #10"; Break}
21 {$tmp2 = "Envelope #11"; Break}
22 {$tmp2 = "Envelope #12"; Break}
23 {$tmp2 = "Envelope #14"; Break}
24 {$tmp2 = "C Size Sheet"; Break}
25 {$tmp2 = "D Size Sheet"; Break}
26 {$tmp2 = "E Size Sheet"; Break}
27 {$tmp2 = "Envelope DL"; Break}
28 {$tmp2 = "Envelope C5"; Break}
29 {$tmp2 = "Envelope C3"; Break}
30 {$tmp2 = "Envelope C4"; Break}
31 {$tmp2 = "Envelope C6"; Break}
32 {$tmp2 = "Envelope C65"; Break}
33 {$tmp2 = "Envelope B4"; Break}
34 {$tmp2 = "Envelope B5"; Break}
35 {$tmp2 = "Envelope B6"; Break}
36 {$tmp2 = "Envelope Italy"; Break}
37 {$tmp2 = "Envelope Monarch"; Break}
38 {$tmp2 = "Envelope Personal"; Break}
39 {$tmp2 = "US Std Fanfold"; Break}
40 {$tmp2 = "German Std Fanfold"; Break}
41 {$tmp2 = "German Legal Fanfold"; Break}
42 {$tmp2 = "B4 (ISO)"; Break}
43 {$tmp2 = "Japanese Postcard"; Break}
44 {$tmp2 = "9X11"; Break}
45 {$tmp2 = "10X11"; Break}
46 {$tmp2 = "15X11"; Break}
47 {$tmp2 = "Envelope Invite"; Break}
48 {$tmp2 = "Reserved - DO NOT USE"; Break}
49 {$tmp2 = "Reserved - DO NOT USE"; Break}
50 {$tmp2 = "Letter Extra"; Break}
51 {$tmp2 = "Legal Extra"; Break}
52 {$tmp2 = "Tabloid Extra"; Break}
53 {$tmp2 = "A4 Extra"; Break}
54 {$tmp2 = "Letter Transverse"; Break}
55 {$tmp2 = "A4 Transverse"; Break}
56 {$tmp2 = "Letter Extra Transverse"; Break}
57 {$tmp2 = "A Plus"; Break}
58 {$tmp2 = "B Plus"; Break}
59 {$tmp2 = "Letter Plus"; Break}
60 {$tmp2 = "A4 Plus"; Break}
61 {$tmp2 = "A5 Transverse"; Break}
62 {$tmp2 = "B5 (JIS) Transverse"; Break}
63 {$tmp2 = "A3 Extra"; Break}
64 {$tmp2 = "A5 Extra"; Break}
65 {$tmp2 = "B5 (ISO) Extra"; Break}
66 {$tmp2 = "A2"; Break}
67 {$tmp2 = "A3 Transverse"; Break}
68 {$tmp2 = "A3 Extra Transverse"; Break}
69 {$tmp2 = "Japanese Double Postcard"; Break}
70 {$tmp2 = "A6"; Break}
71 {$tmp2 = "Japanese Envelope Kaku #2"; Break}
72 {$tmp2 = "Japanese Envelope Kaku #3"; Break}
73 {$tmp2 = "Japanese Envelope Chou #3"; Break}
74 {$tmp2 = "Japanese Envelope Chou #4"; Break}
75 {$tmp2 = "Letter Rotated"; Break}
76 {$tmp2 = "A3 Rotated"; Break}
77 {$tmp2 = "A4 Rotated"; Break}
78 {$tmp2 = "A5 Rotated"; Break}
79 {$tmp2 = "B4 (JIS) Rotated"; Break}
80 {$tmp2 = "B5 (JIS) Rotated"; Break}
81 {$tmp2 = "Japanese Postcard Rotated"; Break}
82 {$tmp2 = "Double Japanese Postcard Rotated";
Break}
83 {$tmp2 = "A6 Rotated"; Break}
84 {$tmp2 = "Japanese Envelope Kaku #2 Rotated";
Break}
85 {$tmp2 = "Japanese Envelope Kaku #3 Rotated";
Break}
86 {$tmp2 = "Japanese Envelope Chou #3 Rotated";
Break}
87 {$tmp2 = "Japanese Envelope Chou #4 Rotated";
Break}
88 {$tmp2 = "B6 (JIS)"; Break}
89 {$tmp2 = "B6 (JIS) Rotated"; Break}
90 {$tmp2 = "12X11"; Break}
91 {$tmp2 = "Japanese Envelope You #4"; Break}
92 {$tmp2 = "Japanese Envelope You #4 Rotated";
Break}
93 {$tmp2 = "PRC 16K"; Break}
94 {$tmp2 = "PRC 32K"; Break}
95 {$tmp2 = "PRC 32K(Big)"; Break}
96 {$tmp2 = "PRC Envelope #1"; Break}
97 {$tmp2 = "PRC Envelope #2"; Break}
98 {$tmp2 = "PRC Envelope #3"; Break}
99 {$tmp2 = "PRC Envelope #4"; Break}
100 {$tmp2 = "PRC Envelope #5"; Break}
101 {$tmp2 = "PRC Envelope #6"; Break}
102 {$tmp2 = "PRC Envelope #7"; Break}
103 {$tmp2 = "PRC Envelope #8"; Break}
104 {$tmp2 = "PRC Envelope #9"; Break}
105 {$tmp2 = "PRC Envelope #10"; Break}
106 {$tmp2 = "PRC 16K Rotated"; Break}
107 {$tmp2 = "PRC 32K Rotated"; Break}
108 {$tmp2 = "PRC 32K(Big) Rotated"; Break}
109 {$tmp2 = "PRC Envelope #1 Rotated"; Break}
110 {$tmp2 = "PRC Envelope #2 Rotated"; Break}
111 {$tmp2 = "PRC Envelope #3 Rotated"; Break}
112 {$tmp2 = "PRC Envelope #4 Rotated"; Break}
113 {$tmp2 = "PRC Envelope #5 Rotated"; Break}
114 {$tmp2 = "PRC Envelope #6 Rotated"; Break}
115 {$tmp2 = "PRC Envelope #7 Rotated"; Break}
116 {$tmp2 = "PRC Envelope #8 Rotated"; Break}
117 {$tmp2 = "PRC Envelope #9 Rotated"; Break}
Default {$tmp2 = "Paper Size could not be determined:
$($xelement) "; Break}
}
$ReturnStr = "$txt $tmp2"
}
}
"form"
{
$txt="Form Name: "
$index = $xelement.SubString(0).IndexOf('=')
If($index -ge 0)
{
$tmp2 = $xelement.SubString($index + 1)
If($tmp2.length -gt 0)
{
$ReturnStr = "$txt $tmp2"
}
}
}
"true"
{
$txt="TrueType: "
$index = $xelement.SubString(0).IndexOf('=')
If($index -ge 0)
{
$tmp1 = $xelement.SubString($index + 1)
Switch ($tmp1)
{
1 {$tmp2 = "Bitmap"; Break}
2 {$tmp2 = "Download"; Break}
3 {$tmp2 = "Substitute"; Break}
4 {$tmp2 = "Outline"; Break}
Default {$tmp2 = "TrueType could not be determined: $
($xelement) "; Break}
}
}
$ReturnStr = "$txt $tmp2"
}
"mode"
{
$txt="Printer Model: "
$index = $xelement.SubString(0).IndexOf('=')
If($index -ge 0)
{
$tmp2 = $xelement.SubString($index + 1)
$ReturnStr = "$txt $tmp2"
}
}
"loca"
{
$txt="Location: "
$index = $xelement.SubString(0).IndexOf('=')
If($index -ge 0)
{
$tmp2 = $xelement.SubString($index + 1)
If($tmp2.length -gt 0)
{
$ReturnStr = "$txt $tmp2"
}
}
}
Default {$ReturnStr = "Session printer setting could not be determined:
$($xelement) "}
}
Return $ReturnStr
}
Function GetCtxGPOsInAD
{
#thanks to the Citrix Engineering Team for pointers and for Michael B. Smith
for creating the function
#updated 07-Nov-13 to work in a Windows Workgroup environment
#update 12-Dec-2018 to work in PoSH V2
Write-Host "$(Get-Date): Testing for an Active Directory environment"
-BackgroundColor Black -ForegroundColor Yellow
$root = [ADSI]"LDAP://RootDSE"
If([String]::IsNullOrEmpty($root.PSBase.Name))
{
Write-Host "$(Get-Date): `tNot in an Active Directory environment"
-BackgroundColor Black -ForegroundColor Yellow
$root = $Null
$xArray = @()
}
Else
{
Write-Host "$(Get-Date): `tIn an Active Directory environment"
-BackgroundColor Black -ForegroundColor Yellow
$domainNC = $root.Properties[ 'defaultNamingContext' ].Value
$root = $Null
$xArray = @()
ForEach($Item in $Script:SessionSharingItems)
{
If($Item.AccessControlFilters -is [array])
{
$cnt = -1
ForEach($x in $Item.AccessControlFilters)
{
$cnt++
If($cnt -eq 0)
{
$WordTableRowHash = @{ ApplicationName =
$Item.ApplicationName;
MaximumColorQuality =
$Item.MaximumColorQuality;
SessionWindowSize =
$Item.SessionWindowSize;
AccessControlFilters = $x;
Encryption = $Item.Encryption}
$ItemsWordTable += $WordTableRowHash;
}
Else
{
$WordTableRowHash = @{ ApplicationName =
"";
MaximumColorQuality = "";
SessionWindowSize = "";
AccessControlFilters = $x;
Encryption = ""}
$ItemsWordTable += $WordTableRowHash;
}
}
}
Else
{
$WordTableRowHash = @{ ApplicationName =
$Item.ApplicationName;
MaximumColorQuality = $Item.MaximumColorQuality;
SessionWindowSize = $Item.SessionWindowSize;
AccessControlFilters = $Item.AccessControlFilters;
Encryption = $Item.Encryption}
$ItemsWordTable += $WordTableRowHash;
}
}
$Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
FindWordDocumentEnd
$Table = $Null
}
ElseIf($Text)
{
Line 0 "Appendix A - Session Sharing Items from CTX159159"
ForEach($Item in $Script:SessionSharingItems)
{
If($Item.AccessControlFilters -is [array])
{
Line 1 "Application Name`t: " $Item.ApplicationName
Line 1 "Maximum color quality`t: "
$Item.MaximumColorQuality
Line 1 "Session window size`t: "
$Item.SessionWindowSize
$cnt = -1
ForEach($AccessCondition in
$Item.AccessControlFilters)
{
$cnt++
If($cnt -eq 0)
{
[string]$Tmp = $AccessCondition
[string]$AGFarm = $Tmp.substring(0,
$Tmp.indexof(":"))
[string]$AGFilter =
$Tmp.substring($Tmp.indexof(":")+1)
Line 1 "Access Control Filters`t: $
($AGFarm) $($AGFilter)"
}
Else
{
[string]$Tmp = $AccessCondition
[string]$AGFarm = $Tmp.substring(0,
$Tmp.indexof(":"))
[string]$AGFilter =
$Tmp.substring($Tmp.indexof(":")+1)
Line 4 " $($AGFarm) $($AGFilter)"
}
}
Line 1 "Encryption`t`t: " $Item.Encryption
Line 0 ""
}
Else
{
Line 1 "Application Name`t: " $Item.ApplicationName
Line 1 "Maximum color quality`t: "
$Item.MaximumColorQuality
Line 1 "Session window size`t: "
$Item.SessionWindowSize
Line 1 "Access Control Filters`t: "
$Item.AccessControlFilters
Line 1 "Encryption`t`t: " $Item.Encryption
Line 0 ""
}
}
$tmp = $Null
$AGFarm = $Null
$AGFilter = $Null
}
ElseIf($HTML)
{
WriteHTMLLine 1 0 "Appendix A - Session Sharing Items from
CTX159159"
$rowdata = @()
$columnHeaders = @(
'Application Name',($htmlsilver -bor $htmlbold),
'Maximum color quality',($htmlsilver -bor $htmlbold),
'Session window size',($htmlsilver -bor $htmlbold),
'Access Control Filters',($htmlsilver -bor $htmlbold),
'Encryption',($htmlsilver -bor $htmlbold))
ForEach($Item in $Script:SessionSharingItems)
{
If($Item.AccessControlFilters -is [array])
{
$cnt = -1
ForEach($x in $Item.AccessControlFilters)
{
$cnt++
If($cnt -eq 0)
{
$rowdata += @(,(
$Item.ApplicationName,$htmlwhite,
$Item.MaximumColorQuality,$htmlwhite,
$Item.SessionWindowSize,$htmlwhite,
$x,$htmlwhite,
$Item.Encryption,$htmlwhite))
}
Else
{
$rowdata += @(,(
"",$htmlwhite,
"",$htmlwhite,
"",$htmlwhite,
$x,$htmlwhite,
"",$htmlwhite))
}
}
}
Else
{
$rowdata += @(,(
$Item.ApplicationName,$htmlwhite,
$Item.MaximumColorQuality,$htmlwhite,
$Item.SessionWindowSize,$htmlwhite,
$Item.AccessControlFilters,$htmlwhite,
$Item.Encryption,$htmlwhite))
}
}
$msg = ""
FormatHTMLTable $msg "auto" -rowArray $rowdata -columnArray
$columnHeaders
WriteHTMLLine 0 0 ""
$Tmp = ""
ForEach($Item in $ServerItems)
{
$Tmp = $Null
If([String]::IsNullOrEmpty($Item.LicenseServer))
{
$Tmp = "Set by policy"
}
Else
{
$Tmp = $Item.LicenseServer
}
## Add the required key/values to the hashtable
$WordTableRowHash = @{ ServerName = $Item.ServerName;
ZoneName = $Item.ZoneName;
OSVersion = $Item.OSVersion;
CitrixVersion = $Item.CitrixVersion;
ProductEdition = $Item.ProductEdition;
LicenseServer = $Tmp
SessionSharing = $Item.SessionSharing}
## Add the hash to the array
$ItemsWordTable += $WordTableRowHash;
$CurrentServiceIndex++;
$Tmp = $Null
}
$Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
FindWordDocumentEnd
$Table = $Null
}
ElseIf($Text)
{
Line 0 "Appendix B - Server Major Items"
$Tmp = ""
ForEach($Item in $ServerItems)
{
If([String]::IsNullOrEmpty($Item.LicenseServer))
{
$Tmp = "Set by policy"
}
Else
{
$Tmp = $Item.LicenseServer
}
Line 1 "Server Name`t: " $Item.ServerName
Line 1 "Zone Name`t: " $Item.ZoneName
Line 1 "OS Version`t: " $Item.OSVersion
Line 1 "Citrix Version`t: " $Item.CitrixVersion
Line 1 "Product Edition`t: " $Item.ProductEdition
Line 1 "License Server`t: " $Tmp
Line 1 "Session Sharing`t: " $Item.SessionSharing
Line 0 ""
$Tmp = $Null
}
}
ElseIf($HTML)
{
WriteHTMLLine 1 0 "Appendix B - Server Major Items"
$rowdata = @()
$columnHeaders = @(
'Server Name',($htmlsilver -bor $htmlbold),
'Zone Name',($htmlsilver -bor $htmlbold),
'OS Version',($htmlsilver -bor $htmlbold),
'Citrix Version',($htmlsilver -bor $htmlbold),
'Product Edition',($htmlsilver -bor $htmlbold),
'License Server',($htmlsilver -bor $htmlbold),
'Session Sharing',($htmlsilver -bor $htmlbold))
ForEach($Item in $ServerItems)
{
If([String]::IsNullOrEmpty($Item.LicenseServer))
{
$Tmp = "Set by policy"
}
Else
{
$Tmp = $Item.LicenseServer
}
$rowdata += @(,(
$Item.ServerName,$htmlwhite,
$Item.ZoneName,$htmlwhite,
$Item.OSVersion,$htmlwhite,
$Item.CitrixVersion,$htmlwhite,
$Item.ProductEdition,$htmlwhite,
$Tmp,$htmlwhite,
$Item.SessionSharing,$htmlwhite))
$Tmp = $Null
}
$msg = ""
FormatHTMLTable $msg "auto" -rowArray $rowdata -columnArray
$columnHeaders
WriteHTMLLine 0 0 ""
}
Function OutputSummarySummaryPage
{
If($MSWord -or $PDF)
{
$selection.InsertNewPage()
WriteWordLine 1 0 "Summary Page"
WriteWordLine 0 0 "Administrators"
[System.Collections.Hashtable[]] $ScriptInformation = @()
$ScriptInformation += @{ Data = "Total Administrators"; Value =
$Script:TotalAdmins; }
$Table.Columns.Item(1).Width = 200;
$Table.Columns.Item(2).Width = 150;
$Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
FindWordDocumentEnd
$Table = $Null
WriteWordLine 0 0 ""
WriteWordLine 0 0 "Applications"
[System.Collections.Hashtable[]] $ScriptInformation = @()
$ScriptInformation += @{ Data = "Total Applications"; Value =
$Script:TotalApps; }
$Table.Columns.Item(1).Width = 200;
$Table.Columns.Item(2).Width = 150;
$Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
FindWordDocumentEnd
$Table = $Null
WriteWordLine 0 0 ""
$Table.Columns.Item(1).Width = 200;
$Table.Columns.Item(2).Width = 150;
$Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
FindWordDocumentEnd
$Table = $Null
WriteWordLine 0 0 ""
$Table.Columns.Item(1).Width = 200;
$Table.Columns.Item(2).Width = 150;
$Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
FindWordDocumentEnd
$Table = $Null
WriteWordLine 0 0 ""
WriteWordLine 0 0 "Servers"
[System.Collections.Hashtable[]] $ScriptInformation = @()
$ScriptInformation += @{ Data = "Total Servers"; Value =
$Script:TotalServers; }
$Table.Columns.Item(1).Width = 200;
$Table.Columns.Item(2).Width = 150;
$Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
FindWordDocumentEnd
$Table = $Null
WriteWordLine 0 0 ""
$Table.Columns.Item(1).Width = 200;
$Table.Columns.Item(2).Width = 150;
$Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
FindWordDocumentEnd
$Table = $Null
WriteWordLine 0 0 ""
WriteWordLine 0 0 "Zones"
[System.Collections.Hashtable[]] $ScriptInformation = @()
$ScriptInformation += @{ Data = "Total Zones"; Value =
$Script:TotalZones; }
$Table = AddWordTable -Hashtable $ScriptInformation `
-Columns Data,Value `
-List `
-Format $wdTableGrid `
-AutoFit $wdAutoFitFixed;
$Table.Columns.Item(1).Width = 200;
$Table.Columns.Item(2).Width = 150;
$Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
FindWordDocumentEnd
$Table = $Null
WriteWordLine 0 0 ""
WriteWordLine 0 0 "Policies"
[System.Collections.Hashtable[]] $ScriptInformation = @()
$ScriptInformation += @{ Data = "IMA Policies"; Value =
$Script:TotalIMAPolicies; }
$ScriptInformation += @{ Data = "Citrix AD Policies Processed"; Value =
$Script:TotalADPolicies; }
$ScriptInformation += @{ Data = "Total Policies"; Value =
$Script:TotalPolicies; }
$Table.Columns.Item(1).Width = 200;
$Table.Columns.Item(2).Width = 150;
$Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
FindWordDocumentEnd
$Table = $Null
WriteWordLine 0 0 "AD Policies can contain multiple Citrix policies"
-fontsize 8
WriteWordLine 0 0 ""
}
ElseIf($Text)
{
Line 0 "Summary Page"
Line 0 "Administrators"
Line 1 "Total Administrators`t`t: " $Script:TotalAdmins
Line 0 ""
Line 0 "Applications"
Line 1 "Total Applications`t`t: " $Script:TotalApps
Line 0 ""
Line 0 "Load Balancing Policies"
Line 1 "Total Load Balancing Policies`t: " $Script:TotalLBPolicies
Line 0 ""
Line 0 "Servers"
Line 1 "Total Servers`t`t`t: " $Script:TotalServers
Line 0 ""
Line 0 "Zones"
Line 1 "Total Zones`t`t`t: " $Script:TotalZones
Line 0 ""
Line 0 "Policies"
Line 1 "IMA Policies`t`t`t: " $Script:TotalIMAPolicies
Line 1 "Citrix AD Policies Processed`t: $($Script:TotalADPolicies)`t(AD
Policies can contain multiple Citrix policies)"
Line 1 "Total Policies`t`t`t: " $Script:TotalPolicies
}
ElseIf($HTML)
{
WriteHTMLLine 1 0 "Summary Page"
$rowdata = @()
$columnHeaders = @("Total Administrators",($htmlsilver -bor
$htmlbold),"$($Script:TotalAdmins)",$htmlwhite)
$msg = "Administrators"
$columnWidths = @("200","150")
FormatHTMLTable $msg -rowArray $rowdata -columnArray $columnHeaders
-fixedWidth $columnWidths
WriteHTMLLine 0 0 ""
$rowdata = @()
$columnHeaders = @("Total Applications",($htmlsilver -bor $htmlbold),"$
($Script:TotalApps)",$htmlwhite)
$msg = "Applications"
$columnWidths = @("200","150")
FormatHTMLTable $msg -rowArray $rowdata -columnArray $columnHeaders
-fixedWidth $columnWidths
WriteHTMLLine 0 0 ""
$rowdata = @()
$columnHeaders = @("Total Load Balancing Policies",($htmlsilver -bor
$htmlbold),"$($Script:TotalLBPolicies)",$htmlwhite)
$rowdata = @()
$columnHeaders = @("Total Servers",($htmlsilver -bor $htmlbold),"$
($Script:TotalServers)",$htmlwhite)
$msg = "Servers"
$columnWidths = @("200","150")
FormatHTMLTable $msg -rowArray $rowdata -columnArray $columnHeaders
-fixedWidth $columnWidths
WriteHTMLLine 0 0 ""
$rowdata = @()
$columnHeaders = @("Total Worker Groups",($htmlsilver -bor
$htmlbold),"$($Script:TotalWGs)",$htmlwhite)
$rowdata = @()
$columnHeaders = @("Total Zones",($htmlsilver -bor $htmlbold),"$
($Script:TotalZones)",$htmlwhite)
$msg = "Zones"
$columnWidths = @("200","150")
FormatHTMLTable $msg -rowArray $rowdata -columnArray $columnHeaders
-fixedWidth $columnWidths
WriteHTMLLine 0 0 ""
$rowdata = @()
$columnHeaders = @("IMA Policies",($htmlsilver -bor $htmlbold),"$
($Script:TotalIMAPolicies)",$htmlwhite)
$rowdata += @(,('Citrix AD Policies Processed',($htmlsilver -bor
$htmlbold),"$($Script:TotalADPolicies)",$htmlwhite))
$rowdata += @(,('Total Policies',($htmlsilver -bor $htmlbold),"$
($Script:TotalPolicies)",$htmlwhite))
$msg = "Policies"
$columnWidths = @("200","150")
FormatHTMLTable $msg -rowArray $rowdata -columnArray $columnHeaders
-fixedWidth $columnWidths
WriteHTMLLine 0 0 "AD Policies can contain multiple Citrix policies"
-fontsize 1
WriteHTMLLine 0 0 ""
}
}
Function OutputSummaryPage
{
$Script:TotalAdmins = ($Script:TotalFullAdmins + $Script:TotalViewAdmins +
$Script:TotalCustomAdmins)
$Script:TotalApps = ($Script:TotalPublishedApps +
$Script:TotalPublishedContent + $Script:TotalPublishedDesktops +
$Script:TotalStreamedApps)
$Script:TotalServers = ($Script:TotalControllers + $Script:TotalWorkers)
$Script:TotalWGs = ($Script:TotalWGByServerName +
$Script:TotalWGByServerGroup + $Script:TotalWGByOU)
$Script:TotalPolicies = ($Script:TotalComputerPolicies +
$Script:TotalUserPolicies)
$Table.Columns.Item(1).Width = 200;
$Table.Columns.Item(2).Width = 150;
$Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
FindWordDocumentEnd
$Table = $Null
WriteWordLine 0 0 ""
WriteWordLine 0 0 "Applications"
[System.Collections.Hashtable[]] $ScriptInformation = @()
$ScriptInformation += @{ Data = "Total Published Applications"; Value =
$Script:TotalPublishedApps; }
$ScriptInformation += @{ Data = "Total Published Content"; Value =
$Script:TotalPublishedContent; }
$ScriptInformation += @{ Data = "Total Published Desktops"; Value =
$Script:TotalPublishedDesktops; }
$ScriptInformation += @{ Data = "Total Streamed Applications"; Value =
$Script:TotalStreamedApps; }
$ScriptInformation += @{ Data = " Total Applications"; Value =
$TotalApps; }
$Table = AddWordTable -Hashtable $ScriptInformation `
-Columns Data,Value `
-List `
-Format $wdTableGrid `
-AutoFit $wdAutoFitFixed;
$Table.Columns.Item(1).Width = 200;
$Table.Columns.Item(2).Width = 150;
$Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
FindWordDocumentEnd
$Table = $Null
WriteWordLine 0 0 ""
$Table.Columns.Item(1).Width = 200;
$Table.Columns.Item(2).Width = 150;
$Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
FindWordDocumentEnd
$Table = $Null
WriteWordLine 0 0 ""
$Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
FindWordDocumentEnd
$Table = $Null
WriteWordLine 0 0 ""
$Table.Columns.Item(1).Width = 200;
$Table.Columns.Item(2).Width = 150;
$Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
FindWordDocumentEnd
$Table = $Null
WriteWordLine 0 0 ""
WriteWordLine 0 0 "Servers"
[System.Collections.Hashtable[]] $ScriptInformation = @()
$ScriptInformation += @{ Data = "Total Controllers"; Value =
$Script:TotalControllers; }
$ScriptInformation += @{ Data = "Total Workers"; Value =
$Script:TotalWorkers; }
$ScriptInformation += @{ Data = " Total Servers"; Value =
$Script:TotalServers; }
$Table.Columns.Item(1).Width = 200;
$Table.Columns.Item(2).Width = 150;
$Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
FindWordDocumentEnd
$Table = $Null
WriteWordLine 0 0 ""
$Table.Columns.Item(1).Width = 200;
$Table.Columns.Item(2).Width = 150;
$Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
FindWordDocumentEnd
$Table = $Null
WriteWordLine 0 0 ""
WriteWordLine 0 0 "Zones"
[System.Collections.Hashtable[]] $ScriptInformation = @()
$ScriptInformation += @{ Data = " Total Zones"; Value =
$Script:TotalZones; }
$Table.Columns.Item(1).Width = 200;
$Table.Columns.Item(2).Width = 150;
$Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
FindWordDocumentEnd
$Table = $Null
WriteWordLine 0 0 ""
WriteWordLine 0 0 "Policies"
[System.Collections.Hashtable[]] $ScriptInformation = @()
$ScriptInformation += @{ Data = "Total Computer Policies"; Value =
$Script:TotalComputerPolicies; }
$ScriptInformation += @{ Data = "Total User Policies"; Value =
$Script:TotalUserPolicies; }
$ScriptInformation += @{ Data = " Total Policies"; Value =
$TotalPolicies; }
$ScriptInformation += @{ Data = "IMA Policies"; Value =
$Script:TotalIMAPolicies; }
$ScriptInformation += @{ Data = "Citrix AD Policies Processed"; Value =
$Script:TotalADPolicies; }
$ScriptInformation += @{ Data = "Citrix AD Policies not Processed";
Value = $Script:TotalADPoliciesNotProcessed; }
$Table.Columns.Item(1).Width = 200;
$Table.Columns.Item(2).Width = 150;
$Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
FindWordDocumentEnd
$Table = $Null
WriteWordLine 0 0 "AD Policies can contain multiple Citrix policies"
-fontsize 8
WriteWordLine 0 0 ""
}
ElseIf($Text)
{
Line 0 "Summary Page"
Line 0 "Administrators"
Line 1 "Total Full Administrators`t: " $Script:TotalFullAdmins
Line 1 "Total View Administrators`t: " $Script:TotalViewAdmins
Line 1 "Total Custom Administrators`t: " $Script:TotalCustomAdmins
Line 2 "Total Administrators`t: " $Script:TotalAdmins
Line 0 ""
Line 0 "Applications"
Line 1 "Total Published Applications`t: " $Script:TotalPublishedApps
Line 1 "Total Published Content`t`t: " $Script:TotalPublishedContent
Line 1 "Total Published Desktops`t: " $Script:TotalPublishedDesktops
Line 1 "Total Streamed Applications`t: " $Script:TotalStreamedApps
Line 2 "Total Applications`t: " $Script:TotalApps
Line 0 ""
Line 0 "Servers"
Line 1 "Total Controllers`t`t: " $Script:TotalControllers
Line 1 "Total Workers`t`t`t: " $Script:TotalWorkers
Line 2 "Total Servers`t`t: " $Script:TotalServers
Line 0 ""
Line 0 "Zones"
Line 1 "Total Zones`t`t`t: " $Script:TotalZones
Line 0 ""
Line 0 "Policies"
Line 1 "Total Computer Policies`t`t: " $Script:TotalComputerPolicies
Line 1 "Total User Policies`t`t: " $Script:TotalUserPolicies
Line 2 "Total Policies`t`t: " $Script:TotalPolicies
Line 1 "IMA Policies`t`t`t: " $Script:TotalIMAPolicies
Line 1 "Citrix AD Policies Processed`t: $($Script:TotalADPolicies)`t(AD
Policies can contain multiple Citrix policies)"
Line 1 "Citrix AD Policies not Processed: "
$Script:TotalADPoliciesNotProcessed
Line 0 ""
}
ElseIf($HTML)
{
WriteHTMLLine 1 0 "Summary Page"
$rowdata = @()
$columnHeaders = @("Total Full Administrators",($htmlsilver -bor
$htmlbold),"$($Script:TotalFullAdmins)",$htmlwhite)
$rowdata += @(,('Total View Administrators',($htmlsilver -bor
$htmlbold),"$($Script:TotalViewAdmins)",$htmlwhite))
$rowdata += @(,('Total Custom Administrators',($htmlsilver -bor
$htmlbold),"$($Script:TotalCustomAdmins)",$htmlwhite))
$rowdata += @(,(' Total Administrators',($htmlsilver -bor
$htmlbold),"$($Script:TotalAdmins)",$htmlwhite))
$msg = "Administrators"
$columnWidths = @("200","150")
FormatHTMLTable $msg -rowArray $rowdata -columnArray $columnHeaders
-fixedWidth $columnWidths
WriteHTMLLine 0 0 ""
$rowdata = @()
$columnHeaders = @("Total Published Applications",($htmlsilver -bor
$htmlbold),"$($Script:TotalPublishedApps)",$htmlwhite)
$rowdata += @(,('Total Published Content',($htmlsilver -bor
$htmlbold),"$($Script:TotalPublishedContent)",$htmlwhite))
$rowdata += @(,('Total Published Desktops',($htmlsilver -bor
$htmlbold),"$($Script:TotalPublishedDesktops)",$htmlwhite))
$rowdata += @(,('Total Streamed Applications',($htmlsilver -bor
$htmlbold),"$($Script:TotalStreamedApps)",$htmlwhite))
$rowdata += @(,(' Total Applications',($htmlsilver -bor
$htmlbold),"$($Script:TotalApps)",$htmlwhite))
$msg = "Applications"
$columnWidths = @("200","150")
FormatHTMLTable $msg -rowArray $rowdata -columnArray $columnHeaders
-fixedWidth $columnWidths
WriteHTMLLine 0 0 ""
$rowdata = @()
$columnHeaders = @(" Total Config Log Items",($htmlsilver -bor
$htmlbold),"$($Script:TotalConfigLogItems)",$htmlwhite)
$rowdata = @()
$columnHeaders = @(" Total Load Balancing Policies",($htmlsilver
-bor $htmlbold),"$($Script:TotalLBPolicies)",$htmlwhite)
$rowdata = @()
$columnHeaders = @(" Total Load Evaluators",($htmlsilver -bor
$htmlbold),"$($Script:TotalLoadEvaluators)",$htmlwhite)
$rowdata = @()
$columnHeaders = @("Total Controllers",($htmlsilver -bor $htmlbold),"$
($Script:TotalControllers)",$htmlwhite)
$rowdata += @(,('Total Workers',($htmlsilver -bor $htmlbold),"$
($Script:TotalWorkers)",$htmlwhite))
$rowdata += @(,(' Total Servers',($htmlsilver -bor $htmlbold),"$
($Script:TotalServers)",$htmlwhite))
$msg = "Servers"
$columnWidths = @("200","150")
FormatHTMLTable $msg -rowArray $rowdata -columnArray $columnHeaders
-fixedWidth $columnWidths
WriteHTMLLine 0 0 ""
$rowdata = @()
$columnHeaders = @("Total WGs by Server Name",($htmlsilver -bor
$htmlbold),"$($Script:TotalWGByServerName)",$htmlwhite)
$rowdata += @(,('Total WGs by Server Group',($htmlsilver -bor
$htmlbold),"$($Script:TotalWGByServerGroup)",$htmlwhite))
$rowdata += @(,('Total WGs by AD Container',($htmlsilver -bor
$htmlbold),"$($Script:TotalWGByOU)",$htmlwhite))
$rowdata += @(,(' Total Worker Groups',($htmlsilver -bor
$htmlbold),"$($Script:TotalWGs)",$htmlwhite))
$rowdata = @()
$columnHeaders = @(" Total Zones",($htmlsilver -bor $htmlbold),"$
($Script:TotalZones)",$htmlwhite)
$msg = "Zones"
$columnWidths = @("200","150")
FormatHTMLTable $msg -rowArray $rowdata -columnArray $columnHeaders
-fixedWidth $columnWidths
WriteHTMLLine 0 0 ""
$rowdata = @()
$columnHeaders = @("Total Computer Policies",($htmlsilver -bor
$htmlbold),"$($Script:TotalComputerPolicies)",$htmlwhite)
$rowdata += @(,('Total User Policies',($htmlsilver -bor $htmlbold),"$
($Script:TotalUserPolicies)",$htmlwhite))
$rowdata += @(,(' Total Policies',($htmlsilver -bor $htmlbold),"$
($Script:TotalPolicies)",$htmlwhite))
$rowdata += @(,('IMA Policies',($htmlsilver -bor $htmlbold),"$
($Script:TotalIMAPolicies)",$htmlwhite))
$rowdata += @(,('Citrix AD Policies Processed',($htmlsilver -bor
$htmlbold),"$($Script:TotalADPolicies)",$htmlwhite))
$rowdata += @(,('Citrix AD Policies not Processed',($htmlsilver -bor
$htmlbold),"$($Script:TotalADPoliciesNotProcessed)",$htmlwhite))
$msg = "Policies"
$columnWidths = @("200","150")
FormatHTMLTable $msg -rowArray $rowdata -columnArray $columnHeaders
-fixedWidth $columnWidths
WriteHTMLLine 0 0 "AD Policies can contain multiple Citrix policies"
-fontsize 1
WriteHTMLLine 0 0 ""
}
}
#endregion
#http://poshtips.com/measuring-elapsed-time-in-powershell/
Write-Host "$(Get-Date): Script started: $($Script:StartTime)"
-BackgroundColor Black -ForegroundColor Yellow
Write-Host "$(Get-Date): Script ended: $(Get-Date)" -BackgroundColor Black
-ForegroundColor Yellow
$runtime = $(Get-Date) - $Script:StartTime
$Str = [string]::format("{0} days, {1} hours, {2} minutes, {3}.{4} seconds",
$runtime.Days,
$runtime.Hours,
$runtime.Minutes,
$runtime.Seconds,
$runtime.Milliseconds)
Write-Host "$(Get-Date): Elapsed time: $($Str)" -BackgroundColor Black
-ForegroundColor Yellow
If($Dev)
{
Out-File -FilePath $Script:DevErrorFile -InputObject $error -Append
}
If($ScriptInfo)
{
$SIFile = "$($pwd.Path)\XA65V5InventoryScriptInfo_$(Get-Date -f yyyy-
MM-dd_HHmm).txt"
Out-File -FilePath $SIFile -InputObject ""
Out-File -FilePath $SIFile -Append -InputObject "Add DateTime : $
($AddDateTime)"
Out-File -FilePath $SIFile -Append -InputObject "AdminAddress : $
($AdminAddress)"
Out-File -FilePath $SIFile -Append -InputObject "Administrators : $
($Administrators)"
Out-File -FilePath $SIFile -Append -InputObject "Applications : $
($Applications)"
If($MSWORD -or $PDF)
{
Out-File -FilePath $SIFile -Append -InputObject "Company Name
: $($Script:CoName)"
Out-File -FilePath $SIFile -Append -InputObject "Company Address
: $($CompanyAddress)"
Out-File -FilePath $SIFile -Append -InputObject "Company Email
: $($CompanyEmail)"
Out-File -FilePath $SIFile -Append -InputObject "Company Fax
: $($CompanyFax)"
Out-File -FilePath $SIFile -Append -InputObject "Company Phone
: $($CompanyPhone)"
Out-File -FilePath $SIFile -Append -InputObject "Cover Page
: $($CoverPage)"
}
Out-File -FilePath $SIFile -Append -InputObject "Dev : $
($Dev)"
If($Dev)
{
Out-File -FilePath $SIFile -Append -InputObject "DevErrorFile
: $($Script:DevErrorFile)"
}
Out-File -FilePath $SIFile -Append -InputObject "Filename1 : $
($Script:FileName1)"
If($PDF)
{
Out-File -FilePath $SIFile -Append -InputObject "Filename2
: $($Script:FileName2)"
}
Out-File -FilePath $SIFile -Append -InputObject "Folder : $
($Folder)"
Out-File -FilePath $SIFile -Append -InputObject "HW Inventory : $
($Hardware)"
Out-File -FilePath $SIFile -Append -InputObject "Log : $
($Log)"
Out-File -FilePath $SIFile -Append -InputObject "Logging : $
($Logging)"
If($Logging)
{
Out-File -FilePath $SIFile -Append -InputObject " Start Date
: $($StartDate)"
Out-File -FilePath $SIFile -Append -InputObject " End Date
: $($EndDate)"
}
Out-File -FilePath $SIFile -Append -InputObject "MaxDetails : $
($MaxDetails)"
Out-File -FilePath $SIFile -Append -InputObject "NoADPolicies : $
($NoADPolicies)"
Out-File -FilePath $SIFile -Append -InputObject "NoPolicies : $
($NoPolicies)"
Out-File -FilePath $SIFile -Append -InputObject "Policies : $
($Policies)"
Out-File -FilePath $SIFile -Append -InputObject "Save As HTML : $
($HTML)"
Out-File -FilePath $SIFile -Append -InputObject "Save As PDF : $
($PDF)"
Out-File -FilePath $SIFile -Append -InputObject "Save As TEXT : $
($TEXT)"
Out-File -FilePath $SIFile -Append -InputObject "Save As WORD : $
($MSWORD)"
Out-File -FilePath $SIFile -Append -InputObject "Script Info : $
($ScriptInfo)"
Out-File -FilePath $SIFile -Append -InputObject "Section : $
($Section)"
Out-File -FilePath $SIFile -Append -InputObject "Title : $
($Script:Title)"
If($MSWORD -or $PDF)
{
Out-File -FilePath $SIFile -Append -InputObject "User Name
: $($UserName)"
}
Out-File -FilePath $SIFile -Append -InputObject ""
Out-File -FilePath $SIFile -Append -InputObject "OS Detected : $
($Script:RunningOS)"
Out-File -FilePath $SIFile -Append -InputObject "PoSH version : $
($Host.Version)"
Out-File -FilePath $SIFile -Append -InputObject "PSCulture : $
($PSCulture)"
Out-File -FilePath $SIFile -Append -InputObject "PSUICulture : $
($PSUICulture)"
If($MSWORD -or $PDF)
{
Out-File -FilePath $SIFile -Append -InputObject "Word language
: $($Script:WordLanguageValue)"
Out-File -FilePath $SIFile -Append -InputObject "Word version
: $($Script:WordProduct)"
}
Out-File -FilePath $SIFile -Append -InputObject ""
Out-File -FilePath $SIFile -Append -InputObject "Script start : $
($Script:StartTime)"
Out-File -FilePath $SIFile -Append -InputObject "Elapsed time : $
($Str)"
}
ProcessScriptSetup
SetFileName1andFileName2 "$($Script:FarmName)"
ProcessConfigLogSettings
ProcessAdministrators
ProcessApplications
ProcessConfigLogging
ProcessLoadBalancingPolicies
ProcessLoadEvaluators
ProcessServers
ProcessWorkerGroups
ProcessZones
OutputAppendixA
OutputAppendixB
ProcessSummaryPage
#endregion
ProcessDocumentOutput
ProcessScriptEnd
#endregion
# SIG # Begin signature block
# MIIf8QYJKoZIhvcNAQcCoIIf4jCCH94CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUTsea6UaZ7ZleMK+4zLLss9M1
# TXigghtYMIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0B
# AQUFADBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD
# VQQLExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVk
# IElEIFJvb3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzExMTEwMDAwMDAwWjBlMQsw
# CQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cu
# ZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3Qg
# Q0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg
# +XESpa7cJpSIqvTO9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lT
# XDGEKvYPmDI2dsze3Tyoou9q+yHyUmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5
# a3/UsDg+wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW/lmci3Zt1/GiSw0r/wty2p5g
# 0I6QNcZ4VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpyoeb6pNnVFzF1
# roV9Iq4/AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whf
# GHdPAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0G
# A1UdDgQWBBRF66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLL
# gjEtUYunpyGd823IDzANBgkqhkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3
# cmbYMuRCdWKuh+vy1dneVrOfzM4UKLkNl2BcEkxY5NM9g0lFWJc1aRqoR+pWxnmr
# EthngYTffwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38FnSbNd67IJKusm7Xi+
# fT8r87cmNW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i8b5Q
# Z7dsvfPxH2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu
# 838fYxAe+o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw
# 8jCCBSYwggQOoAMCAQICEAYl09Z07l8/Y/zwOgR2go8wDQYJKoZIhvcNAQELBQAw
# cjELMAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZMBcGA1UECxMQ
# d3d3LmRpZ2ljZXJ0LmNvbTExMC8GA1UEAxMoRGlnaUNlcnQgU0hBMiBBc3N1cmVk
# IElEIENvZGUgU2lnbmluZyBDQTAeFw0xODA3MTcwMDAwMDBaFw0xOTExMDcxMjAw
# MDBaMGMxCzAJBgNVBAYTAlVTMRIwEAYDVQQIEwlUZW5uZXNzZWUxEjAQBgNVBAcT
# CVR1bGxhaG9tYTEVMBMGA1UEChMMQ2FybCBXZWJzdGVyMRUwEwYDVQQDEwxDYXJs
# IFdlYnN0ZXIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCgtVzb3oq3
# PHaaZvyNOsDIHEUAsrSd18bkdmKnYwlM50MFu9ZRO/Apo51HqB+rV1fOL5fdclKj
# fj7srf9laI7lxcu8xSTFLr7Ds4h9HNLwUrKZeNrJWkMfnWPn5W9Tj7jGLEz+FjYA
# Hb0Riaax1WW66OlKs7Rs+DWzuuHfH306WyJyAw+v4FurGxS6Zdnf58xuOfHJfcgl
# MvO0UddssPZMimv/y93vHJjOLphAdJ1FjiCnNk+i9cdKqymAO7bUx2njF60dg2Pm
# 4Oxn6Jmb+UUq/96L0Mo62nSuYNQ5waLqmkwcqZI48XpVmEE1pImkovnNIoxCKOYi
# +Ive2wadm72tAgMBAAGjggHFMIIBwTAfBgNVHSMEGDAWgBRaxLl7KgqjpepxA8Bg
# +S32ZXUOWDAdBgNVHQ4EFgQUJBpmW3NwjYyMIjhYEg4w1PLAbwUwDgYDVR0PAQH/
# BAQDAgeAMBMGA1UdJQQMMAoGCCsGAQUFBwMDMHcGA1UdHwRwMG4wNaAzoDGGL2h0
# dHA6Ly9jcmwzLmRpZ2ljZXJ0LmNvbS9zaGEyLWFzc3VyZWQtY3MtZzEuY3JsMDWg
# M6Axhi9odHRwOi8vY3JsNC5kaWdpY2VydC5jb20vc2hhMi1hc3N1cmVkLWNzLWcx
# LmNybDBMBgNVHSAERTBDMDcGCWCGSAGG/WwDATAqMCgGCCsGAQUFBwIBFhxodHRw
# czovL3d3dy5kaWdpY2VydC5jb20vQ1BTMAgGBmeBDAEEATCBhAYIKwYBBQUHAQEE
# eDB2MCQGCCsGAQUFBzABhhhodHRwOi8vb2NzcC5kaWdpY2VydC5jb20wTgYIKwYB
# BQUHMAKGQmh0dHA6Ly9jYWNlcnRzLmRpZ2ljZXJ0LmNvbS9EaWdpQ2VydFNIQTJB
# c3N1cmVkSURDb2RlU2lnbmluZ0NBLmNydDAMBgNVHRMBAf8EAjAAMA0GCSqGSIb3
# DQEBCwUAA4IBAQA8hfCKRRFUfnFXKFrwerhZVnyaZXX4flz89y7zOjUKocpldmqs
# 13oHlaEHipBhV/P7Iw3kgdf076xmc08h8RgyL/+qbqNJRRqGWL1IxxlHowsiEFVw
# bupSOagzGNAwTj14dr+cZ85cDM4F5okrFidlhm0o4R1kD1dlLfWlOJW3G6kwA1Z9
# GiKST14fLeI/CyLYmb2oWbYAi20luM+PPRhAYR/qsyN2K26aofytirEZcwlYZcks
# EVCQmpNqL8Jz4i6ZRxE58aOlca5farT64hZ8ErC5mI0pyoq14QwkhMRnE1xHyoRI
# phjqRtG7euwim+F1o47BVCpT9P9NEYOdIe54MIIFMDCCBBigAwIBAgIQBAkYG1/V
# u2Z1U0O1b5VQCDANBgkqhkiG9w0BAQsFADBlMQswCQYDVQQGEwJVUzEVMBMGA1UE
# ChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQwIgYD
# VQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwHhcNMTMxMDIyMTIwMDAw
# WhcNMjgxMDIyMTIwMDAwWjByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNl
# cnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdp
# Q2VydCBTSEEyIEFzc3VyZWQgSUQgQ29kZSBTaWduaW5nIENBMIIBIjANBgkqhkiG
# 9w0BAQEFAAOCAQ8AMIIBCgKCAQEA+NOzHH8OEa9ndwfTCzFJGc/Q+0WZsTrbRPV/
# 5aid2zLXcep2nQUut4/6kkPApfmJ1DcZ17aq8JyGpdglrA55KDp+6dFn08b7KSfH
# 03sjlOSRI5aQd4L5oYQjZhJUM1B0sSgmuyRpwsJS8hRniolF1C2ho+mILCCVrhxK
# hwjfDPXiTWAYvqrEsq5wMWYzcT6scKKrzn/pfMuSoeU7MRzP6vIK5Fe7SrXpdOYr
# /mzLfnQ5Ng2Q7+S1TqSp6moKq4TzrGdOtcT3jNEgJSPrCGQ+UpbB8g8S9MWOD8Gi
# 6CxR93O8vYWxYoNzQYIH5DiLanMg0A9kczyen6Yzqf0Z3yWT0QIDAQABo4IBzTCC
# AckwEgYDVR0TAQH/BAgwBgEB/wIBADAOBgNVHQ8BAf8EBAMCAYYwEwYDVR0lBAww
# CgYIKwYBBQUHAwMweQYIKwYBBQUHAQEEbTBrMCQGCCsGAQUFBzABhhhodHRwOi8v
# b2NzcC5kaWdpY2VydC5jb20wQwYIKwYBBQUHMAKGN2h0dHA6Ly9jYWNlcnRzLmRp
# Z2ljZXJ0LmNvbS9EaWdpQ2VydEFzc3VyZWRJRFJvb3RDQS5jcnQwgYEGA1UdHwR6
# MHgwOqA4oDaGNGh0dHA6Ly9jcmw0LmRpZ2ljZXJ0LmNvbS9EaWdpQ2VydEFzc3Vy
# ZWRJRFJvb3RDQS5jcmwwOqA4oDaGNGh0dHA6Ly9jcmwzLmRpZ2ljZXJ0LmNvbS9E
# aWdpQ2VydEFzc3VyZWRJRFJvb3RDQS5jcmwwTwYDVR0gBEgwRjA4BgpghkgBhv1s
# AAIEMCowKAYIKwYBBQUHAgEWHGh0dHBzOi8vd3d3LmRpZ2ljZXJ0LmNvbS9DUFMw
# CgYIYIZIAYb9bAMwHQYDVR0OBBYEFFrEuXsqCqOl6nEDwGD5LfZldQ5YMB8GA1Ud
# IwQYMBaAFEXroq/0ksuCMS1Ri6enIZ3zbcgPMA0GCSqGSIb3DQEBCwUAA4IBAQA+
# 7A1aJLPzItEVyCx8JSl2qB1dHC06GsTvMGHXfgtg/cM9D8Svi/3vKt8gVTew4fbR
# knUPUbRupY5a4l4kgU4QpO4/cY5jDhNLrddfRHnzNhQGivecRk5c/5CxGwcOkRX7
# uq+1UcKNJK4kxscnKqEpKBo6cSgCPC6Ro8AlEeKcFEehemhor5unXCBc2XGxDI+7
# qPjFEmifz0DLQESlE/DmZAwlCEIysjaKJAL+L3J+HNdJRZboWR3p+nRka7LrZkPa
# s7CM1ekN3fYBIM6ZMWM9CBoYs4GbT8aTEAb8B4H6i9r5gkn3Ym6hU/oSlBiFLpKR
# 6mhsRDKyZqHnGKSaZFHvMIIGajCCBVKgAwIBAgIQAwGaAjr/WLFr1tXq5hfwZjAN
# BgkqhkiG9w0BAQUFADBiMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQg
# SW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSEwHwYDVQQDExhEaWdpQ2Vy
# dCBBc3N1cmVkIElEIENBLTEwHhcNMTQxMDIyMDAwMDAwWhcNMjQxMDIyMDAwMDAw
# WjBHMQswCQYDVQQGEwJVUzERMA8GA1UEChMIRGlnaUNlcnQxJTAjBgNVBAMTHERp
# Z2lDZXJ0IFRpbWVzdGFtcCBSZXNwb25kZXIwggEiMA0GCSqGSIb3DQEBAQUAA4IB
# DwAwggEKAoIBAQCjZF38fLPggjXg4PbGKuZJdTvMbuBTqZ8fZFnmfGt/a4ydVfiS
# 457VWmNbAklQ2YPOb2bu3cuF6V+l+dSHdIhEOxnJ5fWRn8YUOawk6qhLLJGJzF4o
# 9GS2ULf1ErNzlgpno75hn67z/RJ4dQ6mWxT9RSOOhkRVfRiGBYxVh3lIRvfKDo2n
# 3k5f4qi2LVkCYYhhchhoubh87ubnNC8xd4EwH7s2AY3vJ+P3mvBMMWSN4+v6GYeo
# fs/sjAw2W3rBerh4x8kGLkYQyI3oBGDbvHN0+k7Y/qpA8bLOcEaD6dpAoVk62RUJ
# V5lWMJPzyWHM0AjMa+xiQpGsAsDvpPCJEY93AgMBAAGjggM1MIIDMTAOBgNVHQ8B
# Af8EBAMCB4AwDAYDVR0TAQH/BAIwADAWBgNVHSUBAf8EDDAKBggrBgEFBQcDCDCC
# Ab8GA1UdIASCAbYwggGyMIIBoQYJYIZIAYb9bAcBMIIBkjAoBggrBgEFBQcCARYc
# aHR0cHM6Ly93d3cuZGlnaWNlcnQuY29tL0NQUzCCAWQGCCsGAQUFBwICMIIBVh6C
# AVIAQQBuAHkAIAB1AHMAZQAgAG8AZgAgAHQAaABpAHMAIABDAGUAcgB0AGkAZgBp
# AGMAYQB0AGUAIABjAG8AbgBzAHQAaQB0AHUAdABlAHMAIABhAGMAYwBlAHAAdABh
# AG4AYwBlACAAbwBmACAAdABoAGUAIABEAGkAZwBpAEMAZQByAHQAIABDAFAALwBD
# AFAAUwAgAGEAbgBkACAAdABoAGUAIABSAGUAbAB5AGkAbgBnACAAUABhAHIAdAB5
# ACAAQQBnAHIAZQBlAG0AZQBuAHQAIAB3AGgAaQBjAGgAIABsAGkAbQBpAHQAIABs
# AGkAYQBiAGkAbABpAHQAeQAgAGEAbgBkACAAYQByAGUAIABpAG4AYwBvAHIAcABv
# AHIAYQB0AGUAZAAgAGgAZQByAGUAaQBuACAAYgB5ACAAcgBlAGYAZQByAGUAbgBj
# AGUALjALBglghkgBhv1sAxUwHwYDVR0jBBgwFoAUFQASKxOYspkH7R7for5XDStn
# As0wHQYDVR0OBBYEFGFaTSS2STKdSip5GoNL9B6Jwcp9MH0GA1UdHwR2MHQwOKA2
# oDSGMmh0dHA6Ly9jcmwzLmRpZ2ljZXJ0LmNvbS9EaWdpQ2VydEFzc3VyZWRJRENB
# LTEuY3JsMDigNqA0hjJodHRwOi8vY3JsNC5kaWdpY2VydC5jb20vRGlnaUNlcnRB
# c3N1cmVkSURDQS0xLmNybDB3BggrBgEFBQcBAQRrMGkwJAYIKwYBBQUHMAGGGGh0
# dHA6Ly9vY3NwLmRpZ2ljZXJ0LmNvbTBBBggrBgEFBQcwAoY1aHR0cDovL2NhY2Vy
# dHMuZGlnaWNlcnQuY29tL0RpZ2lDZXJ0QXNzdXJlZElEQ0EtMS5jcnQwDQYJKoZI
# hvcNAQEFBQADggEBAJ0lfhszTbImgVybhs4jIA+Ah+WI//+x1GosMe06FxlxF82p
# G7xaFjkAneNshORaQPveBgGMN/qbsZ0kfv4gpFetW7easGAm6mlXIV00Lx9xsIOU
# GQVrNZAQoHuXx/Y/5+IRQaa9YtnwJz04HShvOlIJ8OxwYtNiS7Dgc6aSwNOOMdgv
# 420XEwbu5AO2FKvzj0OncZ0h3RTKFV2SQdr5D4HRmXQNJsQOfxu19aDxxncGKBXp
# 2JPlVRbwuwqrHNtcSCdmyKOLChzlldquxC5ZoGHd2vNtomHpigtt7BIYvfdVVEAD
# kitrwlHCCkivsNRu4PQUCjob4489yq9qjXvc2EQwggbNMIIFtaADAgECAhAG/fkD
# lgOt6gAK6z8nu7obMA0GCSqGSIb3DQEBBQUAMGUxCzAJBgNVBAYTAlVTMRUwEwYD
# VQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20xJDAi
# BgNVBAMTG0RpZ2lDZXJ0IEFzc3VyZWQgSUQgUm9vdCBDQTAeFw0wNjExMTAwMDAw
# MDBaFw0yMTExMTAwMDAwMDBaMGIxCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdp
# Q2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20xITAfBgNVBAMTGERp
# Z2lDZXJ0IEFzc3VyZWQgSUQgQ0EtMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
# AQoCggEBAOiCLZn5ysJClaWAc0Bw0p5WVFypxNJBBo/JM/xNRZFcgZ/tLJz4Flnf
# nrUkFcKYubR3SdyJxArar8tea+2tsHEx6886QAxGTZPsi3o2CAOrDDT+GEmC/sfH
# MUiAfB6iD5IOUMnGh+s2P9gww/+m9/uizW9zI/6sVgWQ8DIhFonGcIj5BZd9o8dD
# 3QLoOz3tsUGj7T++25VIxO4es/K8DCuZ0MZdEkKB4YNugnM/JksUkK5ZZgrEjb7S
# zgaurYRvSISbT0C58Uzyr5j79s5AXVz2qPEvr+yJIvJrGGWxwXOt1/HYzx4KdFxC
# uGh+t9V3CidWfA9ipD8yFGCV/QcEogkCAwEAAaOCA3owggN2MA4GA1UdDwEB/wQE
# AwIBhjA7BgNVHSUENDAyBggrBgEFBQcDAQYIKwYBBQUHAwIGCCsGAQUFBwMDBggr
# BgEFBQcDBAYIKwYBBQUHAwgwggHSBgNVHSAEggHJMIIBxTCCAbQGCmCGSAGG/WwA
# AQQwggGkMDoGCCsGAQUFBwIBFi5odHRwOi8vd3d3LmRpZ2ljZXJ0LmNvbS9zc2wt
# Y3BzLXJlcG9zaXRvcnkuaHRtMIIBZAYIKwYBBQUHAgIwggFWHoIBUgBBAG4AeQAg
# AHUAcwBlACAAbwBmACAAdABoAGkAcwAgAEMAZQByAHQAaQBmAGkAYwBhAHQAZQAg
# AGMAbwBuAHMAdABpAHQAdQB0AGUAcwAgAGEAYwBjAGUAcAB0AGEAbgBjAGUAIABv
# AGYAIAB0AGgAZQAgAEQAaQBnAGkAQwBlAHIAdAAgAEMAUAAvAEMAUABTACAAYQBu
# AGQAIAB0AGgAZQAgAFIAZQBsAHkAaQBuAGcAIABQAGEAcgB0AHkAIABBAGcAcgBl
# AGUAbQBlAG4AdAAgAHcAaABpAGMAaAAgAGwAaQBtAGkAdAAgAGwAaQBhAGIAaQBs
# AGkAdAB5ACAAYQBuAGQAIABhAHIAZQAgAGkAbgBjAG8AcgBwAG8AcgBhAHQAZQBk
# ACAAaABlAHIAZQBpAG4AIABiAHkAIAByAGUAZgBlAHIAZQBuAGMAZQAuMAsGCWCG
# SAGG/WwDFTASBgNVHRMBAf8ECDAGAQH/AgEAMHkGCCsGAQUFBwEBBG0wazAkBggr
# BgEFBQcwAYYYaHR0cDovL29jc3AuZGlnaWNlcnQuY29tMEMGCCsGAQUFBzAChjdo
# dHRwOi8vY2FjZXJ0cy5kaWdpY2VydC5jb20vRGlnaUNlcnRBc3N1cmVkSURSb290
# Q0EuY3J0MIGBBgNVHR8EejB4MDqgOKA2hjRodHRwOi8vY3JsMy5kaWdpY2VydC5j
# b20vRGlnaUNlcnRBc3N1cmVkSURSb290Q0EuY3JsMDqgOKA2hjRodHRwOi8vY3Js
# NC5kaWdpY2VydC5jb20vRGlnaUNlcnRBc3N1cmVkSURSb290Q0EuY3JsMB0GA1Ud
# DgQWBBQVABIrE5iymQftHt+ivlcNK2cCzTAfBgNVHSMEGDAWgBRF66Kv9JLLgjEt
# UYunpyGd823IDzANBgkqhkiG9w0BAQUFAAOCAQEARlA+ybcoJKc4HbZbKa9Sz1Lp
# MUerVlx71Q0LQbPv7HUfdDjyslxhopyVw1Dkgrkj0bo6hnKtOHisdV0XFzRyR4WU
# VtHruzaEd8wkpfMEGVWp5+Pnq2LN+4stkMLA0rWUvV5PsQXSDj0aqRRbpoYxYqio
# M+SbOafE9c4deHaUJXPkKqvPnHZL7V/CSxbkS3BMAIke/MV5vEwSV/5f4R68Al2o
# /vsHOE8Nxl2RuQ9nRc3Wg+3nkg2NsWmMT/tZ4CMP0qquAHzunEIOz5HXJ7cW7g/D
# vXwKoO4sCFWFIrjrGBpN/CohrUkxg0eVd3HcsRtLSxwQnHcUwZ1PL1qVCCkQJjGC
# BAMwggP/AgEBMIGGMHIxCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJ
# bmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20xMTAvBgNVBAMTKERpZ2lDZXJ0
# IFNIQTIgQXNzdXJlZCBJRCBDb2RlIFNpZ25pbmcgQ0ECEAYl09Z07l8/Y/zwOgR2
# go8wCQYFKw4DAhoFAKBAMBkGCSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMCMGCSqG
# SIb3DQEJBDEWBBRnfTitSLSZb39nlPCUq3peYs8bNTANBgkqhkiG9w0BAQEFAASC
# AQAJqeyjLo6fNmbhHWOhRIr8Sa1jiCQW07c4wQapx/G+AMR6gcY3xUiyedaAqYWp
# 8ImaYQmOp7NoEpLwm0cy0MuXWTCN6P2nRPLTpgFB0bi8HcKAp82rFqlrR3fi+5RH
# nYLDtwShNIKKiIXKetD80aKtFT1PUZvQibZiymhrdgb/7h5BEMtSEyKWN4KJPKsB
# nFKPxi79JQ7PZcuFAIDYYEvFNJNlPePl1QnVTpy6EFcdLcUbch0ktACMcPs/M2f5
# +/QjJRgRO/nrOb3dgYhjTJxNTMv4uW0BTbk1Qw80pcr68kIjnzPVDjz+lGOTMUno
# ggfmZe9ByEwGxC+rbS4KXw5+oYICDzCCAgsGCSqGSIb3DQEJBjGCAfwwggH4AgEB
# MHYwYjELMAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZMBcGA1UE
# CxMQd3d3LmRpZ2ljZXJ0LmNvbTEhMB8GA1UEAxMYRGlnaUNlcnQgQXNzdXJlZCBJ
# RCBDQS0xAhADAZoCOv9YsWvW1ermF/BmMAkGBSsOAwIaBQCgXTAYBgkqhkiG9w0B
# CQMxCwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0xODEyMTQwMDQwMDJaMCMG
# CSqGSIb3DQEJBDEWBBSS7UQhky6MEAeKUpd2uwyTpON9JjANBgkqhkiG9w0BAQEF
# AASCAQB9uXgZHu+oB9mQ8/AGDNqc05SbKpozhJzmFXxgwW1K4N3jw9KQHmqb62eb
# FxgMRLCIF1e7YunqvJRVAML1cwGXDI0fO3gd++WjhB8E9DYkdtpIUr0QXrOytIIU
# ZzqF1XvhLZ0ds+UqKE45oe67PG22a5ygwne3Buh0mleii6Q2VzNvlitdh8A6gJKf
# EyGiLNHHkPKorrPkpmN5se0jJVol799xtovHjAy5UfWz3YPSbNtwDBSXaqlbeQEF
# 7AQBIVqLrXbp/U17iGwtyiHoZPK9lFt7dQ9l0iBjDjvMH1dJLZQRHcmiGYaAXdNn
# jltV2iZ7guHRHFSPUhBhptSsEHA5
# SIG # End signature block