I'm extremely new to powershell scripting and I'm having a hell of a time trying to capture whether something simply failed or succeeded. I have a simple example:
test1.ps1
get-psdrive -name ds | out-null
if($? -ne "False")
{
echo "drive doesn't exist"
}
else { echo "Found drive" }
This however isn't working for me. I also tried the variable $LastExitCode but that doesn't work either. I'm seriously misunderstanding something here. Can someone please point me in the right direction or show me a working example