Ok, this is a weird one.  I've been given an application to package into an MSI, the developers want the MSI to be able to create a folder with the logged on user's userID (C:\Program Files\MyApp\<UserID>\).  We deploy applications to machines and any user specific stuff (user profile, HKCU, etc) is usually handled with Active Setup.  Can this be achieved using Active Setup?

... and No, I don't know why they couldn't have developed their application to use AppData!!

Answer Summary:
The username variable could be used with Custom Action "Set Directory" Custom Action Type 35. First create a directory "userIDFolder". Then create a custom action in execute sequence that changes the path of this directory to C:\Program Files\MyApp\%username%, with the help of Custom Action Type 35
Cancel
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Community Chosen Answer

3

This can be achieved using ActiveSetup or DuplicateFile table... In both cases, you have to give "Write Permission" to the "C:\Program Files\MyApp" folder.

Answered 05/28/2012 by: jagadeish
Red Belt

  • How would that automatically create or rename a folder to the logged on user's userID?
  • Yes.. As Visalakshi said, Create a VBScript which will create a folder with the currently logged in USERNAME in C:\Program Files\Myapp folder, keep this VBScript in C:\Program Files\MyApp folder . Call this vbscript in Active setup...
  • Thanks.
Please log in to comment

Answers

2

Give permisions to C:\Program Files\Myapp. Create a VB script which will create a folder in C:\Program Files\Myapp. Call this vbscript in Active setup.

Answered 05/29/2012 by: Visalakshi
Orange Senior Belt

  • Thanks, I didn't realise you could have more than one Active Setup per MSI. I'll have a look at this too. So the stub Path would be: wscript.exe myscript.vbs
Please log in to comment
2

There can be as many active setup as you want. Just keep the reg key different

Answered 05/30/2012 by: piyushnasa
Red Belt

Please log in to comment
1

The username variable could be used with Custom Action "Set Directory" Custom Action Type 35.

First create a directory "userIDFolder".

Then create a custom action in execute sequence that changes the path of this directory to C:\Program Files\MyApp\%username%, with the help of Custom Action Type 35.

Answered 05/28/2012 by: henrik80
Second Degree Blue Belt

  • Thanks, I'll check this out. Would this still work even though the MSI is installed using the system account?
  • Yes it will.
    As your MSI uses Active Setup, it will repair for each user on first login ans as such will create the directory.
Please log in to comment
Answer this question or Comment on this question for clarity
Admin Script Editor
Admin Script Editor is an integrated scripting environment available free here at ITNinja

Share