alanrenouf / vCheck-vSphere

vCheck Daily Report for vSphere
MIT License
732 stars 326 forks source link

30 Host/20 ESXi with Technical Support mode enabled.ps1 bug fix and clean-up #713

Closed spartyzik closed 3 years ago

spartyzik commented 4 years ago

30 Host/20 ESXi with Technical Support mode enabled.ps1

TechSuportModeEnabled is boolean and must be compared to a boolean rather than a string. All non-empty strings evaluate to $true; including "True" and "False".

Corrected spelling to TechSupportModeEnabled.

Combined the first two Where-Objects of the second collection the same way it is done in the first.

Combined the ConnectionState tests with -in rather than -and.

Added line breaks for readability.

$VMH | Where-Object { ($_.Version -lt 4.1) -and 
                      ($_.ConnectionState -in @("Connected","Maintenance")) -and 
                      ($_.ExtensionData.Summary.Config.Product.Name -match "i")} | 
       Select-Object Name, @{N="TechSupportModeEnabled";E={($_ | Get-AdvancedSetting -Name VMkernel.Boot.techSupportMode).value}} | 
       Where-Object { $_.TechSupportModeEnabled -eq $true }

$VMH | Where-Object { ($_.Version -ge "4.1.0") -and 
                      ($_.ConnectionState -in @("Connected","Maintenance"))} | 
       Select-Object Name, @{N="TechSupportModeEnabled";E={($_ | Get-VMHostService | Where-Object {$_.key -eq "TSM"}).Running}} | 
       Where-Object { $_.TechSupportModeEnabled -eq $true }
Sneddo commented 3 years ago

Any chance you could submit this as a pull request to the dev branch?

If not I can manually update next week sometime.

Sneddo commented 3 years ago

PR merged to dev brach. Thanks!