Jump to content

autoit equivalent for net start and stop


 Share

Recommended Posts

I have done some searching through the forums and I am not sure if there are any internal commands in autoit for it, but I have to ask.

Are there any internal commands that will do a net start or net stop like you can in a bat file?

RUN . . . Slide . . . TAG . . . Your out . . . PAINTBALL !!!

Link to comment
Share on other sites

Best way is to use WMI.

Here's an example:

$objWMI = ObjGet("winmgmts:\\localhost\root\cimv2")
$srvcName = "Spooler"
$services = $objWMI.ExecQuery ("Select * from Win32_Service Where Name ='" & $srvcName & "'")

For $srvc in $services
    $srvc.StartService()
Next

And here's the Microsoft Doco that tells you how to use WMI: Win32_Service Class

Enjoy.

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...