Sign in to follow this  
Followers 0
snooz

Need help with script

3 posts in this topic

I am looking to come up with a script that prompts for a machine name and then stops and starts the spooler service. I cannot get the RunWait syntax down. Everything works except the sc command-line. Here is what I have so far;

Do

$machine = InputBox("Spooler Restart", "\\SERVERNAME", "\\???-SRV-01", "", _

0, 1, -1, -1)

If @error == 1 Then Exit

Until $machine <> " "

RunWait(@ComSpec & " /c sc $machine stop spooler","",@sw_hide)

if RunWait(@ComSpec & " /c sc $machine start spooler","",@sw_hide) == 0 Then

MsgBox(0, $machine,"Spooler Service Restarted")

Else

MsgBox(0, $machine,"Cannot Restart Spooler Service")

EndIf

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

RunWait(@ComSpec & " /c sc " & $machine & " stop spooler","",@sw_hide)

here's the second one

RunWait(@ComSpec & " /c sc " & $machine & " start spooler","",@sw_hide)

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

RunWait(@ComSpec & " /c sc " & $machine & " stop spooler","",@sw_hide)

here's the second one

RunWait(@ComSpec & " /c sc " & $machine & " start spooler","",@sw_hide)

<{POST_SNAPBACK}>

Thanks worked like a charm!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0