Will Schultz
Will Schultz

Reputation: 9

Wix Installer fails "Verify that you have sufficient privileges to start system services"

I am trying to create a wix installer and I need it to promp for admin username and pw, but I can't get the pop up to show. I have tried changing the InstallPrivileges, InstallScope, as well as changing and removing the account from the ServiceInstall. How can I go about either getting the admin pop up to show or to bypass it?

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="*" Name="SetupProject2" Language="1033" Version="1.0.0.0" Manufacturer="test" UpgradeCode="3a34bc81-42fa-4c8f-b485-cf2297551f86">
        <Package InstallerVersion="301" Compressed="yes" InstallPrivileges="elevated" InstallScope="perMachine"  />


    <Condition Message="Please Run as Administrator.">
        Privileged
    </Condition>
    <MediaTemplate EmbedCab="yes" />
    

    <Feature Id="ProductFeature" Title="SetupProject2" Level="1">
        <ComponentGroupRef Id="CG_DependencyFiles" />
        <ComponentGroupRef Id="CG_ServiceInstaller" />
    </Feature>
</Product>


<Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
        <Directory Id="ProgramFilesFolder">
            <Directory Id="INSTALLFOLDER" Name="SetupProject2" />
        </Directory>
    </Directory>
</Fragment>
<Fragment>
    <ComponentGroup Id="CG_DependencyFiles" Directory="INSTALLFOLDER">
        //All my dll 
    </ComponentGroup>
</Fragment>
<Fragment>
    <ComponentGroup Id="CG_ServiceInstaller" Directory="INSTALLFOLDER">
        <Component Guid="F7E041AB-3227-4272-92C1-4A12685F30AF" >
            <File Source="$(var.myTestService.TargetDir)myTestService.exe" KeyPath="yes"/>
            <ServiceInstall Id="myTestService"
                              Type="ownProcess"
                              Name="myTestService"
                              DisplayName="myTestService"
                              Description="Super awesome service"
                              Start="auto"
                              ErrorControl="normal"
                              />
            <ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="myTestService" Wait="yes" />
        </Component>
    </ComponentGroup>
</Fragment>
<Fragment>
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
        <!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
        <!-- <Component Id="ProductComponent"> -->
            <!-- TODO: Insert files, registry keys, and other resources here. -->
        <!-- </Component> -->
        <Component Id="ProductComponent">
            <File Source="$(var.myTestService.TargetPath)" />
        </Component>
    </ComponentGroup>
</Fragment>

Upvotes: 0

Views: 596

Answers (1)

Rob Mensching
Rob Mensching

Reputation: 35796

Try adding UI to your installation, like: <UIRef Id="WixUI_Minimal" />. Having UI and launching the install in UI mode (double-clicking is fine) should allow the Windows Installer to prompt for elevation when you hit the Install button.

Upvotes: 1

Related Questions