• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 203
  • Last Modified:

I need help writing a login script to patch for the recent MS JScript Vulnerability

I need help writing a login script to patch for the recent MS JScript Vulnerability.  98/Me/NT4 machines run sample1.exe.  2000/XP runs sample2.exe.  So basically I need a batch that would identify the OS and apply the correct patch pertaining to the OS.  Since the patch requires a reboot is there any way to tell the batch that if the patch has been already been installed from a previous login do not run the rest of the batch.

Thanks any help would be greatly appreciated
Jay
0
jcallwood
Asked:
jcallwood
1 Solution
 
ryangormanCommented:
How To Determine The OS Type In A Logon Script
http://www.ultratech-llc.com/KB/?File=OSType.TXT

Note that this site has many related scripting articles.

You can determine if the script has perviously run by checking for a registery entry or file that is created by the script.

Try the following script

@echo off
if exist flag.txt goto Detected

:NotDetected
echo Script has not run before
echo y > flag.txt
goto end

:Detected
echo Previous run detected
echo deleting evidence
del flag.txt
goto End

:End
echo.
dir /b flag.txt
0
 
Christopher McKayMicrosoft Network AdministratorCommented:
Here's a batch file for determining what OS is on the system. Feel free to edit it and use it for your needs.

Batch file starts:

@ECHO OFF
VER|FIND "XP">NUL
IF NOT ERRORLEVEL 1 GOTO WinXP
VER|FIND "2000">NUL
IF NOT ERRORLEVEL 1 GOTO Win2K
VER|FIND "NT">NUL
IF NOT ERRORLEVEL 1 GOTO WinNT
VER|FIND "Mil">NUL
IF NOT ERRORLEVEL 1 GOTO WinME
VER|FIND "98">NUL
IF NOT ERRORLEVEL 1 GOTO Win98
VER|FIND "95">NUL
IF NOT ERRORLEVEL 1 GOTO Win95
GOTO BADOS

:WinXP
ECHO WinXP
GOTO END

:Win2K
ECHO Win2K
GOTO END

:WinNT
ECHO WinNT
GOTO END

:WinME
ECHO WinME
GOTO END

:Win98
ECHO Win98
GOTO END

:Win95
ECHO Win95
GOTO END

:BADOS
ECHO This OS is not supported
GOTO END

:END

Batch file ends

This combined with the recommendation by ryangorman will do what you desire.

Hope this helps!

:o)

Bartender_1
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now