Using InstallUtil and silently setting a windows service logon username/password

Dean Hill picture Dean Hill · Sep 26, 2008 · Viewed 74.9k times · Source

I need to use InstallUtil to install a C# windows service. I need to set the service logon credentials (username and password). All of this needs to be done silently.

Is there are way to do something like this:

installutil.exe myservice.exe /customarg1=username /customarg2=password

Answer

Jimbo picture Jimbo · May 19, 2010

A much easier way than the posts above and with no extra code in your installer is to use the following:

installUtil.exe /username=domain\username /password=password /unattended C:\My.exe

Just ensure the account you use is valid. If not you will receive a "No mapping between account names and security id's was done" exception