Try using single quotes instead of double quotesBlog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz1 person found this helpful
So I changed it to
$rootpswd = Read-Host -Prompt 'Old root password'
And that did not work either.
As a tempory fix for the script, I just hard coded the password like this and it worked.
$rootpswd = '!QAZxsw2'
But I don't want to hard code the password. I want to prompt the user for the password.
Or while authenticating : $a=get-credential, it should work.
I should have been more specific, I didn't mean single quotes around the Read-Host prompt.
When you use an exclamation mark as the 1st character in a string you pass to the Read-Host cmdlet, youwill have to put the exclamation mark twice. Otherwise you stumble upon this feature.Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
Awesome! Thanks LucD