Page 1 of 1 1
Topic Options
#135162 - 2005-03-09 08:35 PM Adding Values to the Registry
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 Offline
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
#135164 - 2005-03-09 08:57 PM Re: Adding Values to the Registry
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
I haven't tested it at all, but something like this should get you started

Code:

$auKey = '\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU'
$domain = getobject('WinNT://' + @domain)
$domain.Filter = split('Computer')
for each $computer in $domain
$ = addkey('\\' + $computer.Name + $auKey)
next

_________________________
Eric

Top
#135165 - 2005-03-09 09:17 PM Re: Adding Values to the Registry
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Wow, have not done SUS but is that how it's supposed to work?

A KEY not a subkey, or value for each system?

What if you have 50,000 computers? Seems like a heck of a lot of entries to hold in the registry in that manner.

Top
#135166 - 2005-03-09 09:31 PM Re: Adding Values to the Registry
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
I was just mimicking the original code but as an admin script. The WindowsUpdate key i believe contains values for your SUS Server(s). And the AU key contains values for other settings.

We have it deployed through AD...
_________________________
Eric

Top
#135167 - 2005-03-09 09:55 PM Re: Adding Values to the Registry
Bryce Offline
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
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
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
#135170 - 2005-03-09 10:36 PM Re: Adding Values to the Registry
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
No the above code will not write the values. Yes it is to be run from one machine. Check out the Command reference and the WriteValue function in particular

KiXtart Command Reference
WriteValue

I have commented out the WriteValue lines below since i haven't tested it. But the code should enumerate each computer in your domain and add those values to the registry. Does this make more sense?

Code:

$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')
for each $computer in $domain
? $computer.Name
;$ = writevalue('\\' + $computer.Name + $wuKey,'WUServer','http://68.165.xx.xx','reg_sz')
;$ = writevalue('\\' + $computer.Name + $wuKey,'WUStatusServer','http://68.165.xx.xx','reg_sz')
;$ = writevalue('\\' + $computer.Name + $auKey,'"NoAutoUpdate','0','reg_dword')
next



Edited by maciep (2005-03-09 10:37 PM)
_________________________
Eric

Top
#135171 - 2005-03-09 11:21 PM Re: Adding Values to the Registry
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
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
#135173 - 2005-03-10 02:23 AM Re: Adding Values to the Registry
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Show us your complete code and look into the UDF forum for various ways to generate a list of computers.
_________________________
There are two types of vessels, submarines and targets.

Top
#135174 - 2005-03-10 02:57 AM Re: Adding Values to the Registry
NTDOC Administrator Offline
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
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
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 1336 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.061 seconds in which 0.024 seconds were spent on a total of 12 queries. Zlib compression enabled.

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