Subscribe

Can a "$" be used in a string

I have a password that I am trying to use in a command that includes a "$" in it.  When I hard code the password into the parameter section of the command, it is automatically creating a user defined variable out of everything after the $.  For instance, "Pas$w0rd" would create a user defined variable called "w0rd".  This is happening even if the password is in quotes and the parameter is defined as a string.  Is the "$" character an illegal character in strings?  Or, am I missing an escape character to indicate that I don't want this to be a user defined variable?

Below are screen shots of what is exactly happening.

In the command, I am setting the password as seen below:

In the setup details of the workflow, you can see the User Inputs has a variable named "w0rd"

When you run/preview the workflow, you can see that there is a User Input created called "w0rd"

Re: Can a "$" be used in a string

Hi Matt,

You could put the password into a function, which would hide it from the workflow parameter parsing. Or, you could break up the string, like 'Pas$' + 'w0rd', which also works.

Regards,

Tim

Re: Can a "$" be used in a string

There is another option I would suggest i.e. to save the username/password as a dummy-host in Credentials and then call Get-WfaCredentials to obtain it in your command. This way your problem of $ in the userinput will be solved and it also serves the purpose of hiding the entered password in workflow executions.

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.