1

We use windows OS but instead of using built in native ways to connect to remote machines, they installed tectia ssh.

So if I want to run commands on a remote machine I have to open cmd and do

sshg3 server02

I ssh into a computer. Once the session is connected I can natively put commands into the cmd and it'll execute on that machine I'm connected to.

Well one problem. I want to make it scripted. For simple commands all I have to do is

sshg3 server05 "net user acc /active:yes"

But one of the commands I frequently run is

reg add "hklm\software\microsoft\windows nt\currentversion\winlogon" /v AutoAdminLogon /d 1 /f

When I try to do sshg3 server02 "reg add "hklm\software\microsoft\windows nt\currentversion\winlogon" /v AutoAdminLogon /d 1 /f " it always returns "Invalid syntax see reg add /? for more info"

Because its not escaping the quotes so it thinks reg add is the only quoted thing.

I tried using backtick and I tried using ^ to escape the quotes. Cant figure out how to escape back ticks on here because it keeps showing 2 instead of one, so im using (backtick) instead

sshg3 server02 "reg add ^"hklm\software\microsoft\windows nt\currentversion\winlogon^" /v AutoAdminLogon /d 1 /f"

sshg3 server02 "reg add (backtick)"hklm\software\microsoft\windows nt\currentversion\winlogon(backtick)" /v AutoAdminLogon /d 1 /f"

Both commands return the same invalid syntax

0

Found the solution.

Have to use double quotes around the reg key add part.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy