EvotecIT / Testimo

Testimo is a PowerShell module for running health checks for Active Directory against a bunch of different tests
MIT License
519 stars 55 forks source link

Fix PowerShell 2.0 detection #161

Closed Sparticuz closed 2 years ago

Sparticuz commented 2 years ago

Trying to compare to a property that isn't returned.

PrzemyslawKlys commented 2 years ago

Sometimes I wonder what I have in my mind when I do commits like this. Thank you

Sparticuz commented 2 years ago

....it's ok... i literally crashed my PDC trying to fix this....then i looked at the code, lol. At least i know my recovery steps work. image

Sparticuz commented 2 years ago

@PrzemyslawKlys Still having problems with this one, but don't know how to fix it.

PS C:\Users\Administrator> Get-WindowsOptionalFeature -Online -FeatureName MicrosoftWindowsPowerShellV2 | Select-Object -Property DisplayName, Description, RestartRequired, FeatureName, State

DisplayName     : Windows PowerShell 2.0 Engine
Description     : Adds or Removes Windows PowerShell 2.0 Engine
RestartRequired : Possible
FeatureName     : MicrosoftWindowsPowerShellV2
State           : Disabled

image

(Still needed this PR though because before it was returning null)

PrzemyslawKlys commented 2 years ago

Ye, it's because State is actually Enum.

image

So within Testimo

image

I need to see whether to fix test or fix internals to support this properly.