├── EndScript.ps1 ├── GlobalVariables.ps1 ├── Header.jpg ├── Plugins ├── 00 Connection Plugin for vCD.ps1 ├── 01 General Information.ps1 ├── 02 Default OrgVDC Pay as you go CPU MHz.ps1 ├── 02a Check Fast Provisioning.ps1 ├── 02b Check Thin Provisioning.ps1 ├── 02c Shadow VMs.ps1 ├── 02d Inactive Cells.ps1 ├── 02e Task Errors.ps1 ├── 03 Org VDC Storage Check.ps1 ├── 04 Org VDC Memory Check.ps1 ├── 05 Org VDC CPU Check.ps1 └── VeryLastPlugin Used to Disconnect.ps1 ├── README.md └── vCheck.ps1 /EndScript.ps1: -------------------------------------------------------------------------------- 1 | # Everything in this script will run at the end of vCheck 2 | -------------------------------------------------------------------------------- /GlobalVariables.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vCheckReport/vCheck-vCD/82b6fbad02e7b744d5c20875bb1fa1d837f8388b/GlobalVariables.ps1 -------------------------------------------------------------------------------- /Header.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vCheckReport/vCheck-vCD/82b6fbad02e7b744d5c20875bb1fa1d837f8388b/Header.jpg -------------------------------------------------------------------------------- /Plugins/00 Connection Plugin for vCD.ps1: -------------------------------------------------------------------------------- 1 | $Title = "Connection settings for vCD" 2 | $Author = "Alan Renouf" 3 | $Version = 1.0 4 | 5 | # Start of Settings 6 | # Please Specify the IP address or Hostname of the vCD Instance to connect to 7 | $CIServer = "192.168.0.114" 8 | # End of Settings 9 | 10 | # Adding PowerCLI vCD snapin 11 | if (!(get-pssnapin -name VMware.VimAutomation.Cloud -erroraction silentlycontinue)) { 12 | add-pssnapin VMware.VimAutomation.Cloud 13 | } 14 | 15 | Write-CustomOut "Connecting to CI Server" 16 | 17 | $CIConnection = Connect-CIServer $CIServer -User Administrator -Password Ra1nb0w 18 | if (-not $CIConnection.IsConnected) { 19 | Write-Host "Unable to connect to vCloud Director, please ensure you have altered the vCloud Director server address correctly " 20 | Write-Host " to specify a username and password edit the connection string in the 00 Connection Plugin" 21 | break 22 | } 23 | 24 | Write-CustomOut "Collecting CIVM Objects" 25 | $CIVM = Get-CIVM | Sort Name 26 | Write-CustomOut "Collecting Catalog Objects" 27 | $Catalog = Get-Catalog | Sort Name 28 | Write-CustomOut "Collecting vApp Objects" 29 | $CIvApp = Get-CIVapp | Sort Name 30 | Write-CustomOut "Collecting Org Objects" 31 | $Org = Get-Org | Sort Name 32 | Write-CustomOut "Collecting OrgVDC Objects" 33 | $OrgvDC = Get-OrgvDC 34 | Write-CustomOut "Collecting ProviderVDC Objects" 35 | $ProviderVDC = Get-ProviderVdc 36 | 37 | $Server = $CIServer 38 | -------------------------------------------------------------------------------- /Plugins/01 General Information.ps1: -------------------------------------------------------------------------------- 1 | $Title = "General Information" 2 | $Header = "General Information" 3 | $Comments = "" 4 | $Display = "List" 5 | $Author = "Alan Renouf" 6 | $Version = 1.0 7 | 8 | # Start of Settings 9 | # End of Settings 10 | 11 | $Info = New-Object -TypeName PSObject -Property @{ 12 | "Number of Orgs:" = (@($Org).Count) 13 | "Number of Org VDCs:" = (@($OrgVDC).Count) 14 | "Number of Provider VDCs:" = (@($ProviderVDC).Count) 15 | "Number of vApps:" = (@($CIvAPP).Count) 16 | "Number of VMs:" = (@($CIVM).Count) 17 | "Active VMs:" = (@($CIVM | Where { $_.Status -eq "PoweredOn" }).Count) 18 | "In-active VMs:" = (@($CIVM | Where { $_.Status -eq "PoweredOff" }).Count) 19 | } 20 | $Info -------------------------------------------------------------------------------- /Plugins/02 Default OrgVDC Pay as you go CPU MHz.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vCheckReport/vCheck-vCD/82b6fbad02e7b744d5c20875bb1fa1d837f8388b/Plugins/02 Default OrgVDC Pay as you go CPU MHz.ps1 -------------------------------------------------------------------------------- /Plugins/02a Check Fast Provisioning.ps1: -------------------------------------------------------------------------------- 1 | $Title = "Fast Provisioning" 2 | $Header = "OrgVDC(s) with Fast Provisioning Enabled" 3 | $Comments = "OrgVDC(s) with Fast Provisioning Enabled" 4 | $Display = "Table" 5 | $Author = "Jake Robinson" 6 | $Version = 1.0 7 | 8 | # Start of Settings 9 | # End of Settings 10 | 11 | $OrgVDC | Where {$_.ExtensionData.UsesFastProvisioning -eq $true} | Select Name, org, @{n="Fast Provisioning";e={$_.extensiondata.usesfastprovisioning}} 12 | -------------------------------------------------------------------------------- /Plugins/02b Check Thin Provisioning.ps1: -------------------------------------------------------------------------------- 1 | $Title = "Thin Provisioning" 2 | $Header = "Org VDC not set for thin provisioning" 3 | $Comments = "Org VDC thin provisioning: false" 4 | $Display = "Table" 5 | $Author = "Jake Robinson" 6 | $Version = 1.0 7 | 8 | # Start of Settings 9 | # End of Settings 10 | 11 | $OrgVDC | Where {$_.ExtensionData.IsThinProvision -eq $false} | Select Name, org, @{n="Thin Provisioning";e={$_.extensiondata.IsThinProvision}} 12 | -------------------------------------------------------------------------------- /Plugins/02c Shadow VMs.ps1: -------------------------------------------------------------------------------- 1 | $Title = "Shadow VMs" 2 | $Header = "Shadow VMs" 3 | $Comments = "Virtual Machines that have been fast provisioned" 4 | $Display = "Table" 5 | $Author = "Jake Robinson" 6 | $Version = 1.0 7 | 8 | # Start of Settings 9 | # End of Settings 10 | 11 | Search-Cloud -QueryType AdminShadowVM | select Name, primaryVmName, Status 12 | -------------------------------------------------------------------------------- /Plugins/02d Inactive Cells.ps1: -------------------------------------------------------------------------------- 1 | $Title = "Inactive Cells" 2 | $Header = "Inactive Cells" 3 | $Comments = "vCloud Cells marked as inactive" 4 | $Display = "Table" 5 | $Author = "Jake Robinson" 6 | $Version = 1.0 7 | 8 | # Start of Settings 9 | # End of Settings 10 | 11 | 12 | 13 | search-cloud -QueryType cell -Filter "isActive==0" | select name, PrimaryIP, version, IsActive -------------------------------------------------------------------------------- /Plugins/02e Task Errors.ps1: -------------------------------------------------------------------------------- 1 | $Title = "Task Errors" 2 | $Header = "Tasks that have failed in the last day" 3 | $Comments = "Tasks that have failed in the last day" 4 | $Display = "Table" 5 | $Author = "Jake Robinson" 6 | $Version = 1.0 7 | 8 | # Start of Settings 9 | # End of Settings 10 | 11 | Search-Cloud -QueryType AdminTask -Filter "status!=success" | where {$_.startdate -gt (Get-Date).AddDays(-1)} | select name, ownername, orgname, status, @{n="details";e={$_.AnyAttr[1]."#text"}} -------------------------------------------------------------------------------- /Plugins/03 Org VDC Storage Check.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vCheckReport/vCheck-vCD/82b6fbad02e7b744d5c20875bb1fa1d837f8388b/Plugins/03 Org VDC Storage Check.ps1 -------------------------------------------------------------------------------- /Plugins/04 Org VDC Memory Check.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vCheckReport/vCheck-vCD/82b6fbad02e7b744d5c20875bb1fa1d837f8388b/Plugins/04 Org VDC Memory Check.ps1 -------------------------------------------------------------------------------- /Plugins/05 Org VDC CPU Check.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vCheckReport/vCheck-vCD/82b6fbad02e7b744d5c20875bb1fa1d837f8388b/Plugins/05 Org VDC CPU Check.ps1 -------------------------------------------------------------------------------- /Plugins/VeryLastPlugin Used to Disconnect.ps1: -------------------------------------------------------------------------------- 1 | # Start of Settings 2 | # End of Settings 3 | 4 | # Everything in this script will run at the end of vCheck 5 | If ($CIConnection) { 6 | $CIConnection | Disconnect-CIServer -Confirm:$false 7 | } 8 | 9 | $Title = "Disconnecting from vCD" 10 | $Display = "None" 11 | $Author = "Alan Renouf" 12 | $Version = 1.0 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | vCheck-vCD 2 | ========== 3 | 4 | vCheck Daily Report for VMware vCloud DIrector (vCD) 5 | 6 | vCheck is a PowerShell HTML framework script, the script is designed to run as a scheduled task before you get into the office to present you with key information via an email directly to your inbox in a nice easily readable format. 7 | 8 | This script picks on the key known issues and potential issues scripted as plugins for various technologies written as powershell scripts and reports it all in one place so all you do in the morning is check your email. 9 | 10 | One of they key things about this report is if there is no issue in a particular place you will not receive that section in the email, for example if there are no datastores with less than 5% free space (configurable) then the disk space section in the virtual infrastructure version of this script, it will not show in the email, this ensures that you have only the information you need in front of you when you get into the office. 11 | 12 | This script is not to be confused with an Audit script, although the reporting framework can also be used for auditing scripts too. I dont want to remind you that you have 5 hosts and what there names are and how many CPUs they have each and every day as you dont want to read that kind of information unless you need it, this script will only tell you about problem areas with your infrastructure. 13 | 14 | For more information please read here: http://www.virtu-al.net/vcheck-pluginsheaders/vcheck/ 15 | -------------------------------------------------------------------------------- /vCheck.ps1: -------------------------------------------------------------------------------- 1 | param ([Switch]$config, $Outputpath) 2 | ############################### 3 | # vCheck - Daily Error Report # 4 | ############################### 5 | # Thanks to all who have commented on my blog to help improve this project 6 | # all beta testers and previous contributors to this script. 7 | # 8 | $Version = "6.4" 9 | 10 | function Write-CustomOut ($Details){ 11 | $LogDate = Get-Date -Format T 12 | Write-Host "$($LogDate) $Details" 13 | #write-eventlog -logname Application -source "Windows Error Reporting" -eventID 12345 -entrytype Information -message "vCheck: $Details" 14 | } 15 | 16 | Function Invoke-Settings ($Filename, $GB) { 17 | $file = Get-Content $filename 18 | $OriginalLine = ($file | Select-String -Pattern "# Start of Settings").LineNumber 19 | $EndLine = ($file | Select-String -Pattern "# End of Settings").LineNumber 20 | if (($OriginalLine +1) -eq $EndLine) { 21 | } Else { 22 | $Array = @() 23 | $Line = $OriginalLine 24 | do { 25 | $Question = $file[$Line] 26 | $Line ++ 27 | $Split= ($file[$Line]).Split("=") 28 | $Var = $Split[0] 29 | $CurSet = $Split[1] 30 | 31 | # Check if the current setting is in speach marks 32 | $String = $false 33 | if ($CurSet -match '"') { 34 | $String = $true 35 | $CurSet = $CurSet.Replace('"', '') 36 | } 37 | $NewSet = Read-Host "$Question [$CurSet]" 38 | If (-not $NewSet) { 39 | $NewSet = $CurSet 40 | } 41 | If ($String) { 42 | $Array += $Question 43 | $Array += "$Var=`"$NewSet`"" 44 | } Else { 45 | $Array += $Question 46 | $Array += "$Var=$NewSet" 47 | } 48 | $Line ++ 49 | } Until ( $Line -ge ($EndLine -1) ) 50 | $Array += "# End of Settings" 51 | 52 | $out = @() 53 | $out = $File[0..($OriginalLine -1)] 54 | $out += $array 55 | $out += $File[$Endline..($file.count -1)] 56 | if ($GB) { $out[$SetupLine] = '$SetupWizard =$False' } 57 | $out | Out-File $Filename 58 | } 59 | } 60 | 61 | # Add all global variables. 62 | $ScriptPath = (Split-Path ((Get-Variable MyInvocation).Value).MyCommand.Path) 63 | $PluginsFolder = $ScriptPath + "\Plugins\" 64 | $Plugins = Get-ChildItem -Path $PluginsFolder -filter "*.ps1" | Sort Name 65 | $GlobalVariables = $ScriptPath + "\GlobalVariables.ps1" 66 | 67 | $file = Get-Content $GlobalVariables 68 | 69 | $Setup = ($file | Select-String -Pattern '# Set the following to true to enable the setup wizard for first time run').LineNumber 70 | $SetupLine = $Setup ++ 71 | $SetupSetting = invoke-Expression (($file[$SetupLine]).Split("="))[1] 72 | if ($config) { 73 | $SetupSetting = $true 74 | } 75 | If ($SetupSetting) { 76 | cls 77 | Write-Host 78 | Write-Host -ForegroundColor Yellow "Welcome to vCheck by Virtu-Al http://virtu-al.net" 79 | Write-Host -ForegroundColor Yellow "=================================================" 80 | Write-Host -ForegroundColor Yellow "This is the first time you have run this script or you have re-enabled the setup wizard." 81 | Write-Host 82 | Write-Host -ForegroundColor Yellow "To re-run this wizard in the future please use vCheck.ps1 -Config" 83 | Write-Host -ForegroundColor Yellow "To define a path to store each vCheck report please use vCheck.ps1 -Outputpath C:\tmp" 84 | Write-Host 85 | Write-Host -ForegroundColor Yellow "Please complete the following questions or hit Enter to accept the current setting" 86 | Write-Host -ForegroundColor Yellow "After completing ths wizard the vCheck report will be displayed on the screen." 87 | Write-Host 88 | 89 | Invoke-Settings -Filename $GlobalVariables -GB $true 90 | Foreach ($plugin in $Plugins) { 91 | Invoke-Settings -Filename $plugin.Fullname 92 | } 93 | } 94 | 95 | . $GlobalVariables 96 | 97 | $DspHeader0 = " 98 | BORDER-RIGHT: #bbbbbb 1px solid; 99 | PADDING-RIGHT: 0px; 100 | BORDER-TOP: #bbbbbb 1px solid; 101 | DISPLAY: block; 102 | PADDING-LEFT: 0px; 103 | FONT-WEIGHT: bold; 104 | FONT-SIZE: 8pt; 105 | MARGIN-BOTTOM: -1px; 106 | MARGIN-LEFT: 0px; 107 | BORDER-LEFT: #bbbbbb 1px solid; 108 | COLOR: #$($TitleTxtColour); 109 | MARGIN-RIGHT: 0px; 110 | PADDING-TOP: 4px; 111 | BORDER-BOTTOM: #bbbbbb 1px solid; 112 | FONT-FAMILY: Tahoma; 113 | POSITION: relative; 114 | HEIGHT: 2.25em; 115 | WIDTH: 95%; 116 | TEXT-INDENT: 10px; 117 | BACKGROUND-COLOR: #$($Colour1); 118 | " 119 | 120 | $DspHeader1 = " 121 | BORDER-RIGHT: #bbbbbb 1px solid; 122 | PADDING-RIGHT: 0px; 123 | BORDER-TOP: #bbbbbb 1px solid; 124 | DISPLAY: block; 125 | PADDING-LEFT: 0px; 126 | FONT-WEIGHT: bold; 127 | FONT-SIZE: 8pt; 128 | MARGIN-BOTTOM: -1px; 129 | MARGIN-LEFT: 0px; 130 | BORDER-LEFT: #bbbbbb 1px solid; 131 | COLOR: #$($TitleTxtColour); 132 | MARGIN-RIGHT: 0px; 133 | PADDING-TOP: 4px; 134 | BORDER-BOTTOM: #bbbbbb 1px solid; 135 | FONT-FAMILY: Tahoma; 136 | POSITION: relative; 137 | HEIGHT: 2.25em; 138 | WIDTH: 95%; 139 | TEXT-INDENT: 10px; 140 | BACKGROUND-COLOR: #$($Colour2); 141 | " 142 | 143 | $dspcomments = " 144 | BORDER-RIGHT: #bbbbbb 1px solid; 145 | PADDING-RIGHT: 0px; 146 | BORDER-TOP: #bbbbbb 1px solid; 147 | DISPLAY: block; 148 | PADDING-LEFT: 0px; 149 | FONT-WEIGHT: bold; 150 | FONT-SIZE: 8pt; 151 | MARGIN-BOTTOM: -1px; 152 | MARGIN-LEFT: 0px; 153 | BORDER-LEFT: #bbbbbb 1px solid; 154 | COLOR: #$($TitleTxtColour); 155 | MARGIN-RIGHT: 0px; 156 | PADDING-TOP: 4px; 157 | BORDER-BOTTOM: #bbbbbb 1px solid; 158 | FONT-FAMILY: Tahoma; 159 | POSITION: relative; 160 | HEIGHT: 2.25em; 161 | WIDTH: 95%; 162 | TEXT-INDENT: 10px; 163 | BACKGROUND-COLOR:#FFFFE1; 164 | COLOR: #000000; 165 | FONT-STYLE: ITALIC; 166 | FONT-WEIGHT: normal; 167 | FONT-SIZE: 8pt; 168 | " 169 | 170 | $filler = " 171 | BORDER-RIGHT: medium none; 172 | BORDER-TOP: medium none; 173 | DISPLAY: block; 174 | BACKGROUND: none transparent scroll repeat 0% 0%; 175 | MARGIN-BOTTOM: -1px; 176 | FONT: 100%/8px Tahoma; 177 | MARGIN-LEFT: 43px; 178 | BORDER-LEFT: medium none; 179 | COLOR: #ffffff; 180 | MARGIN-RIGHT: 0px; 181 | PADDING-TOP: 4px; 182 | BORDER-BOTTOM: medium none; 183 | POSITION: relative 184 | " 185 | 186 | $dspcont =" 187 | BORDER-RIGHT: #bbbbbb 1px solid; 188 | BORDER-TOP: #bbbbbb 1px solid; 189 | PADDING-LEFT: 0px; 190 | FONT-SIZE: 8pt; 191 | MARGIN-BOTTOM: -1px; 192 | PADDING-BOTTOM: 5px; 193 | MARGIN-LEFT: 0px; 194 | BORDER-LEFT: #bbbbbb 1px solid; 195 | WIDTH: 95%; 196 | COLOR: #000000; 197 | MARGIN-RIGHT: 0px; 198 | PADDING-TOP: 4px; 199 | BORDER-BOTTOM: #bbbbbb 1px solid; 200 | FONT-FAMILY: Tahoma; 201 | POSITION: relative; 202 | BACKGROUND-COLOR: #f9f9f9 203 | " 204 | 205 | Function Get-Base64Image ($Path) { 206 | $pic = Get-Content $Path -Encoding Byte 207 | [Convert]::ToBase64String($pic) 208 | } 209 | 210 | $HeaderImg = Get-Base64Image ((Split-Path ((Get-Variable MyInvocation).Value).MyCommand.Path) + "\Header.jpg") 211 | 212 | Function Get-CustomHTML ($Header){ 213 | $Report = @" 214 | 215 | $($Header) 216 | 217 | 218 | 246 | 247 | 248 |
249 |

