powerbot Posted June 25, 2015 Share Posted June 25, 2015 (edited) Hallo forum,I have build a little installer for a bunch of programs. One of the programs is installing a service which I would like to run with a specific user.Func _prog() FileChangeDir ( @ScriptDir ) $CMD = @ScriptDir&"\programuser.vbs "&$pguser[1]&" "&$pgpw[1] ;the pguser and pgpw are set in a main program $Error_user = RunWait(@ComSpec & " /c " & $CMD, @Scriptdir) $CMD = "call "&@ScriptDir&"\"&$Inst_program&" --mode unattended" ;$Inst_program is also set in the main program $Error_install = RunWait(@ComSpec & " /c " & $CMD, @Scriptdir) $CMD = 'ntrights +r SeServiceLogonRight -u '&$pguser[1] $Error_service = RunWait(@ComSpec & " /c " & $CMD, @ScriptDir) $CMD = @ScriptDir&"\programservicechange.vbs "&$pguser[1]&" "&$pgpw[1] $Error_service = RunWait(@ComSpec & " /c " & $CMD, @Scriptdir) EndFuncprogramuser.vbs creates a new windows user and sets a password for it that doesn't expire'ntrights +r SeServiceLogonRight -u '&$pguser[1] sets Logon as service Rights for that created userprogramservicechange.vbs (modifies the service to start with the user and starts the service)strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colServices = objWMIService.ExecQuery _ ("SELECT * FROM Win32_Service WHERE Name = 'service'") For Each objService In colServices errServiceChange = objService.Change _ ( , , , , , , "program" , "password") Nextas far as I can check it it works fine (the user is created, the right password is set and the service is also set with that user)still my problem is:when I let the installer only run the install program and create a new user and after that change the service manually it works finebut when I let the installer do everything (install program, create user and mod service) the service isn't started when I go to Management>Serivcesand if I start the service manually I get a message that it was paused and that it is normal for some services to be paused after start if they are not used by a program or servicethe computer is member of a domain and the user with which I run the installer is local AdminI tried many things now and i am a little frustrated. Hope you can help my Edited June 29, 2015 by powerbot Link to comment Share on other sites More sharing options...
water Posted June 25, 2015 Share Posted June 25, 2015 Hallo powerbot,willkommen beim englischen AutoIt Forum!Um möglichst viele Antworten auf Dein Probem zu bekommen solltest Du entweder Deine Frage auf englisch stellen oder im deutschen Forum posten. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
powerbot Posted June 25, 2015 Author Share Posted June 25, 2015 Thanks for the adviceI 've translated it now Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now