Windows Registry changes will not work - windows

I´m trying to make some changes(Wallpaper/Themes) on a windows7 enviroment, until now, I copied some files in to a directory with admin rights, so the "hard" part is over.
Trying to change the registryKey with a batch or with a Powershell file will work, as an Admin and as a normal-user.
The bad thing is, if I try to make the changes as an Admin, then the changes will be just for the adminSession. And I want to make the changes for the normalUser and every new user(with not admin rights).
I found that with a batch file, I can make some changes to my normalUser account:
HKCU:\Software\Micorsoft....\Themes\ and change the value CurrentTheme to my own Windows theme.
If I check my registry, I notice that the CurrentTheme value was accepted, and after a reboot stay so.
But Windows shows me the default theme... ¬¬
I tried to change "everything" to set my Theme as default, but nothing works..
Is there a way to make it works? Why windows is refusing to take the changes in the registry and always show me the default Theme?

Go to HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows
In the left pane, right click on Windows and click on New and Key. Type Personalization and press enter (if not already exists).
Create a New and String Value called ThemeFile and press Enter. Right click on ThemeFile and click on Modify. Type in the full path of the .theme file with file extension in "" (example: "C:\Users\UserName\AppData\Local\Microsoft\Windows\Themes\NewCustomTheme.theme") ; it will be default for new users.

Are the systems on a domain?
You should know that registry values stored within the Policies key and all the subkeys after that can be reset by domain group policy at any time. That is to say that if you make a change here and reboot or run gpupdate, you can expect the values to be erased.
If you really want to change the theme for all users, you should use Group Policy to apply the theme, as seen in this link. Group Policy Settings for Windows Personalization.. Look in the section under "Set a Specific Theme".
I've done this for clients a number of times. You can also set a specific theme as the default by logging on as the Default Profile and making changes. Keep in mind that this approach should be done when you build a system image to deploy to the environment.

Related

Going over all user profiles during installation

I'm creating a Windows application that needs to add an entry to the Send-To explorer context menu, and needs to do so for all users. Since the Send-To folder is specific for each user, with no common folder for all users, I'm left with two choices:
I can go over all user profiles, as well as the default user profile, find the SendTo folder and add the shortcut to it. This will ensure the shortcut is deleted during uninstall.
Or, I can make sure the shortcut is in the SendTo folder each time a user logs in (by adding my application to the start-up folder of all users). This will make my life a lot easier during installation, but when the application is uninstalled, all those shortcuts will not be removed.
So either way, I need a way to find the SendTo folder of all users. I can scan HKEY_USERS and find the SendTo folder of each user (it might not be in the default location, the user can move it), but how do I find out the user profile's root folder? The registry has something like %USERPROFILE\AppData\Roaming... for the SendTo folder. How can I figure out what %USERPROFILE% is for another user?
Thanks.
Easier approach: use the launch sequence of the exe itself to check whether the shortcut it present on launch, and create it if not.
Uninstall for all users is best handled using ActiveSetup which will run "something runnable" once for each user logging onto the machine. In your case a simple batch command could do the job.
If you do chose this uninstall approach, you must make sure that your msi installer checks for this uninstall key and deletes it on install - otherwise you have a delete operation scheduled for the shortcut the next time a user logs on.
Also keep in mind that each install should use a different entry in ActiveSetup to ensure that the shortcut creation is re-run for a user who has had it uninstalled already. This last part might be slightly incomprehensible before you read more about ActiveSetup: http://www.etlengineering.com/installer/activesetup.txt
You can create a custom action inside MSI, which will go through all user profiles and remove your shortcuts from SendTo folder. All users profile you can find, just scan all folders in %systemdrive%\Users folders in Windows7 (Vista), or Documents and Settings in Windows XP.
Or you can use ActiveSetup mechanism for this purpose, create some script (application) which remove your shortcut from SendTo folder, when user will log in to system next time.

How to add an entry in the Windows context menu for files with a specific extension?

