We have a very important implementation some new software this week. I created a script to install the software and it creates a log file in a network directory. The script checks this log file in order to prevent the software from installing again if the initial installation was successful. The installation requires a reboot and the user is prompted to do so. It works on all XP machines. But on the 2K machines I think PC is rebooted before the log file is created.

Here it goes. Any help will be appreciated. I'm fairly new to kixtart.

;If WIN9X then exit

IF @INWIN <> 1

goto END

EndIf

;Test for Server (DO not run on servers)
;Determine that client is a workstation and not a server using the 2003 gettype
;Checks errorlevel. ON 2K 1 = Windows NT Workstation, 2 = Windows 2000 Professional.
;On 2K3 or XP 1 = Home Edition, 2 = Professional. 3 and up = Server types, So will run on 1 or 2 only.

SHELL @LDRIVE + "\gettype.exe /type"
$os_type = @ERROR
;MESSAGEBOX ("$os_type","OS-TYPE",64) ;Test window to see value
IF $os_type=1 OR $os_type=2

goto MAKDIR
EndIf

goto END

:MAKDIR
$directory ="%SystemDrive%\Program Files\Hummingbird\DM Extensions"
$OK_DLL_logfile = "R:\printer\hummingbird\dm_install\@WKSTA_DLL.txt"
$ERR_DLL_logfile = "R:\printer\hummingbird\dm_install\ERR_@WKSTA_DLL.txt"
$DateTime = "@DATE @TIME"
$dmcode = ""
$SleepTime = 40

;Check to see if Hummingbird DM has already run on this machine
if exist("\\filer-lan\data\printer\hummingbird\dm_install\@WKSTA_DLL.txt")
goto END
EndIF

;If the folder C:\Program Files\Hummingbird\DM Extensions does not exist
if not exist ($directory)
;Create it
MD ("%SystemDrive%\Program Files\Hummingbird")
MD ("%SystemDrive%\Program Files\Hummingbird\DM Extensions")
goto DM_COPY
EndIF

M_COPY
copy "\\filer-lan\data\printer\hummingbird\DMLookup.dll" "$directory\DMLookup.dll"
copy "\\filer-lan\data\printer\hummingbird\DMLookup.reg" "$directory\DMLookup.reg"
copy "\\filer-lan\data\printer\hummingbird\DMLookup.bat" "$directory\DMLookup.bat"
$dmcode = @ERROR
If $dmcode <> 0
goto DM_DLL_ERR
EndIf



LL_OK
;Write to logfile if the intallation was OK and END
WRITEPROFILESTRING("$OK_DLL_logfile","$DateTime","@USERID","APA_PROD.bat Return Code = 0")
goto RUNBAT


:RUNBAT
$OK_logfile = "R:\printer\hummingbird\dm_install\@WKSTA_DM.txt"
$ERR_logfile = "R:\printer\hummingbird\dm_install\ERR_@WKSTA_DM.txt"
$DateTime = "@DATE @TIME"
$dmcode = ""
$SleepTime = 40

;Check to see if Hummingbird DM has already run on this machine
if exist("\\filer-lan\data\printer\hummingbird\dm_install\@WKSTA_DM.txt")
goto END
EndIF

;Run the DM Install
? "Running Hummingbird DM Install (APA MIS Dept)...."
SHELL "\\filer-lan\data\printer\hummingbird\APA_PROD.bat"
$dmcode = @ERROR
If $dmcode <> 0
goto DM_ERR
EndIf

M_OK
;Write to logfile if the intallation was OK and END

WRITEPROFILESTRING("$OK_logfile","$DateTime","@USERID","APA_PROD.bat Return Code = 0")
goto END

M_ERR
;Write to log file if the services were not installed in the time allowed
WRITEPROFILESTRING("$ERR_logfile","$DateTime","@USERID","APA_PROD.bat Return Code = $dmcode")

M_DLL_ERR
;Write to log file if the dll was not copied in the time allowed
WRITEPROFILESTRING("$ERR_DLL_logfile","$DateTime","@USERID","dmlookup.bat Return Code = $dmcode")

:END