/build/static/layout/Breadcrumb_cap_w.png

MSI: Create or rename a folder to the logged on user's userID

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!!


0 Comments   [ + ] Show comments

Answers (4)

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
Posted by: jagadeish 12 years ago
Red Belt
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.


Comments:
  • How would that automatically create or rename a folder to the logged on user's userID? - jlai 12 years ago
  • 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... - jagadeish 12 years ago
  • Thanks. - jlai 12 years ago
Posted by: Visalakshi 12 years ago
Orange Senior Belt
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.


Comments:
  • 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 - jlai 12 years ago
Posted by: piyushnasa 12 years ago
Red Belt
2

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

Posted by: henrik80 12 years ago
Second Degree Blue Belt
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.


Comments:
  • Thanks, I'll check this out. Would this still work even though the MSI is installed using the system account? - jlai 12 years ago
  • 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. - akki 12 years ago
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