Running quotes and singles quotes...Batch

Hi Folks,

I'm creating a batch script here to allow RDP on Windows
powershell "Set-ItemProperty ‘HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\‘ -Name “fDenyTSConnections” -Value 0"

Open in new window


If I run this script will get me an error :
set-itemproperty: a positional parameter cannot be found that accepts argument

But if I was to copy paste the line above to the DOS console they it would work like a charmed.

Have anybody experienced similar or same issue?
LVL 4
ivan rosaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

oBdACommented:
Look closely at the code block you posted, probably using Copy and Paste.
The quotes around the registry path and fDenyTSConnections aren't the required ASCII 34 (double quote ") or ASCII 39 (single quote '), but the typographical curly/"purdy" ones. When you paste them into a console, they'll be converted to the respective ASCII characters, but not when saved as a script like that.
Try this:
powershell.exe -Command "Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server' -Name 'fDenyTSConnections' -Value 0"

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ivan rosaAuthor Commented:
You nailed it again bud!
I can't believe i felt for something like that ...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.