I know that many questions are asked about how customizing the shell context menu, but what I've tried yet doesn't work so I'm adding a new question.
I'd like to add an entry "Open with Log Viewer" in the context menu when right-clicking on files with ".log" extension, to not change the default application associated with .log files (notepad) but allow the user to choose a custom application to open them.
To do this, I opened the registry key HKEY_CLASSES_ROOT\.log, and added some keys shell\OpenWithLogViewer\command with the correct values, but the entry is not displayed when I right-click on a file with .log extension.
Would you know how to fix this?
The key HKEY_CLASSES_ROOT\.log has for default value txtfile, and contains a subkey called PersistentHandler. Can this subkey be the origin of the problem?
Add another registry key (e.g. HKEY_CLASSES_ROOT\logfile), create the shell structure below that key and change the default value of the .log key to logfile. One way to do this is by saving the following lines to a .reg file and merging that file into the registry.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.log]
#="logfile"
[HKEY_CLASSES_ROOT\logfile]
[HKEY_CLASSES_ROOT\logfile\shell]
#="OpenWithLogViewer"
; make OpenWithLogViewer the default action
[HKEY_CLASSES_ROOT\logfile\shell\OpenWithLogViewer]
#="Open with &Log Viewer"
; set label and access key
[HKEY_CLASSES_ROOT\logfile\shell\OpenWithLogViewer\command]
#="\"C:\\path\\to\\logviewer.exe\" %1"
This separates the type (logfile) from the extension (.log). That way you can define the possible actions for a type in one place and associate arbitrary extensions with that type.
Note that you can also define this on a per-user basis by using HKEY_CURRENT_USER\Software\Classes instead of HKEY_CLASSES_ROOT. User entries take precedence over system entries. This is useful when you want to change file associations or add custom actions for your own user, but don't have admin privileges on the system.
If you want to add a entry for a file extension you don't "own" and you never want to be the default action then you can use the SystemFileAssociations key:
[HKEY_CLASSES_ROOT\SystemFileAssociations\.log\shell\mycommand]
#="My Command"
[HKEY_CLASSES_ROOT\SystemFileAssociations\.log\shell\mycommand\command]
#="\"c:\\path\\myapp.exe\" \"%1\""
To deal proactively with the consequences of a change to default programs, you can use HKEY_CLASSES_ROOT\SystemFileAssociations to register verbs and other association information. Due to their location after the ProgID in the association array, these registrations are lower priority. These SystemFileAssociationsregistrations are stable even when users change the default programs, and provide a location to register secondary verbs that will always be available for a particular file type.
This key is available on Windows XP and higher...

Right Click in Windows Explorer

I have been trying to add context based right click in windows explorer for a file of extension L5X. I have tried HKEY_CLASSES_ROOT\l5xfile\Shell\convert\command and set the (Default) key value to the program I want to have open the file. (I want it to say "Convert" on the context menu) My first issue seems to be that in .NET (even when running elevated) I cannot change the Default key's value. My other issue is changing that Default key value doesn't do anything to the context menu. I would really prefer a no reboot required solution.
Also, I really need this to work on WinXP all the way up to Win7 (including Server 2003, 2008 and 2008R2). If I need to detect OS and do things differently for different OSes, I will but I'm really stuck here.
PS, I tried the solution found here with no luck.
You need administrator rights to write to HKEY_CLASSES_ROOT, HKEY_CLASSES_ROOT is a merged view of HKEY_LOCAL_MACHINE\SOFTWARE\Classes and HKEY_CURRENT_USER\Software\Classes. If you want to install it for just the current user, write to HKEY_CURRENT_USER\Software\Classes
\l5xfile\Shell\convert\command might not be the correct path, when windows looks for context menu entries for a filetype, it first looks in HKEY_CLASSES_ROOT\.EXT, then uses the default value it finds there: HKEY_CLASSES_ROOT\%defaultvaluefrom.EXT%\Shell\*
XP added a new key HKEY_CLASSES_ROOT\SystemFileAssociations designed for non-primary actions where you don't care about the ProgId/Class (The l5xfile part)
MSDN documents all these registry paths and settings, see: File Types and Verbs and File Associations

Programmatically Changing XP Appearance Settings

I am trying to silently apply very specific appearance settings for a single user with poor eyesight on an XP machine.
I can alter the settings by using the appearance tab of the display settings dialog and clicking apply/ok. Doing this works however the user cannot see well enough to change her settings back to how she likes them each time she logs on.
Just changing the registry keys does not make the desired changes until the user logs off and then on again. For reasons that would take too long to explain, I cannot simply get the user to log off and then on again. I need the settings to be applied immediately upon login.
So! I either need to force windows to apply the display settings, a process which seems to be associated with the 'Please Wait' dialog, screenshot included OR I need to programmatically change the appearance settings individually (which includes altering 'Advanced' font-size settings).
Many thanks.
Please Wait Example http://www.dur.ac.uk/alexander.holmes2/b/pleasewait.jpg
Does this user have his/her own windows User? (his/her own account on XP). It should keep settings for you if you have them as a separate user from whoever else likes the larger DPI. Just create a user.

Launch app on startup for all users, but also allow per-user setting (Windows)

I need my application installer set the program to auto-startup for all users.
Then each individual user should be able to modify this option without affecting others.
Currently I write to HKLM/../Run with installer, which acomplishes the first task.
But then I can't disable autorun for current user, because deleting th HKLM/../Run entry would disable it for everybody.
Is there a way to do that, without using shortcuts in Autostart folder?
start it for all users always but check a configuration variable in HKLU to see if it should exit immediately
Any reason not to use the HKCU Run key in the first place?
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run]

Resources