Reputation: 3274
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
Upvotes: 1
Views: 152
Reputation: 4059
can you try
cmd /c Psexec.exe \\10.10.10.10 -u demouser1 -p "secretpassword" -h net stop spooler `&`& sc config "spooler" start= disabled
Upvotes: 1