Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources: Active Threads
Viewing all articles
Browse latest Browse all 8411

Illegal characters in powershell parameter

$
0
0

Hello -

I am a powershell novice, and I am seeking advice on how to prevent powershell from interpretting characters which I intend to be used inside of a variable.  My apologies if this answer exists elsewhere on the forum - it is difficult to search any database or forum using symbols in the search argument. 

This particular command requires authentication.  The vendor does allow use of an encrypted password in the command.  However, the format of the encrypted password uses double less-than and double greater-than signs as delimiters.  It appears that powershell is trying to interpret these instead of keeping them inside the variable.  Here is the script I am attempting to run in a powershell window (I have removed all but the basic command for simplification, the error is the same with/without):

C:\fipercmd.bat nogui:true profile:any_machine user:any_user "pw:$decode$>>2<<Qstn7EWQROHn/65tA=" logonprompt:no sstatus

This command works fine at a DOS prompt.  No matter what sequence of single quotes, double quotes, back-tick (`), etc. I have tried, powershell returns the following:

<< was unexpected at this time.

This is complicated by the fact that placing escape characters around the problematic symbols may invalidate the encrypted password, but I never get that far to find out.

Any help is appreciated !


Viewing all articles
Browse latest Browse all 8411

Latest Images

Trending Articles



Latest Images