#214224 - 2023-06-16 12:48 AM
WriteValue does not modify existing value but creates a duplicate one
|
fobrien
Just in Town
Registered: 2022-08-19
Posts: 3
Loc: France
|
Hello everybody,
I am posting this message as I am having some issues in order to modify an existing registry key in Windows using this code :
$rc=WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced","TaskbarAI","0","REG_DWORD")
Even in the great book by Bob Kelly, it is mentioned that such command is supposed to create/modify a value depending on the context.
I really do not understand the reason why I am having a duplicate key instead. At the moment, I am trying to make it work on a Windows 10 64 bits Operating System.
Would you have any idea ?
Thanks in advance for your help.
Fred
|
Top
|
|
|
|
#214232 - 2023-06-19 01:25 AM
Re: WriteValue does not modify existing value but creates a duplicate one
[Re: Glenn Barnas]
|
fobrien
Just in Town
Registered: 2022-08-19
Posts: 3
Loc: France
|
Hi Glenn !
Thank you for your reply and this advice. Unfortunaetely, the following code also creates a duplicate entry of the existing key already present in the system :
$Rc = SetOption('Explicit', 'On')
$Rc = SetOption('WrapAtEOL', 'On')
$Rc = SetOption('NoVarsInStrings', 'On')
$Rc = SetOption('NoMacrosInStrings', 'On')
$Rc = SetOption('WOW64AlternateRegView', 'Off')
$Rc = WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced","TaskbarAI","0","REG_DWORD")
Am I doing something wrong and is there another method to modify an existing registry key value ? Is it the best way by deleting the existing registry key first, then create it afterwards, for instance ?
Thanks in advance.
Fred
|
Top
|
|
|
|
#214235 - 2023-06-21 12:21 AM
Re: WriteValue does not modify existing value but creates a duplicate one
[Re: Glenn Barnas]
|
fobrien
Just in Town
Registered: 2022-08-19
Posts: 3
Loc: France
|
Hi Glen/Allen,
Thank you for our feedback and these tests. I feel shameful but I have eventually found what the issue was. Indeed, when checking the registry entry from a PowerShell Terminal (I am running Windows 11 Professional 64 Bits), then I noticed that the key name was mispelled and I got confused between a capital "I" and a lower case for letter "l". Therefore, correcting the key name dd the trick.
Image 1
Image 2
Sorry for this mistake anyway.
Fred
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 366 anonymous users online.
|
|
|