Skip to content

Nutanix Cluster How To Stop Block Level

1 – Shutdown any guest VM’s
2 – Stop Nutanix Cluster

3. Logging to Putty on running CVM check nutanix@cvm$ cluster status

4. cluster stop

https://portal.nutanix.com/page/documents/details?targetId=Hardware_Replacement-Platform_v4_7:app_cluster_stop_t.html

https://craig-robinson.medium.com/installing-nutanix-community-edition-2-0-on-bare-metal-single-node-cluster-12589d00eaf1

Event ID 129 – Microsoft-Windows-Time-Service

To resynchronize the client with the time source peer:

  1. Open a command prompt as an administrator. To open a command prompt as an administrator, click Start. In Start Search, type Command Prompt. At the top of the Start menu, right-click Command Prompt, and then click Run as administrator. If the User Account Control dialog box appears, confirm that the action it displays is what you want, and then click Continue.
  2. At the command prompt, type w32tm /resync, and then press ENTER. The command output indicates whether the synchronization was successful.

Verify

To perform this procedure, you must have membership in Administrators, or you must have been delegated the appropriate authority.

To verify that the Windows Time service is synchronizing correctly:

  1. Open a command prompt as an administrator. To open a command prompt as an administrator, click Start. In Start Search, type Command Prompt. At the top of the Start menu, right-click Command Prompt, and then click Run as administrator. If the User Account Control dialog box appears, confirm that the action it displays is what you want, and then click Continue.
  2. At the command prompt, type W32TM /resync, and then press ENTER.
  3. At the command prompt, type W32TM /query /status, and then press ENTER.This command displays the status of the Windows Time service synchronization. The Last Successful Sync Time line of the output displays the date and time that you ran the W32TM /resync command in the previous step. Also, check the computer name that is shown as the Source. This should be the name of a domain controller (or an administrator-configured time server) in the same Active Directory domain as the local computer.

How to Enable Alternative Authentication Methods using Group Policy

We know the vulnerabilities of passwords today. User accounts are constantly under siege by credential stuffing attacks and malicious code and tools like key loggers that aim to capture passwords as users type them in. That’s why it is essential to support password authentication with some type of multifactor authentication such as a text messaging, authenticator apps or FIDO keys.

For Windows 10 and Windows 11, there are alternative sign-in methods available. For instance, biometric logons might be a good choice for those users that have laptops with built-in fingerprint sensors. Picture passwords may appeal to some organizations as an alternative. The Windows picture password sign-in requires a user to duplicate several gestures on a selected picture. Then again, those organizations that want to enforce standard desktop for all users may not want this option to be available. For users that always log onto the same computer, a PIN may be lucrative as a PIN is local to a specific device so a compromised pin is only good for its assigned device.

The point of this blog is just to show you how to enable/disable these alternatives using Group Policy or Intune. Let’s start with picture passwords. If you want to disable this option using Group Policy, create a GPO and go to Computer Configuration > Administrative Templates > System > Logon and enable “Turn off picture password sign-in” as shown below. The PIN setting is in the same location. In the screenshot below, I have disabled both options.

You use the same Administrative Template path in for Intune as well. Create a configuration profile and select Windows 10 and later as the platform and Templates > Administrative templates as the profile. Then navigate to Computer Configuration > Administrative Templates > System > and enable Turn off picture password sign-in as shown in the screenshot below. Once again, the PIN setting is there as well.

For fingerprint scanning or other biometric authentication options, create a GPO and go to Computer Configuration > Windows Components > Biometrics and select “Allow the use of biometrics” and “Allow users to log on using biometrics.” In the screenshot below I have enabled both of these.

To manage biometric settings using Intune, create a configuration profile and select Windows 10 and later as the platform and Templates > Identity protection as shown below.

After naming the profile, go an enable “Configure Windows Hello for Business. This will then provide access to all of its category settings. Then select, “Allow biometric authentication” with the result looking like the screenshot below.

Exchange 2016 to Exchange 2109 (hr=0x80004005, ec=1142) when trying to migrate Exchange Server user

I want to do On-premise Exchange 2016 to 2019 Migration and Co-existence. I got this error when trying to migrate user from 2016 to 2019 server. 

image

