Search the registry

Questions about WAPT Packaging / Requests and help regarding Wapt packages.
Forum Rules
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
Locked
Christophe0110
Messages: 53
Registration: June 11, 2019 - 12:04

January 9, 2020 - 11:53

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.
User avatar
dcardon
WAPT Expert
Messages: 1932
Registration: June 18, 2014 - 09:58
Location: Saint Sébastien sur Loire
Contact :

January 10, 2020 - 11:19

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
Denis Cardon - Tranquil IT
Share your experiences on WAPT! Send us your blog and article URLs in the "Your Opinion of the forum, and we'll feature them on the WAPT
Christophe0110
Messages: 53
Registration: June 11, 2019 - 12:04

January 13, 2020 - 09:22

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!
User avatar
vcardon
WAPT Expert
Messages: 278
Registration: Oct 06, 2017 - 10:55 p.m.
Location: Nantes, France

January 13, 2020 - 10:40

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
Vincent CARDON
Tranquil IT
Christophe0110
Messages: 53
Registration: June 11, 2019 - 12:04

January 13, 2020 - 1:02 PM

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...
Locked