Thank you! This worked. I will click the recommend button on the thread.
Original Message:
Sent: May 09, 2025 09:53 AM
From: p0werShelldude
Subject: Testing Syslog.global.auditRecord.storageEnable variable
Because $test.Value is of type Boolean, you will need to test for $true / 1 or $false / 0. You can always check this using the GetType() method; $test.Value.GetType()
if($test.Value -eq $false) or if($test.Value -eq 0)
if($test.Value -eq $true) or if($test.Value -eq 1)
Original Message:
Sent: May 09, 2025 09:46 AM
From: jeffj2000
Subject: Testing Syslog.global.auditRecord.storageEnable variable
This is driving me crazy. I am not a PowerShell expert, so maybe this variable is a format i don't think it is. Can someone tell me why this value is not testing properly:
Get-VMHost -Name $FQDN| Get-AdvancedSetting -Name Syslog.global.auditRecord.storageEnable
Name Value Type Description
---- ----- ---- -----------
Syslog.global.aud... False VMHost
$test= Get-VMHost -Name $FQDN| Get-AdvancedSetting -Name Syslog.global.auditRecord.storageEnable
$test.Value
False
if($test.Value -eq "False") {write-host "asdf"}
The above does not test "true"
What am i missing on that value type?
Thank you!