Getting privilege error while creating a new user and adding it to the administrators

故事扮演 提交于 2019-12-24 03:16:57

问题


I have a made a setup-project with WiX 3.8 in which i want to create a new user and add it to the administrators group. But each time my setup comes to that point, i get an error because of insufficient privileges. That's a little bit curious, because my user is an administrator on the virtual machine, on which i test the setup. What can i do?

That's the code in the WXS-file for creating the user:

<util:Group Id="Administrators"
            Name ="Administrators"
            Domain="[ComputerName]" />
<Component Id ="CreateUserAccount"
           Guid="AEE91491-99FA-40A9-AB47-1E9FC2DDEF2A"
           Directory="TARGETDIR">
    <util:User Id ="SQLUser"
               Name="[MyUsername]"
               Password="[MyPassword]"
               UpdateIfExists="no"
               CreateUser="yes"
               PasswordNeverExpires="yes"
               PasswordExpired="no"
               RemoveOnUninstall="no"
               Domain="[ComputerName]">
        <util:GroupRef Id ="Administrators"/>
    </util:User>
</Component>

回答1:


Because of UAC, a process must still elevate its privileges even if the user is an administrator. This gives the user a chance to deny the elevation of privileges at the security prompt.

In the Package element, make sure you have set InstallPrivileges="elevated". This should ensure that Windows Installer prompts for elevated privileges during the installation.



来源:https://stackoverflow.com/questions/27481096/getting-privilege-error-while-creating-a-new-user-and-adding-it-to-the-administr

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!