Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update service account identity with login interactive

Status
Not open for further replies.

Kozimoto

Technical User
Sep 25, 2002
44
0
0
US
Hi.

I am looking for a vbscript that when ran would ask for a domain\loginid as the parameter and update a service to use these credential for starting the the service and grant it log on interactively.

Any help would be very much appreciated.
 
I think you will find most of what you are looking for here:


Code:
strSvcName = "myService"
strUsername = inputBox("Enter your FQDN (domain\userid):")
strPassword = inputBox("Enter your password:")

strComputer = "."
set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
set colServiceList = objWMI.ExecQuery("Select * from Win32_Service Where StartName=" & strSvcName)

for each objService in colServiceList
    errReturn = objService.Change( , , , , , , strUsername, strPassword)  
next

Not sure about granting it rights. Although, if the user is in the correct AD Groups, this shouldn't be an issue.

-Geates
 
i cheat and use the ntrights.exe at install / config time for the rights, knowing full well that GroupPolicy will come and along and explicitly grant or deny the rights anwyway. at least i have done my bit, i cant help it if AD comes along and changes it later
 
Thanks to both of you. I'll give this a go.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top