Page 1 of 1
Search the registry
Published: January 9, 2020 - 11:53 AM
by Christophe0110
Hello,
I'd like to search the session_setup section of one of my packages for a specific key in the user's registry (under HKEY_CURRENT_USER\Software\KONICA MINOLTA) to list all keys with that specific name and then modify that key.
In my case, our print server has been reinstalled and has a different name.
The KONICA MINOLTA copier configuration on the client workstations is located in this registry location, and I simply need to search for all keys with the name of the old server and replace them with the new name (and it works, I've tested it). This way, users keep their configuration even if the printer is reinstalled from the new server.
Is there an example somewhere explaining how to search for a key under a specific branch and modify it?
Thanks,
Christophe.
Re: Searching the registry
Published: January 10, 2020 - 11:19 AM
by dcardon
Christophe0110 wrote: ↑January 9, 2020 - 11:53 AM
Hello,
In the session_setup section of one of my packages, I would like to search a specific key in the user's registry (under HKEY_CURRENT_USER\Software\KONICA MINOLTA) to list all keys with a specific name and modify that key.
In my case, our print server has been reinstalled and has a different name.
The KONICA MINOLTA copier configuration on the client workstations is located in this registry location, and I simply need to search for all keys with the name of the old server and replace them with the new name (and it works, I've tested it). This way, users keep their configuration even if the printer is reinstalled from the new server.
Is there an example somewhere explaining how to search for a key under a specific branch and modify it?
Best regards,
Christophe.
If setuphelpers doesn't have the commands you need, you can use the winreg library directly. You can look at the setuphelpers library code to get an idea of the syntax.
Sincerely,
Denis
Re: Searching the registry
Published: January 13, 2020 - 09:22
by Christophe0110
Hi Denis,
I must be missing something, but when I look in the WinReg library, I can't find any function to rename a key.
I can find functions for creating a key, deleting a key (and all its values), and creating or editing a value with its type, but nothing for editing the key name...
How do I do it?
Thanks!
Re: Searching the registry
Published: January 13, 2020 - 10:40 AM
by vcardon
Christophe0110 wrote: ↑Jan 13, 2020 - 9:22 AM
Hello Denis,
I must be missing something, but when I look in the WinReg library, I can't find any function that allows me to rename a key.
I can find how to create one, how to delete one (and all its values), or how to create or edit a value with its type, but nothing to edit the key name...
How do I do it?
Thanks
Hello Christophe
If you can delete and create a registry key, it's a bit like renaming, isn't it?
Sincerely.
Vincent
Re: Searching the registry
Published: January 13, 2020 - 1:02 PM
by Christophe0110
Yes, okay... Except that when I delete it, I also have to recreate everything underneath (all the values, etc.)...
But I think I've found a solution by running `reg /COPY` followed by `reg /DELETE`... The `Copy` command makes a copy of the key (with all its subkeys) to another key (with a different name)... So, it works... But without using Python code...