简体   繁体   中英

WIX ServiceInstall - setting the service to run under the NetworkService account

I am trying to create a WIX installer to install my windows service to run under the NetworkService account and getting an Insufficient Priviledges error during the installation.

I found this post where someone seems to be experiencing the same problem but no real solution was offered:

http://n2.nabble.com/Re-WiX-users-Digest-Vol-40-Issue-129-td3782055.html

I'm sure someone must have acheived this previously and wondered if they'd be kind enough to share a code snippet?

NOTE: The answer below is only relevant on the older builds of WIX and Windows at the time the question was raised. The current version of the WIX service credentials will work if you set the native "NT AUTHORITY" domain and "NetworkService" account (no space necessary now).


Original Answer:

The correct identity name is "NT Authority\\Network Service" not "NT Authority\\NetworkService". A space is required then it works.

Funny that the default "LocalSystem" works directly with WIX 3.5, but for other well known accounts you have to prefix with "NT Authority...", for example "LocalService" does not work either when used directly.

ie fix this with:

Account='NT Authority\\Network Service'

It seems a few remnants of a previously failed install were preventing me from removing and reinstalling with Account="NT Authority\\NetworkService". All is well in the universe again.

I had the following snippet working under Windows 8.1 FR, and Windows 2012R2 ENU. But using NT AUTHORITY\\NETWORK SERVICE failed with the insufficied privileges error.

So, at least under recent systems you must use NT AUTHORITY\\NETWORKSERVICE as documented in MSDN .

              <ServiceInstall Id="xserviceInstall" Name="$(var.xServiceid)" 
              DisplayName="$(var.xServiceid)" 
              Description="x service" Start="auto" Type="ownProcess"
              ErrorControl="ignore" 
              Account="NT AUTHORITY\NETWORKSERVICE" 
              Arguments="-w -N" Vital="yes" />

I used customAction to find the user credentials are correct or not.

If user credentials are matches the account in the machine they want to install,I will allow them to proceed to next dialog(UI) other wise I will show another Dialog indicating the user that account not found.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM