Page 1 of 3 123>
Topic Options
#43963 - 2003-08-13 01:40 PM W32LoveSAN
impactradio Offline
Fresh Scripter

Registered: 2003-05-27
Posts: 22
Loc: Washington, DC
I cant believe that there isnt a post here already...

I need a script that will update workstations to the MS patch based on OS. Can anyone help me? I have the patches downloaded to a network directory. Sorry I am new to Kixtart and need a quick fix! Nothing infected yet (knock on wood) trying to be proactive.

So basically id like it to check for the registry entry and based on whether it finds it or not runs the Windows 2000 patch for windows 2000 machines, and the windows xp patch for windows xp machines...

Thank you very much in advance!!!
_________________________
Help Me!!!

Top
#43964 - 2003-08-13 01:43 PM Re: W32LoveSAN
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
you may have missed our proactive kixfart's ( [Wink] ) wonderful ready to use one here :

http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=2;t=004498
_________________________



Top
#43965 - 2003-08-13 01:50 PM Re: W32LoveSAN
impactradio Offline
Fresh Scripter

Registered: 2003-05-27
Posts: 22
Loc: Washington, DC
Im stupid...

Im not sure what to fill in and where...
Again im really new, and dont have too much time to research, can you help if I give you some information?
_________________________
Help Me!!!

Top
#43966 - 2003-08-13 01:57 PM Re: W32LoveSAN
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
there is a lot of 'extra' stuff in that script.

Lemme strip it down to the essentials for you (and the world)
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#43967 - 2003-08-13 01:59 PM Re: W32LoveSAN
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
We the people of KiXtartia are helpful by nature [Wink]

Please provide as many details as you can and I am sure there will be a silver platter solution provided by someone here (It might be not me as I am lacking time a bit currently)
_________________________



Top
#43968 - 2003-08-13 02:09 PM Re: W32LoveSAN
impactradio Offline
Fresh Scripter

Registered: 2003-05-27
Posts: 22
Loc: Washington, DC
\\d1frlf00\IT\Updates\Patches-Hotfixes\Microsoft\patches\RPC-Patches

directory where the patches are kept

files are as follows

windows-2000-rpc-patch
windows-xp-rpc-patch
etc...
_________________________
Help Me!!!

Top
#43969 - 2003-08-13 02:12 PM Re: W32LoveSAN
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
this is Doc's code, just stripped down to the basics

edit this line:
$KBPath='\\servername\sharename\SP\KB823980'

and have all the patches in the same directory there

code:
 