HTTP: Set-OrganizationConfig -MapiHttpEnabled $true.`

However Make sure database are mounted or space issue on DB’s than try to move the mailbox.

Thanks,

Exchange Shared Mailbox List For All Uses In Database

I have found very easy PS command to view users shared mailbox in case they have forgotten there shared mailbox name.  Run PS cmdlt using runas admin and use the following cmdlt

Get-MailboxStatistics -Database “Mailbox Database Name”

it will automatically exports to csv file and reference MS article

https://docs.microsoft.com/en-us/powershell/module/exchange/mailboxes/get-mailboxstatistics?view=exchange-ps

Let me know if this is useful

Citrix is THE brand

It is now official, as Citrix announced the changes during Synergy 2018. The message is clear, Citrix IS the brand! Read more to learn if your favorite brand made it through.

The new branding incorporates two meaningful categorization groups, Workspace and Networking, and Citrix has assigned its products to these categories. The Workspace portfolio comprises:

 

Old name New name
Cedexis Citrix Intelligent Traffic Management
Citrix Provisioning Service Citrix Provisioning
Citrix Receiver Citrix Workspace App
Citrix Workspace Service Citrix Workspace
Citrix Workspace Suite Citrix Workspace
Citrix XenApp Citrix Virtual Apps
Citrix XenApp and XenDesktop Citrix Virtual Apps and Desktops
Citrix XenApp and XenDesktop Service Citrix Virtual Apps and Desktops
Citrix XenDesktop Citrix Virtual Desktops
Citrix XenMobile Citrix Endpoint Management
ShareFile Citrix Content Collaboration
StoreFront StoreFront (on-prem only)
XenServer Citrix Hypervisor

And the Networking portfolio comprises

Old name Name
NetScaler ADC Citrix ADC
NetScaler AppFirewall Citrix Web App Firewall
NetScaler Access Gateway Citrix Gateway
NetScaler Management and Analytics System Citrix Application Delivery Management
NetScaler SD-WAN Citrix SD-WAN
NetScaler Secure Web Gateway Citrix Secure Web Gateway
NetScaler Unified Gateway Citrix Gateway
NetScaler Web App Security Citrix Web App Firewall

Source: https://www.citrix.com/support/citrix-product-guide.html

Daily writing prompt
Is your life today what you pictured a year ago?

Citrix Cloud Connector – Firewall Considerations

Citrix Cloud
Citrix cloud connector needs TCP 443 opened for all outbound communications to the Citrix Managed Control plane. Additionally the Host management and Machine Creation Management capabilities of Citrix cloud also require TCP 9350-9354 opened for communications to the Citrix Managed control plane.

Following is the Citrix Cloud communication ports required to be open on Hybrid environment

Source Description Destination Port
CC-01 Connecotrs 192.10.10.18 443
CC-02 192.10.10.19 443
Xapp-01 Application 192.10.10.22 443,1494,2598,80
XD-01 VDI 192.10.10.25 443,1494,2598,80
CC-01 Connectors Internet DP 123/UDP W32Time
TCP 135/TCP RPC EndpointMapper
TCP 464/TCP/UDP Kerberos password change
TCP 49152-65535/TCP RPC for LSA, SAM, Netlogon (*)
TCP/UDP 389/TCP/UDP LDAP
TCP 636/TCP LDAP SSL
CC-01 Connectors Actvie Directory  TCP 3268/TCP LDAP GC
TCP 3269/TCP LDAP GC SSL
TCP/UDP 53/TCP/UDP DNS
TCP 49152 -65535/TCP FRS RPC (*)
TCP/UDP 88/TCP/UDP Kerberos
TCP/UDP 445/TCP SMB
TCP 3269/TCP LDAP GC SSL
TCP/UDP 53/TCP/UDP DNS
TCP 49152 -65535/TCP FRS RPC (*)
TCP/UDP 88/TCP/UDP Kerberos
TCP/UDP 445/TCP SM
CC-Web1 Cloud Connector TCP 80/443 (encrypt with certificates)
Net-DC Connectors Cloud Connector TCP 80/443 (encrypt with certificates)
CC-01 Cloud Connector TCP 80 Traffic encrypted using Kerberos
CC-01 Connectors VDA XenApp/Xendesktop TCP 80 Traffic encrypted using Kerberos
Link

XenApp and XenDesktop Health Checkup

Please check a beow link for xenapp and xendesktop health check  and you can download the ps script

https://github.com/sacha81/XA-and-XD-HealthCheck

copy past in notepad and save  as XA-and -XD-Healthcheck.ps1

save#==============================================================================================
2 # Created on: 11.2014 Version: 1.1.0
3 # Created by: Sacha / sachathomet.ch & Contributers (see changelog)
4 # File name: XA-and-XD-HealthCheck.ps1
5 #
6 # Description: This script checks a Citrix XenDesktop and/or XenApp 7.x Farm
7 # It generates a HTML output File which will be sent as Email.
8 #
9 # Initial versions tested on XenApp/XenDesktop 7.6-7.11 and XenDesktop 5.6
10 # Newest version tested on XenApp/XenDesktop 7.9-7.11
11 #
12 # Prerequisite: Config file, a XenDesktop Controller with according privileges necessary
13 # Config file:  In order for the script to work properly, it needs a configuration file.
14 #               This has the same name as the script, with extension _Parameters.
15 #               The script name can’t contain any another point, even with a version.
16 #               Example: Script = “XA and XD HealthCheck.ps1”, Config = “XA and XD HealthCheck_Parameters.xml”
17 #
18 # Call by : Manual or by Scheduled Task, e.g. once a day
19 # Code History at the end of the file
20 #==============================================================================================
21 # Load only the snap-ins, which are used
22 if ((Get-PSSnapin “Citrix.Broker.Admin.*” -EA silentlycontinue) -eq $null) {
23 try { Add-PSSnapin Citrix.Broker.Admin.* -ErrorAction Stop }
24 catch { write-error “Error Get-PSSnapin Citrix.Broker.Admin.* Powershell snapin”; Return }
25 }
26 # Change the below variables to suit your environment
27 #==============================================================================================
28

29 # Import Variables from XML:
30

31 If (![string]::IsNullOrEmpty($hostinvocation)) {
32  [string]$Global:ScriptPath = [System.IO.Path]::GetDirectoryName([System.Windows.Forms.Application]::ExecutablePath)
33  [string]$Global:ScriptFile = [System.IO.Path]::GetFileName([System.Windows.Forms.Application]::ExecutablePath)
34  [string]$global:ScriptName = [System.IO.Path]::GetFileNameWithoutExtension([System.Windows.Forms.Application]::ExecutablePath)
35 } ElseIf ($Host.Version.Major -lt 3) {
36  [string]$Global:ScriptPath = Split-Path -parent $MyInvocation.MyCommand.Definition
37  [string]$Global:ScriptFile = Split-Path -Leaf $script:MyInvocation.MyCommand.Path
38  [string]$global:ScriptName = $ScriptFile.Split(‘.’)[0].Trim()
39 } Else {
40  [string]$Global:ScriptPath = $PSScriptRoot
41  [string]$Global:ScriptFile = Split-Path -Leaf $PSCommandPath
42  [string]$global:ScriptName = $ScriptFile.Split(‘.’)[0].Trim()
43 }
44

45 Set-StrictMode -Version Latest
46

47 # Import parameter file
48 $Global:ParameterFile = $ScriptName + “_Parameters.xml”
49 $Global:ParameterFilePath = $ScriptPath
50 [xml]$cfg = Get-Content ($ParameterFilePath + “\” + $ParameterFile) # Read content of XML file
51

52 # Import variables
53 Function New-XMLVariables {
54  # Create a variable reference to the XML file
55  $cfg.Settings.Variables.Variable | foreach {
56   # Set Variables contained in XML file
57   $VarValue = $_.Value
58   $CreateVariable = $True # Default value to create XML content as Variable
59   switch ($_.Type) {
60    # Format data types for each variable
61    ‘[string]’ { $VarValue = [string]$VarValue } # Fixed-length string of Unicode characters
62    ‘[char]’ { $VarValue = [char]$VarValue } # A Unicode 16-bit character
63    ‘[byte]’ { $VarValue = [byte]$VarValue } # An 8-bit unsigned character
64             ‘[bool]’ { If ($VarValue.ToLower() -eq ‘false’){$VarValue = [bool]$False} ElseIf ($VarValue.ToLower() -eq ‘true’){$VarValue = [bool]$True} } # An boolean True/False value
65    ‘[int]’ { $VarValue = [int]$VarValue } # 32-bit signed integer
66    ‘[long]’ { $VarValue = [long]$VarValue } # 64-bit signed integer
67    ‘[decimal]’ { $VarValue = [decimal]$VarValue } # A 128-bit decimal value
68    ‘[single]’ { $VarValue = [single]$VarValue } # Single-precision 32-bit floating point number
69    ‘[double]’ { $VarValue = [double]$VarValue } # Double-precision 64-bit floating point number
70    ‘[DateTime]’ { $VarValue = [DateTime]$VarValue } # Date and Time
71    ‘[Array]’ { $VarValue = [Array]$VarValue.Split(‘,’) } # Array
72    ‘[Command]’ { $VarValue = Invoke-Expression $VarValue; $CreateVariable = $False } # Command
73   }
74   If ($CreateVariable) { New-Variable -Name $_.Name -Value $VarValue -Scope $_.Scope -Force }
75  }
76 }
77

78 New-XMLVariables
79

80

81 $PvsWriteMaxSize = $PvsWriteMaxSize * 1Gb
82

83 ForEach ($DeliveryController in $DeliveryControllers){
84     If ($DeliveryController -ieq “LocalHost”){
85         $DeliveryController = [System.Net.DNS]::GetHostByName(”).HostName
86     }
87     If (Test-Connection $DeliveryController) {
88         $AdminAddress = $DeliveryController
89         break
90     }
91 }
92

93 $ReportDate = (Get-Date -UFormat “%A, %d. %B %Y %R”)
94

95

96 $currentDir = Split-Path $MyInvocation.MyCommand.Path
97 $logfile = Join-Path $currentDir (“CTXXDHealthCheck.log”)
98 $resultsHTM = Join-Path $currentDir (“CTXXDHealthCheck.htm”)
99
100 #Header for Table “XD/XA Controllers” Get-BrokerController
101 $XDControllerFirstheaderName = “ControllerServer”
102 $XDControllerHeaderNames = “Ping”,  “State”,”DesktopsRegistered”,  “ActiveSiteServices”,  “CFreespace”,  “DFreespace”,  “AvgCPU”,  “MemUsg”,  “Uptime”
103 $XDControllerHeaderWidths = “2”, “2”,  “2”,      “10”,     “4”,   “4”,   “4”,  “4”,  “4”
104 $XDControllerTableWidth= 1200
105
106 #Header for Table “MachineCatalogs” Get-BrokerCatalog
107 $CatalogHeaderName = “CatalogName”
108 $CatalogHeaderNames =  “AssignedToUser”,  “AssignedToDG”, “NotToUserAssigned”,”ProvisioningType”, “AllocationType”
109 $CatalogWidths =   “4”,    “8”,    “8”,     “8”,     “8”
110 $CatalogTablewidth = 900
111
112 #Header for Table “DeliveryGroups” Get-BrokerDesktopGroup
113 $AssigmentFirstheaderName = “DeliveryGroup”
114 $vAssigmentHeaderNames =  “PublishedName”,”DesktopKind”,  “TotalDesktops”,”DesktopsAvailable”,”DesktopsUnregistered”, “DesktopsInUse”,”DesktopsFree”, “MaintenanceMode”
115 $vAssigmentHeaderWidths =  “4”,    “4”,    “4”,    “4”,     “4”,      “4”,    “4”,    “2”
116 $Assigmenttablewidth = 900
117
118 #Header for Table “VDI Checks” Get-BrokerMachine
119 $VDIfirstheaderName = “Desktop-Name”
120

121 $VDIHeaderNames = “CatalogName”,”PowerState”, “Ping”, “MaintenanceMode”,  “Uptime”,  “RegistrationState”,”AssociatedUserNames”, “VDAVersion”, “WriteCacheType”, “WriteCacheSize”, “HostedOn”
122 $VDIHeaderWidths = “4”,   “4”,”4″,  “4”,     “4”,   “4”,     “4”,     “4”,     “4”,     “4”,     “4”
123

124 $VDItablewidth = 1200
125
126 #Header for Table “XenApp Checks” Get-BrokerMachine
127 $XenAppfirstheaderName = “XenApp-Server”
128 if ($ShowConnectedXenAppUsers -eq “1”) {
129

130  $XenAppHeaderNames = “CatalogName”, “DesktopGroupName”, “Serverload”,  “Ping”, “MaintMode”,”Uptime”,  “RegState”, “Spooler”,  “CitrixPrint”,  “CFreespace”,  “DFreespace”,  “AvgCPU”,  “MemUsg”,  “ActiveSessions”, “VDAVersion”, “WriteCacheType”, “WriteCacheSize”, “ConnectedUsers” , “HostedOn”
131  $XenAppHeaderWidths = “4”,    “4”,     “4”,    “4”,  “4”,   “4”,   “4”,   “6”,   “4”,    “4”,   “4”,   “4”,  “4”,  “4”,     “4”,   “4”,   “4”,   “4”,   “4”
132 }
133 else {
134  $XenAppHeaderNames = “CatalogName”,  “DesktopGroupName”, “Serverload”,  “Ping”, “MaintMode”,”Uptime”,  “RegState”, “Spooler”,  “CitrixPrint”,  “CFreespace”,  “DFreespace”,  “AvgCPU”,  “MemUsg”,  “ActiveSessions”, “VDAVersion”, “WriteCacheType”, “WriteCacheSize”, “HostedOn”
135  $XenAppHeaderWidths = “4”,    “4”,     “4”,    “4”,  “4”,   “4”,   “4”,   “6”,   “4”,    “4”,   “4”,   “4”,  “4”,  “4”,     “4”,   “4”,   “4”,   “4”
136

137 }
138

139 $XenApptablewidth = 1200
140
141 #==============================================================================================
142 #log function
143 function LogMe() {
144 Param(
145 [parameter(Mandatory = $true, ValueFromPipeline = $true)] $logEntry,
146 [switch]$display,
147 [switch]$error,
148 [switch]$warning,
149 [switch]$progress
150 )
151
152 if ($error) { $logEntry = “[ERROR] $logEntry” ; Write-Host “$logEntry” -Foregroundcolor Red }
153 elseif ($warning) { Write-Warning “$logEntry” ; $logEntry = “[WARNING] $logEntry” }
154 elseif ($progress) { Write-Host “$logEntry” -Foregroundcolor Green }
155 elseif ($display) { Write-Host “$logEntry” }
156
157 #$logEntry = ((Get-Date -uformat “%D %T”) + ” – ” + $logEntry)
158 $logEntry | Out-File $logFile -Append
159 }
160
161 #==============================================================================================
162 function Ping([string]$hostname, [int]$timeout = 200) {
163 $ping = new-object System.Net.NetworkInformation.Ping #creates a ping object
164 try { $result = $ping.send($hostname, $timeout).Status.ToString() }
165 catch { $result = “Failure” }
166 return $result
167 }
168 #==============================================================================================
169 # The function will check the processor counter and check for the CPU usage. Takes an average CPU usage for 5 seconds. It check the current CPU usage for 5 secs.
170 Function CheckCpuUsage()
171 {
172  param ($hostname)
173  Try { $CpuUsage=(get-counter -ComputerName $hostname -Counter “\Processor(_Total)\% Processor Time” -SampleInterval 1 -MaxSamples 5 -ErrorAction Stop | select -ExpandProperty countersamples | select -ExpandProperty cookedvalue | Measure-Object -Average).average
174      $CpuUsage = [math]::round($CpuUsage, 1); return $CpuUsage
175  } Catch { “Error returned while checking the CPU usage. Perfmon Counters may be fault” | LogMe -error; return 101 }
176 }
177 #==============================================================================================
178 # The function check the memory usage and report the usage value in percentage
179 Function CheckMemoryUsage()
180 {
181  param ($hostname)
182     Try
183  {   $SystemInfo = (Get-WmiObject -computername $hostname -Class Win32_OperatingSystem -ErrorAction Stop | Select-Object TotalVisibleMemorySize, FreePhysicalMemory)
184      $TotalRAM = $SystemInfo.TotalVisibleMemorySize/1MB
185      $FreeRAM = $SystemInfo.FreePhysicalMemory/1MB
186      $UsedRAM = $TotalRAM – $FreeRAM
187      $RAMPercentUsed = ($UsedRAM / $TotalRAM) * 100
188      $RAMPercentUsed = [math]::round($RAMPercentUsed, 2);
189      return $RAMPercentUsed
190  } Catch { “Error returned while checking the Memory usage. Perfmon Counters may be fault” | LogMe -error; return 101 }
191 }
192 #==============================================================================================
193

194 # The function check the HardDrive usage and report the usage value in percentage and free space
195 Function CheckHardDiskUsage()
196 {
197  param ($hostname, $deviceID)
198     Try
199  {
200      $HardDisk = $null
201   $HardDisk = Get-WmiObject Win32_LogicalDisk -ComputerName $hostname -Filter “DeviceID=’$deviceID'” -ErrorAction Stop | Select-Object Size,FreeSpace
202         if ($HardDisk -ne $null)
203   {
204   $DiskTotalSize = $HardDisk.Size
205         $DiskFreeSpace = $HardDisk.FreeSpace
206         $frSpace=[Math]::Round(($DiskFreeSpace/1073741824),2)
207   $PercentageDS = (($DiskFreeSpace / $DiskTotalSize ) * 100); $PercentageDS = [math]::round($PercentageDS, 2)
208
209   Add-Member -InputObject $HardDisk -MemberType NoteProperty -Name PercentageDS -Value $PercentageDS
210   Add-Member -InputObject $HardDisk -MemberType NoteProperty -Name frSpace -Value $frSpace
211   }
212
213      return $HardDisk
214  } Catch { “Error returned while checking the Hard Disk usage. Perfmon Counters may be fault” | LogMe -error; return $null }
215 }
216
217 #==============================================================================================
218 Function writeHtmlHeader
219 {
220 param($title, $fileName)
221 $date = $ReportDate
222 $head = @”
223 <html>
224 <head>
225 <meta http-equiv=’Content-Type’ content=’text/html; charset=iso-8859-1′>
226 <title>$title</title>
227 <STYLE TYPE=”text/css”>
228 <!–
229 td {
230 font-family: Tahoma;
231 font-size: 11px;
232 border-top: 1px solid #999999;
233 border-right: 1px solid #999999;
234 border-bottom: 1px solid #999999;
235 border-left: 1px solid #999999;
236 padding-top: 0px;
237 padding-right: 0px;
238 padding-bottom: 0px;
239 padding-left: 0px;
240 overflow: hidden;
241 }
242 body {
243 margin-left: 5px;
244 margin-top: 5px;
245 margin-right: 0px;
246 margin-bottom: 10px;
247 table {
248 table-layout:fixed;
249 border: thin solid #000000;
250 }
251 –>
252 </style>
253 </head>
254 <body>
255 <table width=’1200′>
256 <tr bgcolor=’#CCCCCC’>
257 <td colspan=’7′ height=’48’ align=’center’ valign=”middle”>
258 <font face=’tahoma’ color=’#003399′ size=’4′>
259 <strong>$title – $date</strong></font>
260 </td>
261 </tr>
262 </table>
263 “@
264 $head | Out-File $fileName
265 }
266
267 # ==============================================================================================
268 Function writeTableHeader
269 {
270 param($fileName, $firstheaderName, $headerNames, $headerWidths, $tablewidth)
271 $tableHeader = @”
272
273 <table width=’$tablewidth’><tbody>
274 <tr bgcolor=#CCCCCC>
275 <td width=’6%’ align=’center’><strong>$firstheaderName</strong></td>
276 “@
277
278 $i = 0
279 while ($i -lt $headerNames.count) {
280 $headerName = $headerNames[$i]
281 $headerWidth = $headerWidths[$i]
282 $tableHeader += “<td width='” + $headerWidth + “%’ align=’center’><strong>$headerName</strong></td>”
283 $i++
284 }
285
286 $tableHeader += “</tr>”
287
288 $tableHeader | Out-File $fileName -append
289 }
290
291 # ==============================================================================================
292 Function writeTableFooter
293 {
294 param($fileName)
295 “</table><br/>”| Out-File $fileName -append
296 }
297
298 #==============================================================================================
299 Function writeData
300 {
301 param($data, $fileName, $headerNames)
302

303 $tableEntry  =””
304 $data.Keys | sort | foreach {
305 $tableEntry += “<tr>”
306 $computerName = $_
307 $tableEntry += (“<td bgcolor=’#CCCCCC’ align=center><font color=’#003399′>$computerName</font></td>”)
308 #$data.$_.Keys | foreach {
309 $headerNames | foreach {
310 #”$computerName : $_” | LogMe -display
311 try {
312 if ($data.$computerName.$_[0] -eq “SUCCESS”) { $bgcolor = “#387C44”; $fontColor = “#FFFFFF” }
313 elseif ($data.$computerName.$_[0] -eq “WARNING”) { $bgcolor = “#FF7700”; $fontColor = “#FFFFFF” }
314 elseif ($data.$computerName.$_[0] -eq “ERROR”) { $bgcolor = “#FF0000”; $fontColor = “#FFFFFF” }
315 else { $bgcolor = “#CCCCCC”; $fontColor = “#003399” }
316 $testResult = $data.$computerName.$_[1]
317 }
318 catch {
319 $bgcolor = “#CCCCCC”; $fontColor = “#003399”
320 $testResult = “”
321 }
322 $tableEntry += (“<td bgcolor='” + $bgcolor + “‘ align=center><font color='” + $fontColor + “‘>$testResult</font></td>”)
323 }
324 $tableEntry += “</tr>”
325 }
326 $tableEntry | Out-File $fileName -append
327 }
328
329 # ==============================================================================================
330 Function writeHtmlFooter
331 {
332 param($fileName)
333 @”
334 </table>
335 <table width=’1200′>
336 <tr bgcolor=’#CCCCCC’>
337 <td colspan=’7′ height=’25’ align=’left’>
338 <font face=’courier’ color=’#000000′ size=’2′><strong>Uptime Threshold =</strong></font><font color=’#003399′ face=’courier’ size=’2′> $maxUpTimeDays days</font>
339 </td>
340 </table>
341 </body>
342 </html>
343 “@ | Out-File $FileName -append
344 }
345

346 # ==============================================================================================
347 Function ToHumanReadable()
348 {
349   param($timespan)
350
351   If ($timespan.TotalHours -lt 1) {
352     return $timespan.Minutes + “minutes”
353   }
354

355   $sb = New-Object System.Text.StringBuilder
356   If ($timespan.Days -gt 0) {
357     [void]$sb.Append($timespan.Days)
358     [void]$sb.Append(” days”)
359     [void]$sb.Append(“, “)
360   }
361   If ($timespan.Hours -gt 0) {
362     [void]$sb.Append($timespan.Hours)
363     [void]$sb.Append(” hours”)
364   }
365   If ($timespan.Minutes -gt 0) {
366     [void]$sb.Append(” and “)
367     [void]$sb.Append($timespan.Minutes)
368     [void]$sb.Append(” minutes”)
369   }
370   return $sb.ToString()
371 }
372

373 # ==============================================================================================
374

375 $wmiOSBlock = {param($computer)
376   try { $wmi=Get-WmiObject -class Win32_OperatingSystem -computer $computer }
377   catch { $wmi = $null }
378   return $wmi
379 }
380

381 #==============================================================================================
382 # == MAIN SCRIPT ==
383 #==============================================================================================
384 rm $logfile -force -EA SilentlyContinue
385 rm $resultsHTM -force -EA SilentlyContinue
386
387 “#### Begin with Citrix XenDestop / XenApp HealthCheck ######################################################################” | LogMe -display -progress
388
389 ” ” | LogMe -display -progress
390

391 # Log the loaded Citrix PS Snapins
392 (Get-PSSnapin “Citrix.*” -EA silentlycontinue).Name | ForEach {“PSSnapIn: ” + $_ | LogMe -display -progress}
393
394 #== Controller Check ============================================================================================
395 “Check Controllers #############################################################################” | LogMe -display -progress
396
397 ” ” | LogMe -display -progress
398
399 $ControllerResults = @{}
400 $Controllers = Get-BrokerController -AdminAddress $AdminAddress
401

402 # Get first DDC version (should be all the same unless an upgrade is in progress)
403 $ControllerVersion = $Controllers[0].ControllerVersion
404 “Version: $controllerversion ” | LogMe -display -progress
405
406 if ($ControllerVersion -lt 7 ) {
407   “XenDesktop/XenApp Version below 7.x ($controllerversion) – only DesktopCheck will be performed” | LogMe -display -progress
408   $ShowXenAppTable = 0
409 } else {
410   “XenDesktop/XenApp Version above 7.x ($controllerversion) – XenApp and DesktopCheck will be performed” | LogMe -display -progress
411 }
412

413 foreach ($Controller in $Controllers) {
414 $tests = @{}
415
416 #Name of $Controller
417 $ControllerDNS = $Controller | %{ $_.DNSName }
418 “Controller: $ControllerDNS” | LogMe -display -progress
419
420 #Ping $Controller
421 $result = Ping $ControllerDNS 100
422 if ($result -ne “SUCCESS”) { $tests.Ping = “Error”, $result }
423 else { $tests.Ping = “SUCCESS”, $result
424

425 #Now when Ping is ok also check this:
426
427 #State of this controller
428 $ControllerState = $Controller | %{ $_.State }
429 “State: $ControllerState” | LogMe -display -progress
430 if ($ControllerState -ne “Active”) { $tests.State = “ERROR”, $ControllerState }
431 else { $tests.State = “SUCCESS”, $ControllerState }
432
433 #DesktopsRegistered on this controller
434 $ControllerDesktopsRegistered = $Controller | %{ $_.DesktopsRegistered }
435 “Registered: $ControllerDesktopsRegistered” | LogMe -display -progress
436 $tests.DesktopsRegistered = “NEUTRAL”, $ControllerDesktopsRegistered
437
438 #ActiveSiteServices on this controller
439 $ActiveSiteServices = $Controller | %{ $_.ActiveSiteServices }
440 “ActiveSiteServices $ActiveSiteServices” | LogMe -display -progress
441 $tests.ActiveSiteServices = “NEUTRAL”, $ActiveSiteServices
442

443

444 #==============================================================================================
445 #               CHECK CPU AND MEMORY USAGE
446 #==============================================================================================
447

448         # Check the AvgCPU value for 5 seconds
449         $AvgCPUval = CheckCpuUsage ($ControllerDNS)
450   #$VDtests.LoadBalancingAlgorithm = “SUCCESS”, “LB is set to BEST EFFORT”}
451
452         if( [int] $AvgCPUval -lt 75) { “CPU usage is normal [ $AvgCPUval % ]” | LogMe -display; $tests.AvgCPU = “SUCCESS”, “$AvgCPUval %” }
453   elseif([int] $AvgCPUval -lt 85) { “CPU usage is medium [ $AvgCPUval % ]” | LogMe -warning; $tests.AvgCPU = “WARNING”, “$AvgCPUval %” }
454   elseif([int] $AvgCPUval -lt 95) { “CPU usage is high [ $AvgCPUval % ]” | LogMe -error; $tests.AvgCPU = “ERROR”, “$AvgCPUval %” }
455   elseif([int] $AvgCPUval -eq 101) { “CPU usage test failed” | LogMe -error; $tests.AvgCPU = “ERROR”, “Err” }
456         else { “CPU usage is Critical [ $AvgCPUval % ]” | LogMe -error; $tests.AvgCPU = “ERROR”, “$AvgCPUval %” }
457   $AvgCPUval = 0
458

459         # Check the Physical Memory usage
460         $UsedMemory = CheckMemoryUsage ($ControllerDNS)
461         if( $UsedMemory -lt 75) { “Memory usage is normal [ $UsedMemory % ]” | LogMe -display; $tests.MemUsg = “SUCCESS”, “$UsedMemory %” }
462   elseif( [int] $UsedMemory -lt 85) { “Memory usage is medium [ $UsedMemory % ]” | LogMe -warning; $tests.MemUsg = “WARNING”, “$UsedMemory %” }
463   elseif( [int] $UsedMemory -lt 95) { “Memory usage is high [ $UsedMemory % ]” | LogMe -error; $tests.MemUsg = “ERROR”, “$UsedMemory %” }
464   elseif( [int] $UsedMemory -eq 101) { “Memory usage test failed” | LogMe -error; $tests.MemUsg = “ERROR”, “Err” }
465         else { “Memory usage is Critical [ $UsedMemory % ]” | LogMe -error; $tests.MemUsg = “ERROR”, “$UsedMemory %” }
466   $UsedMemory = 0
467

468         # Check C Disk Usage
469   $HardDisk = CheckHardDiskUsage -hostname $ControllerDNS -deviceID “C:”
470   if ($HardDisk -ne $null) {
471    $XAPercentageDS = $HardDisk.PercentageDS
472    $frSpace = $HardDisk.frSpace
473
474          If ( [int] $XAPercentageDS -gt 15) { “Disk Free is normal [ $XAPercentageDS % ]” | LogMe -display; $tests.CFreespace = “SUCCESS”, “$frSpace GB” }
475    ElseIf ([int] $XAPercentageDS -eq 0) { “Disk Free test failed” | LogMe -error; $tests.CFreespace = “ERROR”, “Err” }
476    ElseIf ([int] $XAPercentageDS -lt 5) { “Disk Free is Critical [ $XAPercentageDS % ]” | LogMe -error; $tests.CFreespace = “ERROR”, “$frSpace GB” }
477    ElseIf ([int] $XAPercentageDS -lt 15) { “Disk Free is Low [ $XAPercentageDS % ]” | LogMe -warning; $tests.CFreespace = “WARNING”, “$frSpace GB” }
478          Else { “Disk Free is Critical [ $XAPercentageDS % ]” | LogMe -error; $tests.CFreespace = “ERROR”, “$frSpace GB” }
479
480    $XAPercentageDS = 0
481    $frSpace = 0
482    $HardDisk = $null
483   }
484

485   $tests.DFreespace = “NEUTRAL”, “N/A”
486   if ( $ControllerHaveD -eq “1” ) {
487    # Check D Disk Usage on DeliveryController
488          $HardDiskd = CheckHardDiskUsage -hostname $ControllerDNS -deviceID “D:”
489    if ($HardDiskd -ne $null)
490    {
491     $XAPercentageDSd = $HardDiskd.PercentageDS
492     $frSpaced = $HardDiskd.frSpace
493

494     If ( [int] $XAPercentageDSd -gt 15) { “D: Disk Free is normal [ $XAPercentageDSd % ]” | LogMe -display; $tests.DFreespace = “SUCCESS”, “$frSpaced GB” }
495     ElseIf ([int] $XAPercentageDSd -eq 0) { “D: Disk Free test failed” | LogMe -error; $tests.DFreespace = “ERROR”, “Err” }
496     ElseIf ([int] $XAPercentageDSd -lt 5) { “D: Disk Free is Critical [ $XAPercentageDSd % ]” | LogMe -error; $tests.DFreespace = “ERROR”, “$frSpaced GB” }
497     ElseIf ([int] $XAPercentageDSd -lt 15) { “D: Disk Free is Low [ $XAPercentageDSd % ]” | LogMe -warning; $tests.DFreespace = “WARNING”, “$frSpaced GB” }
498     Else { “D: Disk Free is Critical [ $XAPercentageDSd % ]” | LogMe -error; $tests.DFreespace = “ERROR”, “$frSpaced GB” }
499
500     $XAPercentageDSd = 0
501     $frSpaced = 0
502     $HardDiskd = $null
503    }
504   }
505
506   # Check uptime (Query over WMI)
507     $tests.WMI = “ERROR”,”Error”
508     try { $wmi=Get-WmiObject -class Win32_OperatingSystem -computer $ControllerDNS }
509     catch { $wmi = $null }
510

511     # Perform WMI related checks
512     if ($wmi -ne $null) {
513         $tests.WMI = “SUCCESS”, “Success”
514         $LBTime=$wmi.ConvertToDateTime($wmi.Lastbootuptime)
515         [TimeSpan]$uptime=New-TimeSpan $LBTime $(get-date)
516

517         if ($uptime.days -lt $minUpTimeDaysDDC){
518             “reboot warning, last reboot: {0:D}” -f $LBTime | LogMe -display -warning
519             $tests.Uptime = “WARNING”, (ToHumanReadable($uptime))
520         }
521         else { $tests.Uptime = “SUCCESS”, (ToHumanReadable($uptime)) }
522     }
523     else { “WMI connection failed – check WMI for corruption” | LogMe -display -error }
524 }
525

526

527
528 ” — ” | LogMe -display -progress
529 #Fill $tests into array
530 $ControllerResults.$ControllerDNS = $tests
531 }
532
533 #== Catalog Check ============================================================================================
534 “Check Catalog #################################################################################” | LogMe -display -progress
535 ” ” | LogMe -display -progress
536
537 $CatalogResults = @{}
538 $Catalogs = Get-BrokerCatalog -AdminAddress $AdminAddress
539
540 foreach ($Catalog in $Catalogs) {
541   $tests = @{}
542
543   #Name of MachineCatalog
544   $CatalogName = $Catalog | %{ $_.Name }
545   “Catalog: $CatalogName” | LogMe -display -progress
546

547   if ($ExcludedCatalogs -contains $CatalogName) {
548     “Excluded Catalog, skipping” | LogMe -display -progress
549   } else {
550     #CatalogAssignedCount
551     $CatalogAssignedCount = $Catalog | %{ $_.AssignedCount }
552     “Assigned: $CatalogAssignedCount” | LogMe -display -progress
553     $tests.AssignedToUser = “NEUTRAL”, $CatalogAssignedCount
554
555     #CatalogUnassignedCount
556     $CatalogUnAssignedCount = $Catalog | %{ $_.UnassignedCount }
557     “Unassigned: $CatalogUnAssignedCount” | LogMe -display -progress
558     $tests.NotToUserAssigned = “NEUTRAL”, $CatalogUnAssignedCount
559
560     # Assigned to DeliveryGroup
561     $CatalogUsedCountCount = $Catalog | %{ $_.UsedCount }
562     “Used: $CatalogUsedCountCount” | LogMe -display -progress
563     $tests.AssignedToDG = “NEUTRAL”, $CatalogUsedCountCount
564
565      #ProvisioningType
566      $CatalogProvisioningType = $Catalog | %{ $_.ProvisioningType }
567      “ProvisioningType: $CatalogProvisioningType” | LogMe -display -progress
568      $tests.ProvisioningType = “NEUTRAL”, $CatalogProvisioningType
569
570      #AllocationType
571      $CatalogAllocationType = $Catalog | %{ $_.AllocationType }
572      “AllocationType: $CatalogAllocationType” | LogMe -display -progress
573      $tests.AllocationType = “NEUTRAL”, $CatalogAllocationType
574
575     “”, “”
576     $CatalogResults.$CatalogName = $tests
577   }
578   ” — ” | LogMe -display -progress
579 }
580
581 #== DeliveryGroups Check ============================================================================================
582 “Check Assigments #############################################################################” | LogMe -display -progress
583
584 ” ” | LogMe -display -progress
585
586 $AssigmentsResults = @{}
587 $Assigments = Get-BrokerDesktopGroup -AdminAddress $AdminAddress
588
589 foreach ($Assigment in $Assigments) {
590   $tests = @{}
591
592   #Name of DeliveryGroup
593   $DeliveryGroupName = $Assigment | %{ $_.Name }
594   “DeliveryGroup: $DeliveryGroupName” | LogMe -display -progress
595
596   if ($ExcludedCatalogs -contains $DeliveryGroupName) {
597     “Excluded Delivery Group, skipping” | LogMe -display -progress
598   } else {
599
600     #PublishedName
601     $AssigmentDesktopPublishedName = $Assigment | %{ $_.PublishedName }
602     “PublishedName: $AssigmentDesktopPublishedName” | LogMe -display -progress
603     $tests.PublishedName = “NEUTRAL”, $AssigmentDesktopPublishedName
604
605     #DesktopsTotal
606     $TotalDesktops = $Assigment | %{ $_.TotalDesktops }
607     “DesktopsAvailable: $TotalDesktops” | LogMe -display -progress
608     $tests.TotalDesktops = “NEUTRAL”, $TotalDesktops
609
610     #DesktopsAvailable
611     $AssigmentDesktopsAvailable = $Assigment | %{ $_.DesktopsAvailable }
612     “DesktopsAvailable: $AssigmentDesktopsAvailable” | LogMe -display -progress
613     $tests.DesktopsAvailable = “NEUTRAL”, $AssigmentDesktopsAvailable
614
615     #DesktopKind
616     $AssigmentDesktopsKind = $Assigment | %{ $_.DesktopKind }
617     “DesktopKind: $AssigmentDesktopsKind” | LogMe -display -progress
618     $tests.DesktopKind = “NEUTRAL”, $AssigmentDesktopsKind
619
620     #inMaintenanceMode
621     $AssigmentDesktopsinMaintenanceMode = $Assigment | %{ $_.inMaintenanceMode }
622     “inMaintenanceMode: $AssigmentDesktopsinMaintenanceMode” | LogMe -display -progress
623     if ($AssigmentDesktopsinMaintenanceMode) { $tests.MaintenanceMode = “WARNING”, “ON” }
624     else { $tests.MaintenanceMode = “SUCCESS”, “OFF” }
625
626     #DesktopsUnregistered
627     $AssigmentDesktopsUnregistered = $Assigment | %{ $_.DesktopsUnregistered }
628     “DesktopsUnregistered: $AssigmentDesktopsUnregistered” | LogMe -display -progress
629     if ($AssigmentDesktopsUnregistered -gt 0 ) {
630       “DesktopsUnregistered > 0 ! ($AssigmentDesktopsUnregistered)” | LogMe -display -progress
631       $tests.DesktopsUnregistered = “WARNING”, $AssigmentDesktopsUnregistered
632     } else {
633       $tests.DesktopsUnregistered = “SUCCESS”, $AssigmentDesktopsUnregistered
634       “DesktopsUnregistered <= 0 ! ($AssigmentDesktopsUnregistered)” | LogMe -display -progress
635     }
636
637     #DesktopsInUse
638     $AssigmentDesktopsInUse = $Assigment | %{ $_.DesktopsInUse }
639     “DesktopsInUse: $AssigmentDesktopsInUse” | LogMe -display -progress
640     $tests.DesktopsInUse = “NEUTRAL”, $AssigmentDesktopsInUse
641
642     #DesktopFree
643     $AssigmentDesktopsFree = $AssigmentDesktopsAvailable – $AssigmentDesktopsInUse
644     “DesktopsFree: $AssigmentDesktopsFree” | LogMe -display -progress
645
646     if ($AssigmentDesktopsKind -eq “shared”) {
647       if ($AssigmentDesktopsFree -gt 0 ) {
648         “DesktopsFree < 1 ! ($AssigmentDesktopsFree)” | LogMe -display -progress
649         $tests.DesktopsFree = “SUCCESS”, $AssigmentDesktopsFree
650       } elseif ($AssigmentDesktopsFree -lt 0 ) {
651         “DesktopsFree < 1 ! ($AssigmentDesktopsFree)” | LogMe -display -progress
652         $tests.DesktopsFree = “SUCCESS”, “N/A”
653       } else {
654         $tests.DesktopsFree = “WARNING”, $AssigmentDesktopsFree
655         “DesktopsFree > 0 ! ($AssigmentDesktopsFree)” | LogMe -display -progress
656       }
657     } else {
658       $tests.DesktopsFree = “SUCCESS”, “N/A”
659     }
660
661     #Fill $tests into array
662     $AssigmentsResults.$DeliveryGroupName = $tests
663   }
664   ” — ” | LogMe -display -progress
665 }
666
667 # ======= Desktop Check ========
668 “Check virtual Desktops ####################################################################################” | LogMe -display -progress
669 ” ” | LogMe -display -progress
670
671 if($ShowDesktopTable -eq 1 ) {
672
673 $allResults = @{}
674
675 $machines = Get-BrokerMachine -MaxRecordCount $maxmachines -AdminAddress $AdminAddress| Where-Object {$_.SessionSupport -eq “SingleSession”}
676
677 # SessionSupport only availiable in XD 7.x – for this reason only distinguish in Version above 7 if Desktop or XenApp
678 if($controllerversion -lt 7 ) { $machines = Get-BrokerMachine -MaxRecordCount $maxmachines -AdminAddress $AdminAddress}
679 else { $machines = Get-BrokerMachine -MaxRecordCount $maxmachines -AdminAddress $AdminAddress| Where-Object {$_.SessionSupport -eq “SingleSession” } }
680
681 foreach($machine in $machines) {
682 $tests = @{}
683
684 $ErrorVDI = 0
685
686 # Column Name of Desktop
687 $machineDNS = $machine | %{ $_.DNSName }
688 “Machine: $machineDNS” | LogMe -display -progress
689
690 # Column CatalogName
691 $CatalogName = $machine | %{ $_.CatalogName }
692 “Catalog: $CatalogName” | LogMe -display -progress
693 $tests.CatalogName = “NEUTRAL”, $CatalogName
694

695 # Column Powerstate
696 $Powered = $machine | %{ $_.PowerState }
697 “PowerState: $Powered” | LogMe -display -progress
698 $tests.PowerState = “NEUTRAL”, $Powered
699

700 if ($Powered -eq “Off” -OR $Powered -eq “Unknown”) {
701 $tests.PowerState = “NEUTRAL”, $Powered
702 }
703

704 if ($Powered -eq “On”) {
705 $tests.PowerState = “SUCCESS”, $Powered
706 }
707

708 if ($Powered -eq “On” -OR $Powered -eq “Unknown”) {
709

710

711 # Column Ping Desktop
712 $result = Ping $machineDNS 100
713 if ($result -eq “SUCCESS”) {
714   $tests.Ping = “SUCCESS”, $result
715
716   #==============================================================================================
717   # Column Uptime (Query over WMI – only if Ping successfull)
718   $tests.WMI = “ERROR”,”Error”
719   $job = Start-Job -ScriptBlock $wmiOSBlock -ArgumentList $machineDNS
720   $wmi = Wait-job $job -Timeout 15 | Receive-Job
721

722   # Perform WMI related checks
723   if ($wmi -ne $null) {
724     $tests.WMI = “SUCCESS”, “Success”
725     $LBTime=[Management.ManagementDateTimeConverter]::ToDateTime($wmi.Lastbootuptime)
726     [TimeSpan]$uptime=New-TimeSpan $LBTime $(get-date)
727
728     if ($uptime.days -gt $maxUpTimeDays) {
729       “reboot warning, last reboot: {0:D}” -f $LBTime | LogMe -display -warning
730       $tests.Uptime = “WARNING”, $uptime.days
731       $ErrorVDI = $ErrorVDI + 1
732     } else {
733       $tests.Uptime = “SUCCESS”, $uptime.days
734     }
735   } else {
736     “WMI connection failed – check WMI for corruption” | LogMe -display -error
737     stop-job $job
738   }
739 }
740 else {
741 $tests.Ping = “Error”, $result
742 $ErrorVDI = $ErrorVDI + 1
743 }
744 #END of Ping-Section
745

746 # Column RegistrationState
747 $RegistrationState = $machine | %{ $_.RegistrationState }
748 “State: $RegistrationState” | LogMe -display -progress
749 if ($RegistrationState -ne “Registered”) {
750 $tests.RegistrationState = “ERROR”, $RegistrationState
751 $ErrorVDI = $ErrorVDI + 1
752 }
753 else { $tests.RegistrationState = “SUCCESS”, $RegistrationState }
754

755 }
756
757 # Column MaintenanceMode
758 $MaintenanceMode = $machine | %{ $_.InMaintenanceMode }
759 “MaintenanceMode: $MaintenanceMode” | LogMe -display -progress
760 if ($MaintenanceMode) { $tests.MaintenanceMode = “WARNING”, “ON”
761 $ErrorVDI = $ErrorVDI + 1
762 }
763 else { $tests.MaintenanceMode = “SUCCESS”, “OFF” }
764
765 # Column HostedOn
766 $HostedOn = $machine | %{ $_.HostingServerName }
767 “HostedOn: $HostedOn” | LogMe -display -progress
768 $tests.HostedOn = “NEUTRAL”, $HostedOn
769

770 # Column VDAVersion AgentVersion
771 $VDAVersion = $machine | %{ $_.AgentVersion }
772 “VDAVersion: $VDAVersion” | LogMe -display -progress
773 $tests.VDAVersion = “NEUTRAL”, $VDAVersion
774

775

776

777
778 # Column AssociatedUserNames
779 $AssociatedUserNames = $machine | %{ $_.AssociatedUserNames }
780 “Assigned to $AssociatedUserNames” | LogMe -display -progress
781 $tests.AssociatedUserNames = “NEUTRAL”, $AssociatedUserNames
782
783 ” — ” | LogMe -display -progress
784
785 # Fill $tests into array if error occured OR $ShowOnlyErrorVDI = 0
786 # Check to see if the server is in an excluded folder path
787 if ($ExcludedCatalogs -contains $CatalogName) {
788 “$machineDNS in excluded folder – skipping” | LogMe -display -progress
789 }
790 else {
791 # Check if error exists on this vdi
792 if ($ShowOnlyErrorVDI -eq 0 ) { $allResults.$machineDNS = $tests }
793 else {
794 if ($ErrorVDI -gt 0) { $allResults.$machineDNS = $tests }
795 else { “$machineDNS is ok, no output into HTML-File” | LogMe -display -progress }
796 }
797 }
798 }
799 }
800 else { “Desktop Check skipped because ShowDesktopTable = 0 ” | LogMe -display -progress }
801
802 # ======= XenApp Check ========
803 “Check XenApp Servers ####################################################################################” | LogMe -display -progress
804 ” ” | LogMe -display -progress
805
806 # Check XenApp only if $ShowXenAppTable is 1
807 if($ShowXenAppTable -eq 1 ) {
808 $allXenAppResults = @{}
809
810 $XAmachines = Get-BrokerMachine -MaxRecordCount $maxmachines -AdminAddress $AdminAddress | Where-Object {$_.SessionSupport -eq “MultiSession”}
811
812 foreach ($XAmachine in $XAmachines) {
813 $tests = @{}
814
815 $ErrorXA = 0
816
817 # Column Name of Machine
818 $machineDNS = $XAmachine | %{ $_.DNSName }
819 “Machine: $machineDNS” | LogMe -display -progress
820
821 # Column CatalogNameName
822 $CatalogName = $XAmachine | %{ $_.CatalogName }
823 “Catalog: $CatalogName” | LogMe -display -progress
824 $tests.CatalogName = “NEUTRAL”, $CatalogName
825
826 # Ping Machine
827 $result = Ping $machineDNS 100
828 if ($result -eq “SUCCESS”) {
829 $tests.Ping = “SUCCESS”, $result
830
831 #==============================================================================================
832 # Column Uptime (Query over WMI – only if Ping successfull)
833 $tests.WMI = “ERROR”,”Error”
834 $job = Start-Job -ScriptBlock $wmiOSBlock -ArgumentList $machineDNS
835 $wmi = Wait-job $job -Timeout 15 | Receive-Job
836

837 # Perform WMI related checks
838 if ($wmi -ne $null) {
839  $tests.WMI = “SUCCESS”, “Success”
840  $LBTime=[Management.ManagementDateTimeConverter]::ToDateTime($wmi.Lastbootuptime)
841  [TimeSpan]$uptime=New-TimeSpan $LBTime $(get-date)
842

843  if ($uptime.days -gt $maxUpTimeDays) {
844   “reboot warning, last reboot: {0:D}” -f $LBTime | LogMe -display -warning
845   $tests.Uptime = “WARNING”, $uptime.days
846   $ErrorXA = $ErrorXA + 1
847  } else {
848   $tests.Uptime = “SUCCESS”, $uptime.days
849  }
850 } else {
851  “WMI connection failed – check WMI for corruption” | LogMe -display -error
852  stop-job $job
853 }
854 #—-
855
856 # Column WriteCacheSize (only if Ping is successful)
857 ################ PVS SECTION ###############
858 if (test-path \\$machineDNS\c$\Personality.ini) {
859 # Test if PVS cache is of type “device’s hard drive”
860 $PvsWriteCacheUNC = Join-Path “\\$machineDNS” ($PvsWriteCacheDrive+”$”+”\.vdiskcache”)
861 $CacheDiskOnHD = Test-Path $PvsWriteCacheUNC
862

863 if ($CacheDiskOnHD -eq $True) {
864   $CacheDiskExists = $True
865   $CachePVSType = “Device HD”
866 } else {
867   # Test if PVS cache is of type “device RAM with overflow to hard drive”
868   $PvsWriteCacheUNC = Join-Path “\\$machineDNS” ($PvsWriteCacheDrive+”$”+”\vdiskdif.vhdx”)
869   $CacheDiskRAMwithOverflow = Test-Path $PvsWriteCacheUNC
870   if ($CacheDiskRAMwithOverflow -eq $True) {
871     $CacheDiskExists = $True
872     $CachePVSType = “Device RAM with overflow to disk”
873   } else {
874     $CacheDiskExists = $False
875     $CachePVSType = “”
876   }
877 }
878

879 if ($CacheDiskExists -eq $True) {
880 $CacheDisk = [long] ((get-childitem $PvsWriteCacheUNC -force).length)
881 $CacheDiskGB = “{0:n2}GB” -f($CacheDisk / 1GB)
882 “PVS Cache file size: {0:n2}GB” -f($CacheDisk / 1GB) | LogMe
883 #”PVS Cache max size: {0:n2}GB” -f($PvsWriteMaxSize / 1GB) | LogMe -display
884 $tests.WriteCacheType = “NEUTRAL”, $CachePVSType
885 if ($CacheDisk -lt ($PvsWriteMaxSize * 0.5)) {
886 “WriteCache file size is low” | LogMe
887 $tests.WriteCacheSize = “SUCCESS”, $CacheDiskGB
888 }
889 elseif ($CacheDisk -lt ($PvsWriteMaxSize * 0.8)) {
890 “WriteCache file size moderate” | LogMe -display -warning
891 $tests.WriteCacheSize = “WARNING”, $CacheDiskGB
892 $ErrorXA = $ErrorXA + 1
893 }
894 else {
895 “WriteCache file size is high” | LogMe -display -error
896 $tests.WriteCacheSize = “ERROR”, $CacheDiskGB
897 $ErrorXA = $ErrorXA + 1
898 }
899 }
900 $Cachedisk = 0
901 }
902 else { $tests.WriteCacheSize = “SUCCESS”, “N/A” }
903 ############## END PVS SECTION #############
904
905 # Check services
906 $services = Get-Service -Computer $machineDNS
907
908 if (($services | ? {$_.Name -eq “Spooler”}).Status -Match “Running”) {
909 “SPOOLER service running…” | LogMe
910 $tests.Spooler = “SUCCESS”,”Success”
911 }
912 else {
913 “SPOOLER service stopped” | LogMe -display -error
914 $tests.Spooler = “ERROR”,”Error”
915 $ErrorXA = $ErrorXA + 1
916 }
917
918 if (($services | ? {$_.Name -eq “cpsvc”}).Status -Match “Running”) {
919 “Citrix Print Manager service running…” | LogMe
920 $tests.CitrixPrint = “SUCCESS”,”Success”
921 }
922 else {
923 “Citrix Print Manager service stopped” | LogMe -display -error
924 $tests.CitrixPrint = “ERROR”,”Error”
925 $ErrorXA = $ErrorXA + 1
926 }
927
928 }
929 else {
930   $tests.Ping = “Error”, $result
931   $ErrorXA = $ErrorXA + 1
932 }
933 #END of Ping-Section
934
935 # Column Serverload
936 $Serverload = $XAmachine | %{ $_.LoadIndex }
937 “Serverload: $Serverload” | LogMe -display -progress
938 if ($Serverload -ge $loadIndexError) {
939   $tests.Serverload = “ERROR”, $Serverload
940   $ErrorXA = $ErrorXA + 1
941 } elseif ($Serverload -ge $loadIndexWarning) {
942   $tests.Serverload = “WARNING”, $Serverload
943   $ErrorXA = $ErrorXA + 1
944 } else {
945   $tests.Serverload = “SUCCESS”, $Serverload
946 }
947
948 # Column MaintMode
949 $MaintMode = $XAmachine | %{ $_.InMaintenanceMode }
950 “MaintenanceMode: $MaintMode” | LogMe -display -progress
951 if ($MaintMode) {
952   $tests.MaintMode = “WARNING”, “ON”
953   $ErrorXA = $ErrorXA + 1
954 } else { $tests.MaintMode = “SUCCESS”, “OFF” }
955
956 # Column RegState
957 $RegState = $XAmachine | %{ $_.RegistrationState }
958 “State: $RegState” | LogMe -display -progress
959
960 if ($RegState -ne “Registered”) {
961   $tests.RegState = “ERROR”, $RegState
962   $ErrorXA = $ErrorXA + 1
963 }
964 else { $tests.RegState = “SUCCESS”, $RegState }
965

966 # Column VDAVersion AgentVersion
967 $VDAVersion = $XAmachine | %{ $_.AgentVersion }
968 “VDAVersion: $VDAVersion” | LogMe -display -progress
969 $tests.VDAVersion = “NEUTRAL”, $VDAVersion
970

971 # Column HostedOn
972 $HostedOn = $XAmachine | %{ $_.HostingServerName }
973 “HostedOn: $HostedOn” | LogMe -display -progress
974 $tests.HostedOn = “NEUTRAL”, $HostedOn
975

976
977 # Column ActiveSessions
978 $ActiveSessions = $XAmachine | %{ $_.SessionCount }
979 “Active Sessions: $ActiveSessions” | LogMe -display -progress
980 $tests.ActiveSessions = “NEUTRAL”, $ActiveSessions
981

982 # Column ConnectedUsers
983 $ConnectedUsers = $XAmachine | %{ $_.AssociatedUserNames }
984 “Connected users: $ConnectedUsers” | LogMe -display -progress
985 $tests.ConnectedUsers = “NEUTRAL”, $ConnectedUsers
986
987 # Column DesktopGroupName
988 $DesktopGroupName = $XAmachine | %{ $_.DesktopGroupName }
989 “DesktopGroupName: $DesktopGroupName” | LogMe -display -progress
990 $tests.DesktopGroupName = “NEUTRAL”, $DesktopGroupName
991

992

993 #==============================================================================================
994 #               CHECK CPU AND MEMORY USAGE
995 #==============================================================================================
996

997         # Check the AvgCPU value for 5 seconds
998         $XAAvgCPUval = CheckCpuUsage ($machineDNS)
999   #$VDtests.LoadBalancingAlgorithm = “SUCCESS”, “LB is set to BEST EFFORT”}
1000
1001         if( [int] $XAAvgCPUval -lt 75) { “CPU usage is normal [ $XAAvgCPUval % ]” | LogMe -display; $tests.AvgCPU = “SUCCESS”, “$XAAvgCPUval %” }
1002   elseif([int] $XAAvgCPUval -lt 85) { “CPU usage is medium [ $XAAvgCPUval % ]” | LogMe -warning; $tests.AvgCPU = “WARNING”, “$XAAvgCPUval %”; $ErrorXA = $ErrorXA + 1 }
1003   elseif([int] $XAAvgCPUval -lt 95) { “CPU usage is high [ $XAAvgCPUval % ]” | LogMe -error; $tests.AvgCPU = “ERROR”, “$XAAvgCPUval %”; $ErrorXA = $ErrorXA + 1 }
1004   elseif([int] $XAAvgCPUval -eq 101) { “CPU usage test failed” | LogMe -error; $tests.AvgCPU = “ERROR”, “Err”; $ErrorXA = $ErrorXA + 1 }
1005         else { “CPU usage is Critical [ $XAAvgCPUval % ]” | LogMe -error; $tests.AvgCPU = “ERROR”, “$XAAvgCPUval %”; $ErrorXA = $ErrorXA + 1 }
1006   $XAAvgCPUval = 0
1007

1008         # Check the Physical Memory usage
1009         [int] $XAUsedMemory = CheckMemoryUsage ($machineDNS)
1010         if( [int] $XAUsedMemory -lt 75) { “Memory usage is normal [ $XAUsedMemory % ]” | LogMe -display; $tests.MemUsg = “SUCCESS”, “$XAUsedMemory %” }
1011   elseif( [int] $XAUsedMemory -lt 85) { “Memory usage is medium [ $XAUsedMemory % ]” | LogMe -warning; $tests.MemUsg = “WARNING”, “$XAUsedMemory %”; $ErrorXA = $ErrorXA + 1 }
1012   elseif( [int] $XAUsedMemory -lt 95) { “Memory usage is high [ $XAUsedMemory % ]” | LogMe -error; $tests.MemUsg = “ERROR”, “$XAUsedMemory %”; $ErrorXA = $ErrorXA + 1 }
1013   elseif( [int] $XAUsedMemory -eq 101) { “Memory usage test failed” | LogMe -error; $tests.MemUsg = “ERROR”, “Err”; $ErrorXA = $ErrorXA + 1 }
1014         else { “Memory usage is Critical [ $XAUsedMemory % ]” | LogMe -error; $tests.MemUsg = “ERROR”, “$XAUsedMemory %”; $ErrorXA = $ErrorXA + 1 }
1015   $XAUsedMemory = 0
1016

1017         # Check C Disk Usage
1018         $HardDisk = CheckHardDiskUsage -hostname $machineDNS -deviceID “C:”
1019   if ($HardDisk -ne $null) {
1020    $XAPercentageDS = $HardDisk.PercentageDS
1021    $frSpace = $HardDisk.frSpace
1022

1023    If ( [int] $XAPercentageDS -gt 15) { “Disk Free is normal [ $XAPercentageDS % ]” | LogMe -display; $tests.CFreespace = “SUCCESS”, “$frSpace GB” }
1024    ElseIf ([int] $XAPercentageDS -eq 0) { “Disk Free test failed” | LogMe -error; $tests.CFreespace = “ERROR”, “Err”; $ErrorXA = $ErrorXA + 1 }
1025    ElseIf ([int] $XAPercentageDS -lt 5) { “Disk Free is Critical [ $XAPercentageDS % ]” | LogMe -error; $tests.CFreespace = “ERROR”, “$frSpace GB”; $ErrorXA = $ErrorXA + 1 }
1026    ElseIf ([int] $XAPercentageDS -lt 15) { “Disk Free is Low [ $XAPercentageDS % ]” | LogMe -warning; $tests.CFreespace = “WARNING”, “$frSpace GB”; $ErrorXA = $ErrorXA + 1 }
1027    Else { “Disk Free is Critical [ $XAPercentageDS % ]” | LogMe -error; $tests.CFreespace = “ERROR”, “$frSpace GB”; $ErrorXA = $ErrorXA + 1 }
1028
1029    $XAPercentageDS = 0
1030    $frSpace = 0
1031    $HardDisk = $null
1032   }
1033
1034   $tests.DFreespace = “NEUTRAL”, “N/A”
1035   if ( $XAServerHaveD -eq “1” ) {
1036    # Check D Disk Usage
1037          $HardDiskd = CheckHardDiskUsage -hostname $machineDNS -deviceID “D:”
1038    if ($HardDiskd -ne $null) {
1039     $XAPercentageDSd = $HardDiskd.PercentageDS
1040     $frSpaced = $HardDiskd.frSpace
1041

1042     If ( [int] $XAPercentageDSd -gt 15) { “Disk Free is normal [ $XAPercentageDSd % ]” | LogMe -display; $tests.CFreespace = “SUCCESS”, “$frSpaced GB” }
1043     ElseIf ([int] $XAPercentageDSd -eq 0) { “Disk Free test failed” | LogMe -error; $tests.CFreespace = “ERROR”, “Err”; $ErrorXA = $ErrorXA + 1 }
1044     ElseIf ([int] $XAPercentageDSd -lt 5) { “Disk Free is Critical [ $XAPercentageDSd % ]” | LogMe -error; $tests.CFreespace = “ERROR”, “$frSpaced GB”; $ErrorXA = $ErrorXA + 1 }
1045     ElseIf ([int] $XAPercentageDSd -lt 15) { “Disk Free is Low [ $XAPercentageDSd % ]” | LogMe -warning; $tests.CFreespace = “WARNING”, “$frSpaced GB”; $ErrorXA = $ErrorXA + 1 }
1046     Else { “Disk Free is Critical [ $XAPercentageDSd % ]” | LogMe -error; $tests.CFreespace = “ERROR”, “$frSpaced GB”; $ErrorXA = $ErrorXA + 1 }
1047
1048     $XAPercentageDSd = 0
1049     $frSpaced = 0
1050     $HardDiskd = $null
1051    }
1052   }
1053

1054

1055

1056

1057
1058 ” — ” | LogMe -display -progress
1059
1060   # Check to see if the server is in an excluded folder path
1061   if ($ExcludedCatalogs -contains $CatalogName) {
1062     “$machineDNS in excluded folder – skipping” | LogMe -display -progress
1063   } else {
1064    # Check if error exists on this vdi
1065    if ($ShowOnlyErrorXA -eq 0 ) {
1066     $allXenAppResults.$machineDNS = $tests
1067    } else {
1068     if ($ErrorXA -gt 0) {
1069      $allXenAppResults.$machineDNS = $tests
1070     } else {
1071      “$machineDNS is ok, no output into HTML-File” | LogMe -display -progress
1072     }
1073    }
1074   }
1075 }
1076
1077 }
1078 else { “XenApp Check skipped because ShowXenAppTable = 0 or Farm is < V7.x ” | LogMe -display -progress }
1079
1080 “####################### Check END ####################################################################################” | LogMe -display -progress
1081

1082 # ======= Write all results to an html file =================================================
1083 # Add Version of XenDesktop to EnvironmentName
1084 $XDmajor, $XDminor = $controllerversion.Split(“.”)[0..1]
1085 $XDVersion = “$XDmajor.$XDminor”
1086 $EnvironmentName = “$EnvironmentName $XDVersion”
1087 $emailSubject = (“$EnvironmentName Farm Report – ” + $ReportDate)
1088

1089 Write-Host (“Saving results to html report: ” + $resultsHTM)
1090 writeHtmlHeader “$EnvironmentName Farm Report” $resultsHTM
1091
1092 # Write Table with the Controllers
1093 writeTableHeader $resultsHTM $XDControllerFirstheaderName $XDControllerHeaderNames $XDControllerHeaderWidths $XDControllerTableWidth
1094 $ControllerResults | sort-object -property XDControllerFirstheaderName | %{ writeData $ControllerResults $resultsHTM $XDControllerHeaderNames }
1095 writeTableFooter $resultsHTM
1096
1097 # Write Table with the Catalogs
1098 writeTableHeader $resultsHTM $CatalogHeaderName $CatalogHeaderNames $CatalogWidths $CatalogTablewidth
1099 $CatalogResults | %{ writeData $CatalogResults $resultsHTM $CatalogHeaderNames}
1100 writeTableFooter $resultsHTM
1101
1102
1103 # Write Table with the Assignments (Delivery Groups)
1104 writeTableHeader $resultsHTM $AssigmentFirstheaderName $vAssigmentHeaderNames $vAssigmentHeaderWidths $Assigmenttablewidth
1105 $AssigmentsResults | sort-object -property ReplState | %{ writeData $AssigmentsResults $resultsHTM $vAssigmentHeaderNames }
1106 writeTableFooter $resultsHTM
1107

1108 # Write Table with all XenApp Servers
1109 if ($ShowXenAppTable -eq 1 ) {
1110 writeTableHeader $resultsHTM $XenAppFirstheaderName $XenAppHeaderNames $XenAppHeaderWidths $XenApptablewidth
1111 $allXenAppResults | sort-object -property collectionName | %{ writeData $allXenAppResults $resultsHTM $XenAppHeaderNames }
1112 writeTableFooter $resultsHTM
1113 }
1114 else { “No XenApp output in HTML ” | LogMe -display -progress }
1115

1116 # Write Table with all Desktops
1117 if ($ShowDesktopTable -eq 1 ) {
1118 writeTableHeader $resultsHTM $VDIFirstheaderName $VDIHeaderNames $VDIHeaderWidths $VDItablewidth
1119 $allResults | sort-object -property collectionName | %{ writeData $allResults $resultsHTM $VDIHeaderNames }
1120 writeTableFooter $resultsHTM
1121 }
1122 else { “No XenDesktop output in HTML ” | LogMe -display -progress }
1123
1124
1125 writeHtmlFooter $resultsHTM
1126

1127 #send email
1128 $emailMessage = New-Object System.Net.Mail.MailMessage
1129 $emailMessage.From = $emailFrom
1130 $emailMessage.To.Add( $emailTo )
1131 $emailMessage.Subject = $emailSubject
1132 $emailMessage.IsBodyHtml = $true
1133 $emailMessage.Body = (gc $resultsHTM) | Out-String
1134 $emailMessage.Attachments.Add($resultsHTM)
1135 $emailMessage.Priority = ($emailPrio)
1136

1137 $smtpClient = New-Object System.Net.Mail.SmtpClient( $smtpServer , $smtpServerPort )
1138 $smtpClient.EnableSsl = $smtpEnableSSL
1139

1140 # If you added username an password, add this to smtpClient
1141 If ((![string]::IsNullOrEmpty($smtpUser)) -and (![string]::IsNullOrEmpty($smtpPW))){
1142  $pass = $smtpPW | ConvertTo-SecureString -key $smtpKey
1143  $cred = New-Object System.Management.Automation.PsCredential($smtpUser,$pass)
1144

1145  $Ptr = [System.Runtime.InteropServices.Marshal]::SecureStringToCoTaskMemUnicode($cred.Password)
1146  $smtpUserName = $cred.Username
1147  $smtpPassword = [System.Runtime.InteropServices.Marshal]::PtrToStringUni($Ptr)
1148

1149  $smtpClient.Credentials = New-Object System.Net.NetworkCredential( $smtpUserName , $smtpPassword );
1150 }
1151

1152 $smtpClient.Send( $emailMessage )
1153

1154

1155 #=========== History ===========================================================================
1156 # Version 0.6
1157 # Edited on December 15th 2014 by Sebastiaan Brozius (NORISK IT Groep)
1158 # – Added MaintenanceMode-column for XenApp-servers, Fixed some typos, Cleaned up layout
1159 #
1160 # Version 0.7
1161 # Edited on December 15th 2014 by Sebastiaan Brozius (NORISK IT Groep)
1162 # – Added ServerLoad-column for XenApp-servers
1163 # – Added loadIndexError and loadIndexWarning-variables which are used as thresholds for the ServerLoad-column
1164 # – Removed line $machines = Get-BrokerMachine | Where-Object {$_.SessionSupport -eq “SingleSession”} from the XenApp-section (because this is for VDI)
1165 # – Removed Column-positions from comments
1166 #
1167 # Version 0.8
1168 # Edited on January 17th 2015 by Sacha Thomet
1169 # – Added MaintenanceMode-column for Assignments (DeliveryGroups), added MaintenanceMode-column for VDIs
1170 #
1171 # Version 0.9
1172 # Edited on May 5th 2015 by Sacha Thomet
1173 # – Changed some wording terms into account of XenDesktop/XenApp 7.x
1174 # (Assignment to DeliveryGroup, AssignedCount to AssignedToUser, UsedCount to AssignedToDG,
1175 # UnassignedCount to NotToUserAssigned)
1176 # – Added some columns the MachineCatalog (ProvisioningType, AllocationType)
1177 # – Added some columns the DeliveryGroups (PublishedName, DesktopKind)
1178 #
1179 # Version 0.92
1180 # Edited on July 2015 by Sacha Thomet
1181 # – Adjusted some typo
1182 # – Delivery-Group-Section: XenDesktop show Total Desktops assigned to this group (FeatureRequest Luis G)
1183 # – Delivery-Group-Section: XenDesktop Filter out shared Desktops on count for free Desktops (FeatureRequest James)
1184 #
1185 # Version 0.93
1186 # Edited on August 2015 by Stefan Beckmann (Unico Data AG)
1187 # – Added loadIndexError and loadIndexWarning as variable in the config section
1188 # – Specifying the PowerShell SnapIn which must be loaded
1189 # – You can now specify the delivery controller. This makes it possible to execute the script on a system which is not Delivery Controller or VDA.
1190 # – Added the connected users in the table
1191 # – Remove the old report bevor main script starts
1192 # – Log Citrix PS Snapins
1193 # – Run Citrix Cmdlet with AdminAdress to run this script remote
1194 # – If you run script remote, now returned correctly the version of XenDesktop. In the first Get-BrokerController command I added the parameter DNSName.
1195 # – New Way to send mail, which also allows passwords
1196 # – To send a mail without user and password I could not test
1197 #
1198 # # Version 0.94
1199 # Edited on October 2015 by Sacha Thomet
1200 # – Removed PVS WriteCache column – if you need that check this on PVS Health Check. XenApp/XenDesktop is maybe provisioned without PVS.
1201 # – Add possibility to set a Mail-Priority
1202 #
1203 # # Version 0.95
1204 # Edited on May 2016 by Sacha Thomet
1205 # – Check CPU, Memory and C: of Controllers
1206 # – XenApp: Add values: CPU & Memory and Disk Usage
1207 # – XenApp: Option to toggle on/off to show Connected Users
1208 # – XenApp: DesktopFree set to N/A because not relevant
1209 #
1210 # ToDo in a further version (Correction & Feature Requests)
1211 # – XenApp:  Add more relevant values: Number of active users per server / Logon Enabled / SessionSupport
1212 # – XenDesktop: show Connected User
1213 # – XenApp: Get-BrokerSession per Machine for unique Sessions (?)(Feature Request Majeed Attar) => need better specification of the need.
1214 #
1215 # # Version 0.96
1216 # Edited on May 2016 by Sacha Thomet
1217 #  Added D: for Controller and XenApp Server
1218 #
1219 # # Version 0.99
1220 # Edited on September 2016 by Sacha Thomet
1221 # – Show PowerState and do some checks not on powered off maschone (Ping, RegistrationState)
1222 # – Show VDA Version of XA or XD
1223 # – Show Host
1224 #
1225 # # Version 0.992
1226 # Edited on September 2016 by Stefan Beckmann
1227 # – Variable $EnvironmentName adjusted without version, and joined in the script later
1228 # – Variable $PvsWriteCache and $PvsWriteMaxSize re-added, since it is still used in the script
1229 # – Created timestamp report as variable $ReportDate
1230 # – $EnvironmentName and $emailSubject redefined in the report generation, incl. XenDesktop version with the new variable $XDmajor, $XDminor and $XDVersion
1231 #
1232 # # Version 0.995
1233 # Edited on September 2016 by Stefan Beckmann
1234 # – Configuration via an XML file
1235 # – Redefined display the date for the report
1236 # – Replaced generate the date in the second place by variable
1237 #
1238 # # Version 0.996 – 1.00
1239 # Edited on September 2016 by Sacha Thomet
1240 # – minor bug fixes
1241 #
1242 # # Version 1.0.1
1243 # Edited on September 2016 by Tyron Scholem
1244 # – localization correction for systems with decimal separator of “,”
1245 #
1246 # # Version 1.1.0
1247 # Edited on September 2016 by Tyron Scholem
1248 # – added uptime information for Delivery Controllers
1249 #
1250 #=========== History END ===========================================================================

 

 

 

Xendesktop appears to create extra disks

1. Checked for pending updates in the VM from Studio.

2. Checked for active prov tasks by running the command: Get-ProvTask -Active $true.

3. Ran the command: Get-ProvVM “name_of_catalog” |select BootedImage, IdentityDiskid to fetch the UUID of the base disk that

is currently in use by the catalog.

4. Now ran the following command on the XenServer pool master to enumerate the UUID of the base disks with the same xxx: xe

vdi-list name-label-“xxx” | grep uuid

5. Except the base disk which has the same UUID in the above two commands, deleted the other base disks by using the

command: xe vdi-destroy uuid=xxxxx

6. Verified the same in the Storage using GUI whether the disks were deleted.

 

Xenserver force shutdown vms

  1. xe vm-shutdown uuid=1f4e9596-d3e8-f91e-68a2-9bb105b50b31 force=true
  2. xe vm-reset-powerstate uuid=11b846ae-b982-e6b4-7431-f671c81e2cdf force=true
  3. list_domains
  4. /opt/xensource/debug/xenops destroy_domain –domid 35

NVIDIA Card  installation steps.

use WinSCP for copying rmp file to temp folder in xenserver

  • CAT /ETC/XENSOURCE/POOL.CONF
  • nvidia-smi -a | more
  • cd /
  • rpm -qa | grep -i NVidi
  • rpm -iv NVIDIA-vGPU-kepler-xenserver-6.5-361.40.x86_64.rpm
  • nvidia-smi