cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
shust87
Level 3

Error 1722 when non-admin user running installation as Administrator

My installation project has custom action (let's call it StartMyServiceCA) where I'm trying to start MyService during installation process
cmd.exe /c net start "MyService"


You cannot start MyService if you are not an admin, so I set 'Required execution level' to Administrator in setup.exe properties and 'Require Administrative Privileges' to Yes in General Information view.

It works as expected if I run setup.exe as user who is an admin. It copies some exe and dlls to destination folder and then starts MyService.

Problem appears when user who is not an admin is running setup.exe. When he clicks on setup.exe then Windows dialog appears first with '‘Do you want to allow the following program to made changes to this computer’ message and 2 textboxes below (login and password). This is an expected Windows7 behavior in this case, isn't it? Installation will continue only if he types there credentials of user who is administrator on this box but will fail on StartMyServiceCA custom action with 1722 error. I cannot understand why I'm getting this error, can someone help me or provide solution to fix it? Does it make sense to write another custom action that will run first and stop installation process if user is not admin?
Labels (1)
0 Kudos
(3) Replies
TsungH
Level 12

Why do you want to use a custom action to start a service? Microsoft Windows Installer provides a way to control service (ServiceControl Table).
0 Kudos
Roman1
Level 9

Hello TsungH,
Your thread is not a answer to solve this problem. The issue is to start setup as other user with elev.priv.iliges.
0 Kudos
TsungH
Level 12

Roman1, using custom action to do what Windows Installer natively supports, in this case, to start a Windows service, is a bad approach. Finding a workaround to a bad approach is asking for more troubles in the future.
0 Kudos