If your working a lot with parameters and inputs you need to check if variables have the right value and are not “null”.
The normal if -eq “$null” doesn’t work:
if ($varibalename -eq $null) { Write-Host "variable is null" }
Now how you can check that (check if $variablename has $null as value):
if (!$variablename) { Write-Host "variable is null" }
And here if you wanna check if $variablename has any value except $null:
if ($variablename) { Write-Host "variable is NOT null" }
