Check if Powershell variables

Check if variable has the right value and are not “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” }

epic
Author Details
Contributer and Author Enterprise Communications Engineer Hi Epic

testest test 

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments