Jump to content

Need help with script


 Share

Recommended Posts

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

Link to comment
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)

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.

 

Link to comment
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!
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...