Is there a built-in IsNullOrEmpty-like function in order to check if a string is null or empty, in PowerShell?
IsNullOrEmpty
I could not find it so far and if there i
If it is a parameter in a function, you can validate it with ValidateNotNullOrEmpty as you can see in this example:
ValidateNotNullOrEmpty
Function Test-Something { Param( [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string]$UserName ) #stuff todo }