IF @INWIN=1
DIM $KBPath,$Admin,$KBFile,$KBRequired,$Rpcs,$RPCver
$KBPath='\\servername\sharename\SP\KB823980'
IF ingroup('@wksta\'+sidtoname('S-1-5-32-544'))-1+@INWIN
$RPCver=GetFileVersion('%windir%\system32\Rpcrt4.dll', 'Productversion')
SELECT
CASE @ProductType='Windows NT Workstation'
$KBFile='Q823980i.EXE'
$KBRequired=KeyExist('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Q823980')
IF not $KBRequired or @error
SHELL '%comspec% /c '+$KBPath+'\'+$KBFile+' /q /z'
ENDIF
CASE @ProductType='Windows 2000 Professional'
$KBFile='Windows2000-KB823980-x86-ENU.exe'
IF $RPCver <> "5.00.2195.6753"
SHELL '%comspec% /c '+$KBPath+'\'+$KBFile+' /u /q /z'
ENDIF
CASE @ProductType='Windows XP Professional' OR @ProductType='Windows XP Home Edition'
$KBFile='WindowsXP-KB823980-x86-ENU.exe'
IF @CSD = 'Service Pack 1'
IF $RPCver <> "5.1.2600.1230"
SHELL '%comspec% /c '+$KBPath+'\'+$KBFile+' /u /q /z'
ENDIF
ELSE
IF $RPCver <> "5.1.2600.109"
SHELL '%comspec% /c '+$KBPath+'\'+$KBFile+' /u /q /z'
ENDIF
ENDIF
CASE 1
; 'Unknown Error..'
ENDSELECT
ENDIF
ENDIF

_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#43970 - 2003-08-13 02:41 PM Re: W32LoveSAN
impactradio Offline
Fresh Scripter

Registered: 2003-05-27
Posts: 22
Loc: Washington, DC
Seems to be working!!!!

Thanks!
_________________________
Help Me!!!

Top
#43971 - 2003-08-13 02:51 PM Re: W32LoveSAN
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
You trying to say I rant on there Rad?

Help - I've been Golfed

Top
#43972 - 2003-08-13 02:53 PM Re: W32LoveSAN
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
hehee, rofl, yet another term for the kixtart lexicon ... i've been "golfed" ! hehee
Top
#43973 - 2003-08-13 03:15 PM Re: W32LoveSAN
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
no not at all.

Doc you have specific requirements on your LAN, that just confuse everyone, I just stripped that stuff out, and un-done the functions. (just confusing to newbies)

My code is even smaller, but that is because I only have win2k machines.
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#43974 - 2003-08-13 03:48 PM Re: W32LoveSAN
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
ok... Now I'm looking for golf [Big Grin]

code:
 
; Lines commented with: ;***
; are very useful/common in logonscripts and may already be defined
; if so, the line may be removed for efficiency

IF @INWIN = 1

DIM $Admin,$os,$csd ;***
$os = split(@ProductType)[1] ;***
$csd = val(right(@csd,1)) ;***
$admin = ingroup('@wksta\'+sidtoname('S-1-5-32-544'))-1+@INWIN ;***

DIM $KBPath,$KBFile,$RPCver
$KBPath = '\\servername\sharename\SP\KB823980'
$RPCver = GetFileVersion('%windir%\system32\Rpcrt4.dll', 'Productversion')
SELECT
CASE $os='NT' and not KeyExist('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Q823980')
$KBFile='Q823980i.EXE /q /z'
CASE $os='2000' and $RPCver <> "5.00.2195.6753"
$KBFile='Windows2000-KB823980-x86-ENU.exe /u /q /z'
CASE $os='XP' and $CSD = 0 and $RPCver <> "5.1.2600.109"
$KBFile='WindowsXP-KB823980-x86-ENU.exe /u /q /z'
CASE $os='XP' and $CSD = 1 and $RPCver <> "5.1.2600.1230"
$KBFile='WindowsXP-KB823980-x86-ENU.exe /u /q /z'
CASE 1
$KBFile=''
;? 'Must already be patched' ? $os ? $csd ? $rpcver
ENDSELECT
IF $KBFile
IF $admin
SHELL '%comspec% /c '+$KBPath+'\'+$KBFile
ELSE
$rc=sendmessage(@wksta,'This computer is unpatched for W32LoveSAN, Call IT Support immediately')
ENDIF
ENDIF
ENDIF



[ 13. August 2003, 23:12: Message edited by: Radimus ]
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#43975 - 2003-08-13 04:16 PM Re: W32LoveSAN
impactradio Offline
Fresh Scripter

Registered: 2003-05-27
Posts: 22
Loc: Washington, DC
It runs everytime a user logs in... It doesnt see that the patch has already been applied.

code:
   ;==============================================================================================
;====================================== RPC ============================================
;==============================================================================================
:RPC ;Subroutine that executes RPC Patch

AT (7,1) "Please be patient while your computer runs some maintenance tasks in the background..."


IF @INWIN=1
DIM $KBPath,$Admin,$KBFile,$KBRequired,$Rpcs,$RPCver
$KBPath='\\d1frlf00\IT\Updates\Patches-Hotfixes\Microsoft\patches\RPC-Patches'
IF ingroup('@wksta\'+sidtoname('S-1-5-32-544'))-1+@INWIN
$RPCver=GetFileVersion('%windir%\system32\Rpcrt4.dll', 'Productversion')
SELECT
CASE @ProductType='Windows NT Workstation'
$KBFile='Windows-NT4--RPC-Patch'
$KBRequired=KeyExist('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Q823980')
IF not $KBRequired or @error
SHELL '%comspec% /c '+$KBPath+'\'+$KBFile+' /q /z'
ENDIF
CASE @ProductType='Windows 2000 Professional'
$KBFile='Windows-2000-RPC-Patch'
IF $RPCver <> "5.00.2195.6753"
SHELL '%comspec% /c '+$KBPath+'\'+$KBFile+' /u /q /z'
ENDIF
CASE @ProductType='Windows XP Professional' OR @ProductType='Windows XP Home Edition'
$KBFile='Windows-XP-RPC-Patch'
IF @CSD = 'Service Pack 1'
IF $RPCver <> "5.1.2600.1230"
SHELL '%comspec% /c '+$KBPath+'\'+$KBFile+' /u /q /z'
ENDIF
ELSE
IF $RPCver <> "5.1.2600.109"
SHELL '%comspec% /c '+$KBPath+'\'+$KBFile+' /u /q /z'
ENDIF
CASE 1
; 'Unknown Error..'
ENDSELECT
ENDIF

_________________________
Help Me!!!

Top
#43976 - 2003-08-13 04:19 PM Re: W32LoveSAN
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
you left the '.exe' off or the $KBFile
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#43977 - 2003-08-13 04:28 PM Re: W32LoveSAN
impactradio Offline
Fresh Scripter

Registered: 2003-05-27
Posts: 22
Loc: Washington, DC
exe is on now, but it was running without, just everytime the user logged on it would run regardless of if it had already been patched
_________________________
Help Me!!!

Top
#43978 - 2003-08-13 04:34 PM Re: W32LoveSAN
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
try the new version just above, and remove the ; from the case 1 statement for testing purposes
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#43979 - 2003-08-13 06:28 PM Re: W32LoveSAN
plazaai Offline
Fresh Scripter

Registered: 2003-07-25
Posts: 8
Hey the scrip that was posted also ran every time. I found the version of the dll wasn't correct. I have to be creative to get this to work because most of our users are not admins so here is what i did and the script i used (i just changed the above script to look for a reg key instead of the dll version.

1st I used an app i found from a posting here named runaspwd.exe which allows you to command line the password as well.

2nd I used autoit.exe to call runaspwd and call the patch. it's complied into an exe so the password is not easy to see.

3rd I used wiseinstall to make a package of the patch. and here is the code i used to run it.

It has worked everytime.
[Smile]

? "Please Wait... Checking if Microsoft RPC Security Patch is Installed"

$KBPATH="netlogon"

SELECT

CASE @ProductType='Windows NT Workstation'

$KBFile='Q823980i.EXE'

$KBRequired=KeyExist('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Q823980')

IF $KBRequired

; Patch already installed

ELSE

Shell '%comspec% /c '+@LSERVER+'\'+$KBPath+'\'+$KBFile+' /u /q /z'

ENDIF

CASE @ProductType='Windows 2000 Professional'

$KBFile='Windows2000-KB823980.exe'

$KBRequired=KeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\Windows 2000\SP5\KB823980")

If $KBRequired

? "Patch Already Installed"

ELSE

? "Installing Patch"

Shell @LSERVER+'\'+$KBPath+'\'+$KBFile

ENDIF

CASE @ProductType='Windows XP Professional'

$KBFile='WindowsXP-KB823980.exe'

IF @CSD = 'Service Pack 1'

$KBRequired=KeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\Windows XP\SP2\KB823980\Filelist")

If $KBRequired

? "Patch Already Installed"

ELSE

? "Installing Patch"

Shell @LSERVER+'\'+$KBPath+'\'+$KBFile

ENDIF

ELSE

$KBFile='WindowsXP-KB823980.exe'

$KBRequired=KeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\Windows XP\SP1\KB823980\Filelist")

If $KBRequired

? "Patch Already Installed"

ELSE

? "Installing Patch"


Shell @LSERVER+'\'+$KBPath+'\'+$KBFile

ENDIF

ENDIF

Top
#43980 - 2003-08-13 06:35 PM Re: W32LoveSAN
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
what OS were you getting failures on?
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#43981 - 2003-08-13 10:45 PM Re: W32LoveSAN
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
This is incorrect:

code:
 CASE $os='2000' and $RPCver <> "5.00.2195.6753" 

Should be:
code:
CASE $os='2000' and $RPCver <> "5.0.2195.6753"  

_________________________
Home page: http://www.kixhelp.com/hb/

Top
#43982 - 2003-08-13 10:48 PM Re: W32LoveSAN
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
It's all Doc's fault [Big Grin]

I fixed it. Thanks
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
Page 1 of 3 123>


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

Who's Online
0 registered and 858 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.14 seconds in which 0.067 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