stopping windows services

B

Bart Nessux

Can Python be used to stop windows services? I'm writing a script to
automaically remove some troublesome Symantec software, but before
running the main removal script, I need to kill some services.

Thanks,
Bart
 
D

David Morgenthaler

Get WService from http://starship.python.net/crew/mhammond. Then, for
example:

import WService
import time

listener = WService.WService("Network Associates McShield")
listener.status(1)
if listener.status(0) != 'STOPPED':
print "Stopping Network Associates McShield..."
listener.stop()
time.sleep(5)
listener.status(1)
 
G

George Kinney

Bart Nessux said:
Can Python be used to stop windows services? I'm writing a script to
automaically remove some troublesome Symantec software, but before
running the main removal script, I need to kill some services.


if you know the services name, and are running under an account with
sufficient permissions, you could just use the cmd shell.

i.e. os.system('net stop Apache2') - kills my apache server, and obviously
os.system('net start Apache2') starts it again.

Probably a nicer API out there somewhere though.
 
C

ChrisH

Yes it can.

Check out the win32 extensions.

If you like, I can dig up some example code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top