Page 1 of 1 1
Topic Options
#206084 - 2012-10-30 05:02 PM How to Add new value in registry
yellowdog Offline
Starting to like KiXtart

Registered: 2005-06-14
Posts: 102
Hello everybody,

I'm looking the command that would create a new value in a registry key.

I tried the following but nothing happens.

I wanted to create the value AUState (in the WindowsUpdate key) initialized to 0x00000002

 Code:
 WriteValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpda

te\AutoUpdate\","AUState","0x00000002","REG_DWORD")



Thanks for the answer.

Top
#206085 - 2012-10-30 06:33 PM Re: How to Add new value in registry [Re: yellowdog]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
nothing happens?
what is the error code?
normal users don't have permission to write to that key, you know?
_________________________
!

download KiXnet

Top
#206086 - 2012-10-30 08:31 PM Re: How to Add new value in registry [Re: Lonkero]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Dunno... maybe breaking over two lines is a problem or maybe trying to pass the string "0x00000002" instead of a value.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#206087 - 2012-10-30 10:06 PM Re: How to Add new value in registry [Re: Les]
ChristopheM Offline
Hey THIS is FUN
*****

Registered: 2002-05-13
Posts: 311
Loc: STRASBOURG, France
if you execute the script with administrator rights, try the following code :
 Code:
$regkey = "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\AutoUpdate"
$=WriteValue( $regkey, "AUState", 0x00000002, "REG_DWORD" )

If you write "0x00000002", this a string.
So when WriteValue convert it to integer because of REG_DWORD, the result is 0.
I don't think this is what you want.
_________________________
Christophe

Top
#206088 - 2012-10-30 10:34 PM Re: How to Add new value in registry [Re: ChristopheM]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4563
Loc: USA
Wouldn't it just be the number and not hex?

$regkey = "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\AutoUpdate"
$=WriteValue( $regkey, "AUState",2, "REG_DWORD" )

Top
#206089 - 2012-10-30 11:05 PM Re: How to Add new value in registry [Re: Allen]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
Also don't forget about $nul = SetOption("WOW64AlternateRegView","ON")...for 64 bit.
Top
#206090 - 2012-10-30 11:07 PM Re: How to Add new value in registry [Re: ShaneEP]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
The HKLM write did not work on my 64 bit laptop until I turned that on.
Top
#206091 - 2012-10-31 10:45 AM Re: How to Add new value in registry [Re: ShaneEP]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
The problem also lies in the "Auto Update" section of the registry key.
Take note that there is a space between Auto and Update.
And Allen is also right, just specify the value as "2".

Top
#206097 - 2012-11-01 07:29 AM Re: How to Add new value in registry [Re: Arend_]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11629
Loc: CA
Please try the following code and lets us know how it works for you.

 Code:
Break On
Dim $SO
$SO=SetOption('Explicit','On')
$SO=SetOption('NoVarsInStrings','On')
$SO=SetOption('WrapAtEOL','On')

Dim $Key, $WV
If @KiX < 4.63
 ? "You are running an unsupported version of KiXtart: " + @KiX
 Exit
EndIf

$Key = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update"
If @onwow64
  $SO=SetOption('WOW64AlternateRegView','On')
EndIf

$WV = WriteValue($Key,"AUOptions",2,"REG_DWORD")

? "Registry update return error value was: " +  @ERROR + " : " + @SERROR



Configure Automatic Updates using Registry Editor
 Quote:
Registry keys for configuring Automatic Updates

Registry entries that you can use to configure Automatic Updates by using Registry Editor are located in the following subkeys:

HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer

HKEY_LOCAL_MACHINE\SYSTEM\Internet Communication Management\Internet Communication

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\WindowsUpdate

HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\AU

How to configure automatic updates by using Group Policy or registry settings


Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 525 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.038 seconds in which 0.018 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org