Page 1 of 1 1
Topic Options
#122911 - 2004-07-14 06:11 PM SUS script for NT 4.0 enviornment
j95661 Offline
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
#122912 - 2004-07-15 05:29 AM Re: SUS script for NT 4.0 enviornment
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
A) This script requires administrative privileges to be successful
B) Why don't you use a admin script performing remote egistry edits to distribute the changes along the line sof
Code:

$comps=comnetview()
for each $comp in $comps
if not keyexist('\\'+$comp+'\HKLM\SOFTWARE...'
$rc=writevalue()
endif
next


Also, ADDKEY is normally unnecessary as WRITEVALUE will add the keys as well if missing.
_________________________
There are two types of vessels, submarines and targets.

Top
#122913 - 2004-07-16 07:06 AM Re: SUS script for NT 4.0 enviornment
j95661 Offline
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
#122914 - 2004-07-17 11:08 AM Re: SUS script for NT 4.0 enviornment
ChristopheM Offline
Hey THIS is FUN
*****

Registered: 2002-05-13
Posts: 311
Loc: STRASBOURG, France
Why are you talking about NT 4 environnement ?
SUS is only for Windows 2000, 2003 and XP.

is it because your domain is NT 4 so that you can't use W2K policies ?
_________________________
Christophe

Top
#122915 - 2004-07-20 04:31 PM Re: SUS script for NT 4.0 enviornment
TheButcher Offline
Lurker

Registered: 2004-07-20
Posts: 1
Loc: Nantes, France
I use NT4 policy (poledit) with wuau.adm for SUS in NT4 domain.
you can download it at http://www.microsoft.com/downloads/details.aspx?FamilyId=D26A0AEA-D274-42E6-8025-8C667B4C94E9&displaylang=en

Top
#122916 - 2005-04-11 05:09 PM Re: SUS script for NT 4.0 enviornment
Adrian_Kong Offline
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 Offline
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
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#122918 - 2005-04-16 02:19 AM Re: SUS script for NT 4.0 enviornment
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Actually, in order to modify the Policies subkeys you have to be an Administrator. Then again, in order to remotely change the registry, you have to be a admin anyway.
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 1 1


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

Who's Online
0 registered and 657 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.047 seconds in which 0.022 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