[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 450
  • Last Modified:

the goal is to restart print spooler from command line from a diffrent computer.

my print server needs to be restarted at times when admin is gone i woul like to have some one to run a scriptfile at  there workstation to restart this.???????

0
ryanpartridge
Asked:
ryanpartridge
  • 6
  • 4
  • 2
  • +1
1 Solution
 
bilbusCommented:
The whole server?
or just the print service?
use the windows "Scheduled Tasks" program ... set a time for the program to stop the service, and add the batch file

(for whole computer)
creat a bat file that says
.......................................

shutdown -r -t 1

.................................................

(done)

(for just print spooler)
.........................................
net stop "print spooler"
net start "print spooler"
............................................
(done)
0
 
ryanpartridgeAuthor Commented:
just the service.

I need the you to restat server from there work station. network enviorment
0
 
JBlondCommented:
With 'PsExec' from the PsTools-Suite this should be possible...

http://www.sysinternals.com/ntw2k/freeware/pstools.shtml

Hope that helps...
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
ajsaastaCommented:
on the workstation, use command "sc" (Service Control):

C:\>sc \\Server01 stop spooler

and then

C:\>sc \\Server01 start spooler
0
 
ryanpartridgeAuthor Commented:
can I do this from a machine that does not have admin rights
if so why
0
 
ajsaastaCommented:
you need admin rights on the target (remote) computer where the spooler is being stopped/started
0
 
ajsaastaCommented:
or to be more precise, you'll need to be member of "print operators" group (to which Administrator(s) automaticly belog to.)
0
 
JBlondCommented:
Another possibility without giving the user more permissions:

Run the command via a compiled AutoIt-Script (http://www.autoitscript.com/autoit3/).
Just run the command with user/password via this script, right-click the script and choose 'compile script'. You'll get a exe-file which can be run from every machine.  

0
 
ajsaastaCommented:
but isn't every program, script or whatever run within the context of starters security privileges???

You cannot run that .exe and it will not do what supposed to if you dont have sufficient rights to do the task.

In fewer words: if you dont have the rights to run "net stop spooler" you also dont have the rights to do it with "whatever-o-script".
0
 
JBlondCommented:
You're right and you're not :)

The key is to run the command within the script with the needed permissions. I don't know if this is possible with the sc-command ('runas sc...' should work), but with the psservice-command from the PS-Tools-Suite (http://www.sysinternals.com/ntw2k/freeware/pstools.shtml) is will work.

The psservice-command can be run with a user- and password-parameter and it's easy to deploy it over the network to the machines, because you only have to copy the files without installation. It's also possible to run the command from a central location via network.

It doesn't matter if this script is executed from a user without sufficent rights as long as the command within the script will be run under another user context which has these rights.
0
 
ajsaastaCommented:
yeah, well... like I said: "every program, script or whatever is run within the context of starters security privileges"

If you start a program with "runas" command then you run the command within the security context of the given user.

Still, my advice to the original question is:

* use "sc" command to control the spooler service
* run the "sc" command whitin such security context that has privileges to do the task
* in this specific case, the user needs to belong to "print operators" security group
0
 
JBlondCommented:
Nice discussion. :)

I don't think the user has to be a member of the 'print operators' group in this specific case because if the command within the script will be run with different user rights(who has enough rights to control the service), these rights count and not the right of the user who started the script.

The advantage is that you don't have to give the user itself these rights permanently. As the script is compiled, the user cannot see the username and password of the user with more rights. Further he cannot break out of the script with more rights because the script terminates itself after execution.

0
 
ajsaastaCommented:
well on this "not related to the original question" -topic ;-) my opinion is that W2K3 has enough tools and options and methods to implement correct security schema for users, power users and administrators so there is no need for script-o-matics.

Cheers!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 6
  • 4
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now