开发者

How to add an existing user into the Administrators group through WIX

开发者 https://www.devze.com 2023-03-02 22:35 出处:网络
I wanted to add an existing user to the A开发者_C百科dministrators group but unable to do so. Using custom table I can add the user to the group I have created through script but not in the groups alr

I wanted to add an existing user to the A开发者_C百科dministrators group but unable to do so. Using custom table I can add the user to the group I have created through script but not in the groups already created. Any idea how to do so?


As insta said you can use the Group, User, and GroupRef elements from http://wix.sourceforge.net/manual-wix3/util_xsd_group.htm like so:

<util:Group Id="AdminGroup" Name="Administrators"/>
...
<Component Feature="ProductFeature" Id="LocalSQLAdminGroupComponent" Guid="SOMEGUID" KeyPath="yes">
   <util:User Id="AdminUser" Domain="[%USERDOMAIN]" Name="[%USERNAME]" >
      <util:GroupRef Id="AdminGroup"/>
   </util:User>
</Component>


Isn't that what the Group element is for? You can use it to search for the Administrators group, follow that up with the User you create, then inside the User tag, GroupRef the Administrators group.

http://wix.sourceforge.net/manual-wix3/util_xsd_group.htm


I'm having a hard time google-fu-ing anything for you. This is a KB article on programatically managing user privileges. It might be what you're looking for.

Basically, you'll be writing a VBScript (or C++ or C#) custom action to access the Windows API and add the user to the group.

0

精彩评论

暂无评论...
验证码 换一张
取 消