473,386 Members | 1,790 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

stopping windows services

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
Jul 18 '05 #1
3 2048
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)

On Thu, 19 Aug 2004 21:52:33 -0400, Bart Nessux
<ba*********@hotmail.com> wrote:
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


Jul 18 '05 #2

"Bart Nessux" <ba*********@hotmail.com> wrote in message
news:cg**********@solaris.cc.vt.edu...
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.
Jul 18 '05 #3
Yes it can.

Check out the win32 extensions.

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

In article <cg**********@solaris.cc.vt.edu>, ba*********@hotmail.com
says...
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

Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: CG | last post by:
Hi I have developed a Windows Service When I try to start the Service it tells me that it cannot start as there may not be any work to do When I comment out below line of code in my OnStart...
6
by: DK | last post by:
i was able to successfully create a windows service using py2exe. it polls a website periodically and logs it to a file. this is done using a function that does an infinite loop with periodic...
0
by: news.microsoft.com | last post by:
Hi, I have a windows service that stops, but in the control panel/services it says that it is running. When I try to stop it, it times out, and just says 'stopping' as its state. I have to kill...
3
by: Jm | last post by:
Hi All Is there a better way to stopping a vb service rather than just saying end in your code ?
5
by: Primera | last post by:
I use the following method to stop the WMI service: string serviceName = "Windows Management Instrumentation" public static void stopService(string serviceName) { ServiceController services =...
6
by: D | last post by:
I have a simple file server utility that I wish to configure as a Windows service - using the examples of the Python Win32 book, I configured a class for the service, along with the main class...
0
by: SenthilVel | last post by:
Hi All I have problem in Stopping one of my windows service. My task is to stop is to stop all my windows services which beloings to my application. when doing so, i am able to stop all my...
1
by: raghudr | last post by:
Hi all, I am displaying a splash screen for which i have created a thread.Since my whole project is launched by windows service and that service will start automatically at the start of the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.