I'm using the latest wix drop.  I tried double escaping the for loop parameter, 
i.e. %%i, and didn't get it working either.   Typically the %%i format is only 
required if the for loop is executing from within a batch script.

Based on recommendations in the previous response to this thread I switching 
over to the best practice approach of creating a localhost host machine group 
which I then grant login rights to and let membership in that group be managed 
as a separate process.   The issue I'm having there is my <util:Group /> 
statement doesn't create a localhost security group.   Any thoughts on what 
syntax I have incorrect that might cause this?  Unlike deferred custom actions 
I'm not getting much in the verbose msi log file to tell me what is causing the 
<util:Group /> to not process..

<sql:SqlDatabase Id="MasterDatabase" Database="master" Server="localhost" />
<sql:SqlDatabase Id="ModelDatabase" Database="model" Server="localhost" />
<sql:SqlDatabase Id="MsdbDatabase" Database="msdb" Server="localhost" />
<sql:SqlDatabase Id="TempDbDatabase" Database="tempdb" Server="localhost" />

<!--<util:Group Id="CreateMyServiceDeliverableMachineGroup" 
Name="MyServiceDeliverableMachines" />-->
<util:Group Id="CreateMyServiceDeliverableMachineGroup" Domain="[ComputerName]" 
Name="MyServiceDeliverableMachines" />
<!-- NOTE: a custom action is setup to execute after this action that adds a 
"Domain MyServiceDeliverableMachines" -->

<DirectoryRef Id="Database1Dir">
    <Component Id="Database1" Guid="30567E77-0860-491C-B385-54ECB53D4D6A" 
Win64="$(var.Win64)">
        <File Id="InstalledDatabase1.txt" Name="InstalledDatabase1.txt" 
Source="Resources\InstalledComponent.txt" KeyPath="yes" />

        <!-- create database1 requirees start | programs | sql | configuration 
| surface | services | database | remoteConnections =
            "local and remote connections" | "using both tcp/ip [ & named pipes 
]" == start | programs | sql | configuration |
            configuration | server network configuration | protocols | tcp/ip [ 
& named pipes ] = enabled -->
        <!-- create database1 -->
        <sql:SqlDatabase Id="Database1" Database="Database1" Server="." 
CreateOnInstall="yes" DropOnUninstall="yes" ConfirmOverwrite="yes" />

        <!-- setup database1 security settings -->
        <sql:SqlString Id="CreateLoginNetworkServiceDatabase1" 
SqlDb="MasterDatabase" SQL="create login [\[]NT AUTHORITY\NETWORK SERVICE[\]] 
from windows" ContinueOnError="yes" />
        <sql:SqlString Id="CreateLoginMachineGroupDatabase1" 
SqlDb="MasterDatabase" SQL="exec('create login [\[]' + @@servername + 
'\MyServiceDeliverableMachines[\]] from windows')" ContinueOnError="no" 
ExecuteOnInstall="yes" ExecuteOnUninstall="yes" RollbackOnUninstall="yes" />

        <sql:SqlString Id="CreateUserNetworkServiceDatabase1Msdb" 
SqlDb="MsdbDatabase" SQL="create user [\[]NT AUTHORITY\NETWORK SERVICE[\]] for 
login [\[]NT AUTHORITY\NETWORK SERVICE[\]]" ContinueOnError="yes" />
        <sql:SqlString Id="CreateUserMachineGroupDatabase1Msdb" 
SqlDb="MsdbDatabase" SQL="exec('create user [\[]' + @@servername + 
'\MyServiceDeliverableMachines[\]] for login [\[]' + @@servername + 
'\MyServiceDeliverableMachines[\]]')" ContinueOnError="no" 
ExecuteOnInstall="yes" RollbackOnUninstall="yes" />

        <sql:SqlString Id="CreateUserNetworkServiceDatabase1" SqlDb="Database1" 
SQL="create user [\[]NT AUTHORITY\NETWORK SERVICE[\]] for login [\[]NT 
AUTHORITY\NETWORK SERVICE[\]]" ContinueOnError="yes" />
        <sql:SqlString Id="CreateUserMachineGroupDatabase1" SqlDb="Database1" 
SQL="exec('create user [\[]' + @@servername + 
'\MyServiceDeliverableMachines[\]] for login [\[]' + @@servername + 
'\MyServiceDeliverableMachines[\]]')" ContinueOnError="no" 
ExecuteOnInstall="yes" RollbackOnUninstall="yes" />

        <sql:SqlString Id="AddRoleMembershipNetworkServiceDatabase1Msdb" 
SqlDb="MsdbDatabase" SQL="sp_addrolemember 'db_owner', 'NT AUTHORITY\NETWORK 
SERVICE'" ContinueOnError="yes" />
        <sql:SqlString Id="AddRoleMembershipMachineGroupDatabase1Msdb" 
SqlDb="MsdbDatabase" SQL="exec('sp_addrolemember ''db_owner'', ''' + 
@@servername + '\MyServiceDeliverableMachines''')" ContinueOnError="no" 
ExecuteOnInstall="yes" RollbackOnUninstall="yes" />

        <sql:SqlString Id="AddRoleMembershipNetworkServiceDatabase1" 
SqlDb="Database1" SQL="sp_addrolemember 'db_owner', 'NT AUTHORITY\NETWORK 
SERVICE'" ContinueOnError="no" ExecuteOnInstall="yes" RollbackOnUninstall="yes" 
/>
        <sql:SqlString Id="AddRoleMembershipMachineGroupDatabase1" 
SqlDb="Database1" SQL="exec('sp_addrolemember ''db_owner'', ''' + @@servername 
+ '\MyServiceDeliverableMachines''')" ContinueOnError="no" 
ExecuteOnInstall="yes" RollbackOnUninstall="yes" />
    </Component>
</DirectoryRef>

/rob

From: Mike Dimmick [mailto:[EMAIL PROTECTED]
Sent: Sunday, April 13, 2008 3:08 AM
To: Robert O'Brien; wix-users@lists.sourceforge.net
Subject: RE: [WiX-users] using for %i processing commands in custom actions

I surmise that it's going through printf (or family) at some point and the %i 
is being interpreted as a formatted parameter. Double the % signs to fix it.

I admit I can't see where this is happening in the current code. Which version 
of WiX are you using (including the build, e.g. 3.0.3829)?

Are you aware that you can grant a SQL Server login to a Windows security 
group? That might be a better option, using SqlStrings to create the login to 
the group, and using User and Group elements to add the users to the group.

--
Mike Dimmick

________________________________
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robert O'Brien
Sent: 12 April 2008 18:13
To: 'wix-users@lists.sourceforge.net'
Subject: [WiX-users] using for %i processing commands in custom actions

I have the following custom action I'm trying to make work and it seems the %i 
parameter is getting dropped when command line gets executed.   This same 
statement works from a command prompt without any issues.   Any insights as to 
how I need to restructure this cmd.exe for loop %i parameter insertion to get 
it working?

<CustomAction Id="QtExecCmdLineSet2" Property="QtExecCmdLineRun2" 
Value="&quot;[$(var.SystemFolder)]cmd.exe&quot; /c for %i in ([DATABASELOGINS]) 
do (&quot;[SQLBINDIR]sqlcmd.exe&quot; /Q &quot;create login [\[]%i[\]] from 
windows&quot;)" />

/robert
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to