C# - Want to edit printer registry settings for all local users on machine
So we have a problem here in my organization's office in that we need to purge the printer settings for the current users as part of print se开发者_如何学JAVArver move. The printers have been installed several different ways over the years and we need to purge both local and network printer instances to give us a 'fresh start'. I wanted to create a small program to do the purge automatically and the program so far can purge the printer settings for the currently logged in user and the default user by editing the respective registry keys. The problem I am now faced with is the other user accounts on the machine: I need to be able to load and modify the printer settings in the 'Printers\Connections' area of the registry for each one.
Does anyone know how this can be achieved programmaticly? I've been driving myself up the wall trying to figure this out, and google isn't helping.
Before reading your question have never needed to do something like this, however a bit of quick research I have the following:
The key part of the problem is that you do have access to the *HKEY_CURRENT_USER* hive without logging into their account.
Take a look at the ModifyProfile1 tool written by Marty List. It lets you modify the *HKEY_CURRENT_USER* registry hive of any user on a machine without requiring the user to login. If the tool itself is no use, i.e. it won't let you delete keys, there is still useful information on Shijaz Abdulla site that could help find a solution.
Take your current tool, as-is, and setup it up as run on user login. Distribute it to your company and as users log into their accounts the registry keys will eventually be removed.
EDIT: If you follow the link to Marty's actual company site Optimum X there are a lot of awesome looking tools that could help (not certain, just scanned the list).
精彩评论