1

I currently have 3 users using a mandatory profile on my Windows 2008 remote desktop server. I have managed to get everything to play nice by changing registry permissions, setting up permissions on the profile folder and setting up the initial user's profile before locking it down using the .man extension. My issue/question revolves around associations on the remote desktop.

Normally I would do the following...

1) Get all three users to log out
2) Change the profile from .man to .dat
3) Get the "profile template user" (a title I have given the first user I set up with the profile for) to log on.
4) Get that user to create a shortcut or set up a file association, etc.
5) Get that user to log off.
6) Rename the profile from .dat to .man

For some reason all my changes seem to stick from user to user with the exception of the file association. I can not get that one thing to stick!

Ideas?

Arvo Bowen
  • 805
  • 5
  • 17
  • 35

1 Answers1

0

I ended up creating a registry file to use on group policy when the user logs on. In this case I have an example below on what I did to make use of environment variables in the registry.

It's kind of tricky but very easy to do. This example would allow you to open a certain type of file (*.test) up with a program (Notepad++) that resides in a user specific directory. I used this for a scenario on my Windows 2008 server running Remote Desktop (AKA Terminal Server) to allow each user to use a program installed PER user account so that different settings could be used per user (ex: *.ini files located within the apps directory). Note: Not that it matters but the folder "programs" is hidden so the users do not see it.

Paths:
Application (notepad++): Y:\%username%\programs\Notepad++\notepad++.exe
File To Open (File.test): Y:\%username%\TestFiles\File.test

Step 1. IF you are using mandatory profiles be sure to change the NTUSER.MAN file back to NTUSER.DAT.

Step 2. Log into the profile you wish to edit using Remote Desktop Client.

Step 3. Open up regedit and delete the following keys if they exist.

HKEY_CURRENT_USER\Software\Classes\Applications\notepad++.exe HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts.test

Step 4. Create a new text file and name it "original.reg". Fill it with the following...

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Classes\Applications\notepad++.exe]

[HKEY_CURRENT_USER\Software\Classes\Applications\notepad++.exe\shell]

[HKEY_CURRENT_USER\Software\Classes\Applications\notepad++.exe\shell\open]

[HKEY_CURRENT_USER\Software\Classes\Applications\notepad++.exe\shell\open\command]
@=""

Step 5. Refresh registry (F5) and look for the new key. Should see the "command" key with "(Default)" value blank. In the "command" key add a new "Expandable String Value" called "New Value #1". Set the value to the application's path "Y:\%username%\programs\Notepad++\notepad++.exe" "%1". Then export the "command" key to the desktop as "expanded.reg".

Step 6. Edit the "expanded.reg" file in notepad and copy all the data after the "New Value #1". Ex: =hex(2):22...

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Classes\Applications\notepad++.exe\shell\open\command]
@=""
"New Value #1"=hex(2):22,00,59,00,3a,00,5c,00,25,00,75,00,73,00,65,00,72,00,6e,00,\
61,00,6d,00,65,00,25,00,5c,00,70,00,72,00,6f,00,67,00,72,00,61,00,6d,00,73,\
00,5c,00,4e,00,6f,00,74,00,65,00,70,00,61,00,64,00,2b,00,2b,00,5c,00,6e,00,\
6f,00,74,00,65,00,70,00,61,00,64,00,2b,00,2b,00,2e,00,65,00,78,00,65,00,22,\
00,20,00,22,00,25,00,31,00,22,00,00,00

Step 7. Close expanded.reg file and open the "original.reg" file then replace the default command (that is empty "") with the new hex value we have in our clipboard. The file "original.reg" should look like the following now...

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Classes\Applications\notepad++.exe]

[HKEY_CURRENT_USER\Software\Classes\Applications\notepad++.exe\shell]

[HKEY_CURRENT_USER\Software\Classes\Applications\notepad++.exe\shell\open]

[HKEY_CURRENT_USER\Software\Classes\Applications\notepad++.exe\shell\open\command]
@=hex(2):22,00,59,00,3a,00,5c,00,25,00,75,00,73,00,65,00,72,00,6e,00,\
61,00,6d,00,65,00,25,00,5c,00,70,00,72,00,6f,00,67,00,72,00,61,00,6d,00,73,\
00,5c,00,4e,00,6f,00,74,00,65,00,70,00,61,00,64,00,2b,00,2b,00,5c,00,6e,00,\
6f,00,74,00,65,00,70,00,61,00,64,00,2b,00,2b,00,2e,00,65,00,78,00,65,00,22,\
00,20,00,22,00,25,00,31,00,22,00,00,00

Step 8. Now that we have our expanded variable ready to go lets just add an extension to associate with the application. Add the following to the "original.reg" file making it look like the following...

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Classes\Applications\notepad++.exe]

[HKEY_CURRENT_USER\Software\Classes\Applications\notepad++.exe\shell]

[HKEY_CURRENT_USER\Software\Classes\Applications\notepad++.exe\shell\open]

[HKEY_CURRENT_USER\Software\Classes\Applications\notepad++.exe\shell\open\command]
@=hex(2):22,00,59,00,3a,00,5c,00,25,00,75,00,73,00,65,00,72,00,6e,00,\
61,00,6d,00,65,00,25,00,5c,00,70,00,72,00,6f,00,67,00,72,00,61,00,6d,00,73,\
00,5c,00,4e,00,6f,00,74,00,65,00,70,00,61,00,64,00,2b,00,2b,00,5c,00,6e,00,\
6f,00,74,00,65,00,70,00,61,00,64,00,2b,00,2b,00,2e,00,65,00,78,00,65,00,22,\
00,20,00,22,00,25,00,31,00,22,00,00,00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.test]

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.test\OpenWithList]
"a"="notepad++.exe"
"MRUList"="a"

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.test\OpenWithProgids]
"Notepad++_file"=hex(0):

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.test\UserChoice]
"Progid"="Applications\\notepad++.exe"

Step 9. Open up regedit and delete the following keys if they exist. (Yes do it again)... Now the registry is like we never did anything and we have a registry file ready to insert into the registry!

HKEY_CURRENT_USER\Software\Classes\Applications\notepad++.exe HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts.test

Step 10. If you want to apply this to the current profile then RUN THE REGISTRY FILE "original.reg" and insert it into the registry.

And that's it! Now all *.test files will open up with "Y:\%username%\programs\Notepad++\notepad++.exe". Go check the registry and see the new default entry.

Arvo Bowen
  • 805
  • 5
  • 17
  • 35