1

powershell version 2.2 . what im trying to do is login to remote server with psexec then stop spooler service and then disable spooler from automatic startup after reboots. Here is what i want to execute

c:\remotetool>Psexec.exe \\10.10.10.10 -u demouser1 -p "secretpassword" -h net stop spooler && sc config "spooler" start= disabled

The error i get is

&& is not valid statement separator in this version

When i execute psexec individually like below it works but i want to execute them on single connection

c:\remotetool>Psexec.exe \\10.10.10.10 -u demouser1  -p "secretpassword" -h  net stop spooler

c:\remotetool>Psexec.exe \\10.10.10.10 -u demouser1  -p "secretpassword" -h  sc config "spooler" start= disabled
0

1 Answer 1

1

can you try cmd /c Psexec.exe \\10.10.10.10 -u demouser1 -p "secretpassword" -h net stop spooler `&`& sc config "spooler" start= disabled

Sign up to request clarification or add additional context in comments.

2 Comments

is that backtick alongside & ?
@satch_boogie yes

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.