I found some code from a google search on how to get and set windows services startup type. i would like to make an application that saves the startup types for every service to an xml file, in which whenever i re-format my computer and re-install windows, i can just run my program and have it set all the services to what was saved in the file. i know how to do everything except getting and setting the startup type. here is the vbscript code that i found:
http://techtasks.com/code/viewbookcode/373
any ideas as to where i should look to do the equivalent in VB 2003 or VB 2005 ?
[/font]
VB.NET:
' From the book "Windows XP Cookbook"
' ISBN: 0596007256
' ------ SCRIPT CONFIGURATION ------
strSvcName = "MyMonitor"
strStartupType = "Automatic" ' can be "Automatic", "Manual", or "Disabled"
strComputer = "."
' ------ END CONFIGURATION ---------
set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
set objService = objWMI.Get("Win32_Service.Name='" & strSvcName & "'")
intRC = objService.Change(,,,,strStartupType)
' can alternatively use objService.ChangeStartup(strStartupType) method
if intRC > 0 then
WScript.Echo "Error setting service startup type: " & intRC
else
WScript.Echo "Successfully set service startup type"
end if
any ideas as to where i should look to do the equivalent in VB 2003 or VB 2005 ?
[/font]