Jump to content
Sign in to follow this  

Easy One This - Gui To Use Psservice To Remotely Stop Services.

Recommended Posts


Hello out there.

I am terribly useless at AutoIT but love the capabilities. I want to use a gui to remotely stop a service on a pc using psservice.exe from the pstools suite. I have done the easy bit and created the gui which just has ip username and pw and the stop and start buttons but i am struggling to work out how AutoIT polls the info and plonks it in to the psservice command.

heres the code for the gui - all suggestions and help will be greatly appreciated :)

#include <GuiConstants.au3>

GuiCreate("Stop and Start Service", 392, 323,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Input_IP = GuiCtrlCreateInput("", 150, 20, 150, 20)

$Input_UN = GuiCtrlCreateInput("administrator", 150, 50, 150, 20)

$Input_PW = GuiCtrlCreateInput("", 150, 80, 150, 20)

$Label_IP = GuiCtrlCreateLabel("Ip Address", 40, 20, 100, 20)

$Label_UN = GuiCtrlCreateLabel("UserName", 40, 50, 100, 20)

$Label_PW = GuiCtrlCreateLabel("Password", 40, 80, 100, 20)

$Button_4 = GuiCtrlCreateButton("Stop SmartSwitch Service", 150, 110, 150, 30)

$Button_5 = GuiCtrlCreateButton("Start SmartSwitch Service", 150, 150, 150, 30)

$StatusBar = GuiCtrlCreateLabel("", 62, 190, 296, 18, BitOr($SS_SIMPLE, $SS_SUNKEN))


While 1

$msg = GuiGetMsg()


Case $msg = $GUI_EVENT_CLOSE


Case Else





Share this post

Link to post
Share on other sites

what is the command for the psservice to start or stop the process

while 1
;... your code
case $msg = $Button_4
run ("psservice.exe stop parameters")
case $msg = $Button_5
run ("psservice.exe start parameters")
;... your code

as i don't know the exact command i just did an example - you've got to add the right commands

when you're finished plz post your code, i'd like to review it :)

Share this post

Link to post
Share on other sites

the code will be along the lines of when stop smartswitch button is pressed it executes this command

RunWait(@TempDir & "\psservice \\" & $Input_IP & " -u " & $Input_UN & " -p " & $Input_PW & " stop SmartSwitch", "", @SW_HIDE)

how would this fit in?

Share this post

Link to post
Share on other sites

would the guictrlread("my controls") come in the while command?

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.