WinRb / winrm-elevated

Runs PowerShell commands as elevated over Windows Remote Management (WinRM) via a scheduled task
Apache License 2.0
27 stars 17 forks source link

winrm throwing logon exception if password has $ #16

Closed Vinoth-Chef closed 7 years ago

Vinoth-Chef commented 8 years ago

when we use below remote execution, it throws error if password has $ symbol in it.

knife winrm --winrm-shell elevated NODE_NAME "chef-client -c c:/chef/client.rb" -m -x "user" -P "password"

solution:

if we use

$password = "<%= password %>" instead of $password = '<%= password %>' in line 2 in below script it will be fixed.

https://github.com/WinRb/winrm-elevated/blob/master/lib/winrm-elevated/scripts/elevated_shell.ps1

Please include this fix in next release it will help someone.

Thanks, Vinoth

mwrock commented 8 years ago

I'm assuming you mean $password = '<%= password %>' instead of $password = "<%= password %>" correct? Would you like to submit a PR with this change and I'll gladly merge.