stop and start service on remote machine

Asked by Geeta

hi ,

Can I stop and start a service on a remote machine using sikuli and python? can you please help me out in writing a Helper method to do the same.

Thanks in advance
Geeta

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

What systems?

How do you communicate with the remote machine?

Why are you thinking of Sikuli?

How would you start the service by hand?

Revision history for this message
Geeta (geeta-gudaru) said :
#2

Hi ,

I have my client running on XPSP3 and my server is on Windows 2003 sp2 ..
I want to stop the server service on windows 2003 sp2 at some point of time ...
Now the automation which i am doing is using both python and sikuli .
So is there any chance of starting and stopping of the server service that is on windows 2003 sp2 using "net stop and start" commands from windows xpsp3 on which the client is present

Revision history for this message
RaiMan (raimund-hocke) said :
#3

So if I understand right, the Sikuli is running on the client and inside of this script you want to say "net stop and start" adressing the service on the server.

So first you have to answer the question: How to "net stop and start" a server service from a client machine. This is a windows question.

Then if you know that, you have to integrate the automation of this into your script.

If you succeed to wrap up the "net stop and start" into a command-file (.cmd), you can use os.popen() in your script to run this command-file.

Or you use one of the available remote shell solutions (e.g. based on telnet) to run the "net stop and start" on the server and automate this with your script.

Revision history for this message
Geeta (geeta-gudaru) said :
#4

I found one Tool which cans stop the services on the remote server and that solved my problem and for this i need to write one helper method which solved my problem.

Revision history for this message
Best RaiMan (raimund-hocke) said :
#5

pls. name the tool and set question to solved

Revision history for this message
Geeta (geeta-gudaru) said :
#6

I had used the PSService.exe tool (of microsoft) that stops the services on the Remote machine
The cmd looks like :

Navigate to the location where this tool is extracted (download from google) and then run the below command from the command prompt

Pservice.exe \\machine hostname -u <machine login user> -p <machine login password> stop <service name>

Pservice.exe \\machine hostname -u <machine login user> -p <machine login password> start <service name>

The above two commands stops and then starts the Services on the machine (that you had mentioned in the command)

Revision history for this message
Geeta (geeta-gudaru) said :
#7

http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx

The above is the url where you find the PsEXEC tool download.The PsService.exe is a part of this Tool extract the tool and you find "PsService.exe"