-
Notifications
You must be signed in to change notification settings - Fork 2.6k
PowerShell on Target Machine: Special Characters in password #3025
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Which task are you using? |
@goofy78270 |
What task? |
@goofy78270 Which version were you facing this issue with? Or is it some other task? |
1.0.31 is the version we are currently using |
@goofy78270 Nothing changed in the task between these versions related to this. Please provide me below details for reproducing the issue
Please try creating a remote PS Session from your agent box to target box just to confirm the setup is good, and task is failing to create remote session. You can use below script
|
Using the following appears to work in the test listed above. note that I changed the double quotes to a single quote and escaped the single quote within the password |
Sorry, issue not closed |
@goofy78270 Meanwhile please try again with below script:
|
By manually entering credentials during the test run, it works without issue, similar to changing the double quotes to a single quote and escaping the single quote as mentioned above. I am unsure if it matters, but the password does not appear to be posting correctly. The are supposed to be 2 \ in the password not just one - %D0`H\\vW'RUc?buZ5 as for the ` escape character, that is only for double quoted strings, which the script appears to be using. For a single quoted string - Single-Quoted Strings (')
There are also other situations that need to be escaped when using double quoted strings. Here is a page I found that explains the escaping for single versus double quoted strings - http://www.rlmueller.net/PowerShellEscape.htm |
Here is some further information: |
@goofy78270 |
I am out of office for 2 weeks. adding @chshrikh and @rajatagrawal-dev @chshrikh
|
@goofy78270 please let us know if you are still blocked on this |
I am unsure where the issue lies, but we have moved forward by simply removing special characters from our passwords. Everything seems to work great now. If there is a need for us to look into this again, I will reopen this case. Thanks for all your help and sorry for running in circles. |
Hi Team, I am working on a PS script to install VSTS agents on my Azure VMs through an Azure DevOps Release Pipeline. Here in the below script, I am passing a Service Account Password, which is set by my customers. Below script fails whenever Password consist of special characters like
Code:
I have tried putting whole password into double quotes as well as single quotes but of no help. This Service Account Password is a Pipeline variable and hence needs to be passed like $(Service_Account_Password). Can you please suggest on how can I deal with this situation. I have already tried putting this as a here-string, Secure-String, or script parameter but has not proved of any help. Hoping to hear back soon as this is urgent for my project release. |
Feel its my luck day today. After banging my head for past 8 hours on this I could finally work this through using Stop-Script character in PowerShell '--%' Solution I tried: Ref: https://stackoverflow.com/questions/18923315/using-in-powershell Hope this might helps others. |
Thanks @praharshp it was about 4 hours into it when I found your post. For me it worked with a combination of what you posted and the stackoverflow link you provided here is my solution (it just a powershell script in a local machine): First I assigned the password to an environment variable & ".\config.cmd" --unattended --url "http://MyServer/Tfs" --auth "Integrated" --pool $PoolName --agent $agentName --runAsAutoLogon --windowsLogonAccount $user --windowsLogonPassword --% "%password%" I hope this helps others as well. |
I am running into an issue where my admin password contain special characters. As a result, when executing the script, the authentication fails.
password - %D0`H\vW'RUc?buZ5
While I could, and probably will, in the short term, update the password to remove special characters, I wanted to bring this issue to your attention. With password policies becoming more robust, it is only a matter of time, if not already, before this becomes an issue for others.
Error log excerpt:
2016-11-03T15:38:46.6387093Z Deployment status for machine 'ServerRemoved:5985' : 'Failed'
2016-11-03T15:38:46.6543337Z ##[debug]System.Exception: AuthorizationManager check failed.
2016-11-03T15:38:46.6699590Z ##[error]AuthorizationManager check failed.
The text was updated successfully, but these errors were encountered: