#135162 - 2005-03-09 08:35 PM
Adding Values to the Registry
|
Anonymous
Anonymous
Unregistered
|
First, let me appologize for not being registered. I tried earlier, but to no avail. I'll have to try again later. I would also like to point out that I'm completely new to KiXTart. More to the point.
I've recently added two Microsoft SUS servers to my networks. They are both running on MS Windows 2000 Server on an NT 4.0 domain. I've added this bit of script to my current logon script to add the proper registry keys:
Code:
$key1 = AddKey("HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\AU")
If $key1 = 0
? "SUS registry key added!"
Endif
However, I've still yet to write the proper values to those keys. I understand that one needs administrative rights to add values to the registry. I already have the .reg files created, but I need a way to add them to the registry. So my question is, simply, how? I've read in other articles that you can refer them (other scripts) to "admin" scripts, but frankly, I don't no where to begin. Any help is appreciated.
USMCnerd
Edited by Howard Bullock (2005-03-09 10:37 PM)
|
|
Top
|
|
|
|
#135163 - 2005-03-09 08:56 PM
Re: Adding Values to the Registry
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11634
Loc: Space
|
Couple points.
1. If you're going to type in the UBB Code Tags they need to be in lower case not UPPER CASE to work.
2. What version of KiXtart are you using?
3. What is you're current issue? Your code to add the Key works fine. Do you want to know how to add the other keys and values with KiXtart or how to shell to regedit and import them?
Code:
Dim $Key Break On $Key = AddKey("HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate\AU") If $Key = 0 ? 'SUS registry key added!' Else ? 'SUS Key was not added. ' + @SERROR Endif
When I look the key is there.
|
|
Top
|
|
|
|
#135167 - 2005-03-09 09:55 PM
Re: Adding Values to the Registry
|
Bryce
KiX Supporter
   
Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
|
If adding the SUS server policy info by hand or logon script...
this is the reg file that i used for our remote peer to peer workstations that i could not get to using GPO.
Code:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate] "WUServer"="http://68.165.xx.xx" "WUStatusServer"="http://68.165.xx.xx"
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU] "NoAutoUpdate"=dword:00000000 "AUOptions"=dword:00000004 "ScheduledInstallDay"=dword:00000000 "ScheduledInstallTime"=dword:00000002 "UseWUServer"=dword:00000001 "RescheduleWaitTime"=dword:00000001 "NoAutoRebootWithLoggedOnUsers"=dword:00000000
|
|
Top
|
|
|
|
#135168 - 2005-03-09 09:56 PM
Re: Adding Values to the Registry
|
Anonymous
Anonymous
Unregistered
|
Sorry, I should have been more clear.
NTDOC: 1. Next time, I'll remember that. 2. v4.23 3. I'm able to create the subkeys. I need to add new values to them. Specifically, two REG_SZ values (to the WindowsUpdate Key) and one REG_DWORD value (to the WindowsUpdate\AU Key) . So I need to know how to add values to the subkeys themselves.
Maciep: Does that script add values to the subkeys? Does that script only need to be ran from one computer? You'll have to forgive me, I'm really new to scripting and programming.
USMCnerd
|
|
Top
|
|
|
|
#135169 - 2005-03-09 10:02 PM
Re: Adding Values to the Registry
|
Anonymous
Anonymous
Unregistered
|
To Bryce:
Those are pretty much the same values I'm trying to add, I just can't add them. Thus my dilemma.
USMCnerd
|
|
Top
|
|
|
|
#135171 - 2005-03-09 11:21 PM
Re: Adding Values to the Registry
|
Anonymous
Anonymous
Unregistered
|
Thanks. I'll check out the command reference some more and I'll give this a try. I'll post what happens either way.
USMCnerd
|
|
Top
|
|
|
|
#135172 - 2005-03-10 01:57 AM
Re: Adding Values to the Registry
|
Anonymous
Anonymous
Unregistered
|
Maciep,
No dice. I couldn't get it to enumerate the computers in my domain. I also tried running a script use WriteValue on my local computer. It created the subkeys but not the values.
USMCnerd
|
|
Top
|
|
|
|
#135174 - 2005-03-10 02:57 AM
Re: Adding Values to the Registry
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11634
Loc: Space
|
Not sure what you did. As Jens said, please post your script so we can see what might be going on.
I ran the script provided and it worked just fine for me.
Make sure you have KiXtart 4.22 and run this from a DOS console and it should print out the computers for you.
Code:
Break On $domain = getobject('WinNT://' + @domain) $domain.Filter = split('Computer') $Index = 0 for each $computer in $domain If $Computer ? ' ' + $Index + ' ' + $computer.Name $Index=$Index+1 EndIf Next
|
|
Top
|
|
|
|
#135175 - 2005-03-10 07:24 AM
Re: Adding Values to the Registry
|
Anonymous
Anonymous
Unregistered
|
Okay, I left for several hours, got some food, and some sleep. Came back and tried this:
Code:
Break On
$wuKey = '\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate' $auKey = '\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU'
$domain = getobject('WinNT://' + @domain) $domain.Filter = split('Computer') $Index = 0
for each $computer in $domain If $Computer writevalue('\\' + $computer.Name + $wuKey,'WUServer','http://31meushares','reg_sz') writevalue('\\' + $computer.Name + $wuKey,'WUStatusServer','http://31meushares','reg_sz') writevalue('\\' + $computer.Name + $auKey,'UseWUServer','1','reg_dword') ? ' ' + $Index + ' ' + $computer.Name $Index=$Index+1 endif
It worked like a charm. Honestly, I don't know what I did wrong before. I probably fat fingered something and was too tired to notice.
Many thanks are in order to you fellows. I couldn't have done this without your help. Thank you very much.
USMCnerd
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 1336 anonymous users online.
|
|
|