#122911 - 2004-07-14 06:11 PM
SUS script for NT 4.0 enviornment
|
j95661
Getting the hang of it
Registered: 2001-02-27
Posts: 84
Loc: sacramento,ca usa
|
Here is a script I wrote for our environment. Yes I know "your still running NT 4.0". Well I thought this might help some folks out there that are still pushing settings the old fashioned way.
Jason
Code:
;=============================================================================================== ;***** Created with KiXscripts Editor | http://KiXscripts.com ***** ;***** Last Modified on 7/14/2004 at 8:52:02 AM by SS_Hammond *****
;=============================================================================================== SetConsole("hide") Break OFF Global $KeyVal, $SP
$WUServer = "http://SUSSERVER" $WUStatusServer = "http://SUSSERVER"
$NeedsClient = "YES" $Temp = "%temp%" $SusClient = "NO"
If @INWIN = 1 If @PRODUCTTYPE = "Windows 2000 Professional" OR @PRODUCTTYPE = "Windows XP Professional" Dim $KeyLoc, $KeyNam $KeyLoc = "HKLM\Software\Microsoft\Windows NT\CurrentVersion" $SP = ReadValue($KeyLoc, "CSDVersion") If @PRODUCTTYPE = "Windows 2000 Professional" Select Case $SP = "Service Pack 3" $SusClient = "YES" Case $SP = "Service Pack 4" $SusClient = "YES" ; Client does not meet requirements ; needs Service Pack 3 or Higher. Case $SP = "Service Pack 2" $SusClient = "NO" Case $SP = "Service Pack 1" $SusClient = "NO" Case 1 $SusClient = "NO" EndSelect EndIf If @PRODUCTTYPE = "Windows XP Professional" If $SP = "Service Pack 1" $SusClient = "YES" EndIf EndIf EndIf EndIf
If $SusClient = "YES" $KeyLoc = "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" $RC = KeyExist($KeyLoc) If $RC = 0 $RC = AddKey($KeyLoc) EndIf $KeyLoc = "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" $RC = KeyExist($KeyLoc) If $RC = 0 $RC = AddKey($KeyLoc) EndIf $KeyLoc = "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" $KeyNam = "WUServer" $KeyVal = $WUServer $RegVal = ReadValue($KeyLoc,$KeyNam) If @ERROR = 0 If NOT $RegVal = $KeyVal $RC = WriteValue($Keyloc,$KeyNam,$KeyVal,"REG_SZ") EndIf Else $RC = WriteValue($Keyloc,$KeyNam,$KeyVal,"REG_SZ") EndIf $KeyNam = "WUStatusServer" $KeyVal = $WUStatusServer $RegVal = ReadValue($KeyLoc,$KeyNam) If @ERROR = 0 If NOT $RegVal = $KeyVal $RC = WriteValue($Keyloc,$KeyNam,$KeyVal,"REG_SZ") EndIf Else $RC = WriteValue($Keyloc,$KeyNam,$KeyVal,"REG_SZ") EndIf $KeyLoc = "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" $KeyNam = "RescheduleWaitTime" $WriVal = "00000001" $KeyVal = "1" $RegVal = ReadValue($KeyLoc,$KeyNam) If @ERROR = 0 If $RegVal <> $KeyVal $RC = WriteValue($Keyloc,$KeyNam,$WriVal,"REG_DWORD") EndIf Else $RC = WriteValue($Keyloc,$KeyNam,$WriVal,"REG_DWORD") EndIf $KeyNam = "NoAutoRebootWithLoggedOnUsers" $WriVal = "00000001" $keyVal = "0" $RegVal = ReadValue($KeyLoc,$KeyNam) If @ERROR = 0 If $RegVal <> $KeyVal $RC = WriteValue($Keyloc,$KeyNam,$WriVal,"REG_DWORD") EndIf Else $RC = WriteValue($Keyloc,$KeyNam,$WriVal,"REG_DWORD") EndIf $KeyNam = "NoAutoUpdate" $WriVal = "00000000" $KeyVal = "0" $RegVal = ReadValue($KeyLoc,$KeyNam) If @ERROR = 0 If $RegVal <> $KeyVal $RC = WriteValue($Keyloc,$KeyNam,$WriVal,"REG_DWORD") EndIf Else $RC = WriteValue($Keyloc,$KeyNam,$WriVal,"REG_DWORD") EndIf $KeyNam = "AUOptions" $WriVal = "00000004" $KeyVal = "4" $RegVal = ReadValue($KeyLoc,$KeyNam) If @ERROR = 0 If $RegVal <> $KeyVal $RC = WriteValue($Keyloc,$KeyNam,$WriVal,"REG_DWORD") EndIf Else $RC = WriteValue($Keyloc,$KeyNam,$WriVal,"REG_DWORD") EndIf $KeyNam = "ScheduledInstallDay" $WriVal = "00000000" $KeyVal = "0" $RegVal = ReadValue($KeyLoc,$KeyNam) If @ERROR = 0 If $RegVal <> $keyVal $RC = WriteValue($Keyloc,$KeyNam,$WriVal,"REG_DWORD") EndIf Else $RC = WriteValue($Keyloc,$KeyNam,$WriVal,"REG_DWORD") EndIf $KeyNam = "ScheduledInstallTime" $WriVal = "00000000" $KeyVal = "0" $RegVal = ReadValue($KeyLoc,$KeyNam) If @ERROR = 0 If $RegVal <> $KeyVal $RC = WriteValue($Keyloc,$KeyNam,$WriVal,"REG_DWORD") EndIf Else $RC = WriteValue($Keyloc,$KeyNam,$WriVal,"REG_DWORD") EndIf $KeyNam = "UseWUServer" $WriVal = "00000001" $KeyVal = "1" $RegVal = ReadValue($KeyLoc,$KeyNam) If @ERROR = 0 If $RegVal <> $KeyVal $RC = WriteValue($Keyloc,$KeyNam,$WriVal,"REG_DWORD") EndIf Else $RC = WriteValue($Keyloc,$KeyNam,$WriVal,"REG_DWORD") EndIf Shell '%COMSPEC% /C net stop "automatic updates"' Shell '%COMSPEC% /C net start "automatic updates"' EndIf
_________________________
WonderBoy
Constantly learning everyday, how much I dont know :-)
|
|
Top
|
|
|
|
#122913 - 2004-07-16 07:06 AM
Re: SUS script for NT 4.0 enviornment
|
j95661
Getting the hang of it
Registered: 2001-02-27
Posts: 84
Loc: sacramento,ca usa
|
I am actually distributing this with SMS 2.0, that’s how I am insuring local Administrative rights. Currently our environment has over 4,000 plus machines distributed all across the country so I chose SMS to handle this task.
Thanks for the info regarding WRITEVALUE..
_________________________
WonderBoy
Constantly learning everyday, how much I dont know :-)
|
|
Top
|
|
|
|
#122915 - 2004-07-20 04:31 PM
Re: SUS script for NT 4.0 enviornment
|
TheButcher
Lurker
Registered: 2004-07-20
Posts: 1
Loc: Nantes, France
|
|
|
Top
|
|
|
|
#122916 - 2005-04-11 05:09 PM
Re: SUS script for NT 4.0 enviornment
|
Adrian_Kong
Lurker
Registered: 2005-04-11
Posts: 1
|
Hi
Hi
Below is what is need to be inport into the registry settings. I wonder is there any good way to write this key into the registy of W2K client and XP client with NT 4.0 domain. Is there a possibility to do a check for existing entries first before wirting into the registry again.
---------------------------------------- Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate] "WUServer"="http://10.0.0.1" "WUStatusServer"="http://10.0.0.1"
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU] "RescheduleWaitTime"=dword:00000001 "NoAutoRebootWithLoggedOnUsers"=dword:00000001 "NoAutoUpdate"=dword:00000000 "AUOptions"=dword:00000004 "ScheduledInstallDay"=dword:00000000 "ScheduledInstallTime"=dword:00000012 "UseWUServer"=dword:00000001 ------------------------------
Thanks
Adrian
|
|
Top
|
|
|
|
#122917 - 2005-04-12 12:17 AM
Re: SUS script for NT 4.0 enviornment
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Adrian,
What are you looking for? Rather than dredging up an old thread, you should start your own.
If you need to add values to the Registry, you should use WRITEVALUE. The only caveat to that is that you have to be an Power User or better on the box.
Kent
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 657 anonymous users online.
|
|
|