250 | 253 | 254 | vCheck 255 | 256 |

257 |
258 |
vCheck v$($version) by Alan Renouf (http://virtu-al.net) generated on $($ENV:Computername) 259 |
260 | "@ 261 | Return $Report 262 | } 263 | 264 | Function Get-CustomHeader0 ($Title){ 265 | $Report = @" 266 |
267 | 268 |

$($Title)

269 | 270 |
271 | "@ 272 | Return $Report 273 | } 274 | 275 | Function Get-CustomHeader ($Title, $cmnt){ 276 | $Report = @" 277 |

$($Title)

278 | "@ 279 | If ($Comments) { 280 | $Report += @" 281 |
$($cmnt)
282 | "@ 283 | } 284 | $Report += @" 285 |
286 | "@ 287 | Return $Report 288 | } 289 | 290 | Function Get-CustomHeaderClose{ 291 | 292 | $Report = @" 293 |
294 |
295 | "@ 296 | Return $Report 297 | } 298 | 299 | Function Get-CustomHeader0Close{ 300 | $Report = @" 301 |
302 | "@ 303 | Return $Report 304 | } 305 | 306 | Function Get-CustomHTMLClose{ 307 | $Report = @" 308 | 309 | 310 | 311 | 312 | "@ 313 | Return $Report 314 | } 315 | 316 | Function Get-HTMLTable { 317 | param([array]$Content) 318 | $HTMLTable = $Content | ConvertTo-Html -Fragment 319 | $HTMLTable = $HTMLTable -Replace '', '
' 320 | $HTMLTable = $HTMLTable -Replace '
', '' 321 | $HTMLTable = $HTMLTable -Replace '', '' 322 | $HTMLTable = $HTMLTable -replace '<', "<" 323 | $HTMLTable = $HTMLTable -replace '>', ">" 324 | Return $HTMLTable 325 | } 326 | 327 | Function Get-HTMLDetail ($Heading, $Detail){ 328 | $Report = @" 329 | 330 | 331 | 332 | 333 | 334 |
$Heading$($Detail)
335 | "@ 336 | Return $Report 337 | } 338 | 339 | # Adding all plugins 340 | $TTRReport = @() 341 | $MyReport = Get-CustomHTML "$Server vCheck" 342 | $MyReport += Get-CustomHeader0 ($Server) 343 | $Plugins | Foreach { 344 | $TTR = [math]::round((Measure-Command {$Details = . $_.FullName}).TotalSeconds, 2) 345 | $TTRTable = "" | Select Plugin, TimeToRun 346 | $TTRTable.Plugin = $_.Name 347 | $TTRTable.TimeToRun = $TTR 348 | $TTRReport += $TTRTable 349 | $ver = "{0:N1}" -f $Version 350 | Write-CustomOut "..finished calculating $Title by $Author v$Ver" 351 | If ($Details) { 352 | If ($Display -eq "List"){ 353 | $MyReport += Get-CustomHeader $Header $Comments 354 | $AllProperties = $Details | Get-Member -MemberType Properties 355 | $AllProperties | Foreach { 356 | $MyReport += Get-HTMLDetail $_.Name $Details.($_.Name) 357 | } 358 | $MyReport += Get-CustomHeaderClose 359 | } 360 | If ($Display -eq "Table") { 361 | $MyReport += Get-CustomHeader $Header $Comments 362 | $MyReport += Get-HTMLTable $Details 363 | $MyReport += Get-CustomHeaderClose 364 | } 365 | } 366 | } 367 | $MyReport += Get-CustomHeader ("This report took " + [math]::round(((Get-Date) - $Date).TotalMinutes,2) + " minutes to run all checks.") 368 | $TTRReport | Foreach {$MyReport += Get-HTMLDetail $_.Plugin $_.TimeToRun} 369 | $MyReport += Get-CustomHeaderClose 370 | $MyReport += Get-CustomHeader0Close 371 | $MyReport += Get-CustomHTMLClose 372 | 373 | if ($DisplayToScreen -or $SetupSetting) { 374 | Write-CustomOut "..Displaying HTML results" 375 | $Filename = $Env:TEMP + "\" + $Server + "vCheck" + "_" + $Date.Day + "-" + $Date.Month + "-" + $Date.Year + ".htm" 376 | $MyReport | out-file -encoding ASCII -filepath $Filename 377 | Invoke-Item $Filename 378 | } 379 | 380 | if ($SendAttachment) { 381 | $Filename = $Env:TEMP + "\" + $Server + "vCheck" + "_" + $Date.Day + "-" + $Date.Month + "-" + $Date.Year + ".htm" 382 | $MyReport | out-file -encoding ASCII -filepath $Filename 383 | } 384 | 385 | if ($Outputpath) { 386 | $Filename = $Outputpath + "\" + $Server + "vCheck" + "_" + $Date.Day + "-" + $Date.Month + "-" + $Date.Year + ".htm" 387 | $MyReport | out-file -encoding ASCII -filepath $Filename 388 | } 389 | 390 | if ($SendEmail) { 391 | Write-CustomOut "..Sending Email" 392 | If ($SendAttachment) { 393 | send-Mailmessage -To $EmailTo -From $EmailFrom -Subject "$Server vCheck Report" -SmtpServer $SMTPSRV -Body "vCheck attached to this email" -Attachments $Filename 394 | } Else { 395 | send-Mailmessage -To $EmailTo -From $EmailFrom -Subject "$Server vCheck Report" -SmtpServer $SMTPSRV -Body $MyReport -BodyAsHtml 396 | } 397 | } 398 | 399 | if ($SendAttachment -eq $true -and $DisplaytoScreen -ne $true) { 400 | Write-CustomOut "..Removing temporary file" 401 | Remove-Item $Filename -Force 402 | } 403 | 404 | $End = $ScriptPath + "\EndScript.ps1" 405 | . $End --------------------------------------------------------------------------------