What is the best way to determine if a variable is empty or populated with data?
hi,
i execute following intent determine if get-aduser found samaccountname in directory.
is better check data using method below or there safer, more accurate way test existence of data , cmdlet successful?
$aduser = "" $aduser = get-aduser -filter 'samaccountname -eq "jflary"' if($aduser) { write-host "string not empty" } else { write-host "string empty or null" }
thanks help! sdedot
Windows Server > Windows PowerShell
Comments
Post a Comment