Powershell check for empty string?? - TechRepublic
Question
July 23, 2010 at 06:26 PM
awellman

Powershell check for empty string??

by awellman . Updated 15 years, 10 months ago

I am having a problem with a powershell script. THis is a snippet of the code and the error that is generate when it is run.

if (($AddlUserDirectoryPath1 -ne $Null) -and ($AddlUserDirectoryPath1 -ne “”))
{
if (!(Test-Path -path $AddlUserDirectoryPath1))

cannot bind argument to parameter ‘Path’ because it is an empty string.

I am not sure on how to make sure that the string is not empty before testing the path.

Any suggestions will be appreciated.
Thanks,
Art

This discussion is locked

All Comments