Page 1 of 1 1
Topic Options
#123375 - 2004-07-20 07:33 PM Suggestions for SUS script
pgoss Offline
Fresh Scripter

Registered: 2004-05-12
Posts: 5

I am extremely new to KiXtart so please go easy on me. My current script looks like this
Code:
CLS
;REM MAP DRIVE FOR J & K & O drive mapping
IF INGROUP ("Domain\Domain Users")
USE K: /DELETE /PERSISTENT
USE K: "\\Server\Share1" /PERSISTENT
USE J: /DELETE /PERSISTENT
USE J: "\\Server\Share2" /PERSISTENT
USE o: /DELETE /PERSISTENT
USE o: "\\Server\Share3" /PERSISTENT
ENDIF

EXIT


Obviously this is very basic, now I have been asked to include a reg file that will create the correct entries for our SUS server. I feel it would be faster/easier to include the reg entries with in the kix script instead of making an external call. Only problem, I really have no idea where to begin. Does anyone have any basic scripts that I use as a template?

thanks

Top
#123376 - 2004-07-20 07:44 PM Re: Suggestions for SUS script
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
A couple of questions...

Is this a multi-domain network, or would not basically everybody be in "Domain\Domain Users" negating the need for InGroup()?

Why do you map drives as persistent if they get remapped on every logon?

How many reg entries are in your reg merge file? It basically boils down to numbers whether or not to hand code every line in the reg merge file into KiX code. Take a look in the manual for WriteValue().
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#123377 - 2004-07-20 07:53 PM Re: Suggestions for SUS script
pgoss Offline
Fresh Scripter

Registered: 2004-05-12
Posts: 5
Quote:

Is this a multi-domain network, or would not basically everybody be in "Domain\Domain Users" negating the need for InGroup()?




This is a single domain, but I do have two groups for the SUS testing. I have a test group and then I have everyone else. I only need for the reg entries to get placed in there once but I do need two different SUS server locations.
Quote:

Why do you map drives as persistent if they get remapped on every logon?



I inherited the script from the previous admin so I just left it alone. I prefer vbs and already have the scripts created there for a manual run but I figure I can always use more knowledge on general scripting.
Quote:

How many reg entries are in your reg merge file? It basically boils down to numbers whether or not to hand code every line in the reg merge file into KiX code



Not that many, somewhere in the nieghborhood of 6 entries. I will take a look at the writevalue info

thanks


Edited by pgoss (2004-07-20 07:55 PM)

Top
#123378 - 2004-07-21 03:45 AM Re: Suggestions for SUS script
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Use an admin script to deploy the registry changes via remote registry writes. Prototype:
Code:

$comps=comnetview()
for each $comp in $comps
$rc=writevalue('HKLM\SOFTWARE\...)
next


However, if you have AD, then you should rather use GPOs for this.

Finally, writing to HKLM or the Policies subkeys requires admin privs.
_________________________
There are two types of vessels, submarines and targets.

Top
#123379 - 2004-07-29 02:07 AM Re: Suggestions for SUS script
rhodwyn Offline
Lurker

Registered: 2004-07-29
Posts: 1
We use something very much like this in our environment. I've taken a code snippet from our function file and login scripts. Inside the InstallSUS function are comments to indicate time of day, what to do etc. I altered slightly
from our environment so make sure you test before deployment!

All the registry information comes from SUS deployment white paper at Microsoft. Adapt for your needs.
Code:

;This part would go in the regular section of your login
;script.
Select
Case InGroup("FirstGroup") ; First AD group pointing to SUS 1
InstallSUS("YourFirstSUSServer") ; SUS server 1 no HTTP://
Case InGroup("SecondGroup") ; Second AD group pointing to SUS 2
InstallSUS("YourSecondSUSServer") ; SUS server 2, no HTTP://
Case 1
?"No SUS configuration for this group."
EndSelect

;Here to the end you can put at the end of your script
; or you can put it into a separate file and use 'call'
; command to load it before script processing. This
; part actually does all the work.
Function InstallSUS($LOCALSUS)
$SUSCONFIG=ReadValue("HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate",
"WUServer"
)

If $SUSCONFIG="http://$LOCALSUS/"
?"SUS is already configured at server $LOCALSUS."
Else
?"Setting up SUS for your computer."
?"Your SUS server is $LOCALSUS."
?"Stopping Windows Update Service"
Shell "%COMSPEC% /e:1024 /c net stop wuauserv"
?"Writing parameter values."
AddKey("hkey_local_machine\software\policies\microsoft\windows\windowsupdate")
AddKey("hkey_local_machine\software\policies\microsoft\windows\windowsupdate\au")
$NUL=WriteValue("hkey_local_machine\software\policies\microsoft\windows\windowsupdate\au",
"RescheduleWaitTime",
"00000005",
"REG_DWORD"
)

$NUL=WriteValue("hkey_local_machine\software\policies\microsoft\windows\windowsupdate\au",
"NoAutoRebootWithLoggedOnUsers",
"1",
"REG_DWORD"
)

$NUL=WriteValue("hkey_local_machine\software\policies\microsoft\windows\windowsupdate\au",
"NoAutoUpdate",
"00000000",
"REG_DWORD"
)

; Automatically download AND install updates
$NUL=WriteValue("hkey_local_machine\software\policies\microsoft\windows\windowsupdate\au",
"AUOptions",
"00000004",
"REG_DWORD"
)
; Deploy every day
$NUL=WriteValue("hkey_local_machine\software\policies\microsoft\windows\windowsupdate\au",
"ScheduledInstallDay",
"00000000",
"REG_DWORD"
)
; Install time 13:00
$NUL=WriteValue("hkey_local_machine\software\policies\microsoft\windows\windowsupdate\au",
"ScheduledInstallTime",
"0000000d",
"REG_DWORD"
)
$NUL=WriteValue("hkey_local_machine\software\policies\microsoft\windows\windowsupdate\au",
"UseWUServer",
"00000001",
"REG_DWORD"
)
$NUL=WriteValue("HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate",
"WUServer",
"http://$LOCALSUS/",
"REG_SZ"
)
$NUL=WriteValue("HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate",
"WUStatusServer",
"http://$LOCALSUS/",
"REG_SZ"
)
$WUAUSERV=ReadValue("hkey_local_machine\system\CurrentControlSet\Services\wuauserv",
"Start"
)
If $WUAUSERV="2"
?"Automatic Updates already set to start Automatically."
Else
$NUL=WriteValue("hkey_local_machine\system\CurrentControlSet\Services\wuauserv",
"Start",
"2",
"REG_DWORD"
)
EndIf
?"Restarting Windows Update Service."
Shell "%COMSPEC% /e:1024 /c net start wuauserv"
EndIf
EndFunction


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
1 registered (Henriques) and 2516 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.062 seconds in which 0.032 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