May be this is helpful, and tanks for your great tip !
# DeleteService.py for NT and 2K
import os, sys
if os.name != "nt":
raw_input( "This os is not supported by this script!")
sys.exit()
if sys.version_info[0] < 2:
raw_input("Python 2.0 or greater is required to run this script!")
sys.exit()
try:
import win32api, win32com.client
except:
raw_input("The <win32all> package must be installed to run this script!")
sys.exit()
try:
adsComputer = win32com.client.GetObject("WinNT://" + win32api.GetComputerName())
except:
raw_input("The ADSI-Interface must be available to run this script!")
sys.exit()
ADS_SERVICE_STOPPED = 1
intCount = 0
lstServices = [None]
print "Stopped NT-Services:\n"
for adsObj in adsComputer._NewEnum():
if adsObj.Class == "Service":
if adsObj.Status == ADS_SERVICE_STOPPED:
intCount+=1
print repr(intCount) + ":\t" + adsObj.Name
lstServices.append(adsObj.Name)
strChoose = raw_input("\nWhich service do you want delete? (empty = none): ")
if strChoose == "":
raw_input("Aborded by User. Exit.")
sys.exit()
if strChoose.isdigit():
intChoose = int(strChoose)
if intChoose > 0 and intChoose <= intCount:
if raw_input("Do you realy want delete service " + repr(intChoose) + ": " +
lstServices[intChoose] + " (y/n) ? ").lower() !=
'y':
raw_input("Aborded by User. Exit.")
sys.exit()
else:
raw_input("Invalid number. Exit.")
sys.exit()
else:
raw_input("No Number. Exit.")
sys.exit()
try:
adsComputer.Delete("service", lstServices[intChoose])
raw_input("Service deleted. Exit.")
except:
raw_input("Service not deleted. Exit.")
--
Markus Daniel <mailto: [EMAIL PROTECTED]>
Telephone +49 174 175 20 21
PGP-Key 0x3f3cb98d
_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activepython