Script(s):Part1 (executes from login script(in this case test environment):
goto "MAIN"
:MAIN
$CaptureError=SETCONSOLE("HIDE")
$CaptureError=SETCONSOLE("MINIMIZE")
$CaptureError=SETCONSOLE("ALWAYSONTOP")
; ******** Do NOT include the section below in the production script *********
$Selection = MESSAGEBOX ("Please note that the login script currently executing is the test environment. The script executed is TEST.KIX. Do you wish to continue?", "TEST Warning", 292)
If $Selection = 6
? "Yes selected, executing script...."
Endif
If $Selection = 7
? "No selected, script will not be executed...."
goto "END"
Endif
; ******** Do NOT include the section above in the production script *********
goto "ITEM4"
; ****************************************************************************
; Start Service Pack 5 deployment (ITEM4)
; ****************************************************************************
:ITEM4
$SPLEVEL = ReadValue( "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion" , "CSDVersion" )
;IF $SPLEVEL = "Service Pack 5"
IF $SPLEVEL = "Service Pack 6"
OR $SPLEVEL = "Service Pack 6a"
OR $SPLEVEL = "Service Pack 7"
GOTO "ENDSP5"
ENDIF
? @SERROR
GOTO "DISKSPACE"
ISKSPACE
$DISKSPACE = GETDISKSPACE ( "C:\" )
IF $DISKSPACE < 300000 GOTO "SHORTSPACE"
ENDIF
GOTO "SP5NOTIFY"
:SHORTSPACE
Messagebox ("Please note that your system is running low on diskspace. For " + CHR(10) + "optimum performance it is required that you have at least" + CHR(10) + "350Mb of free diskspace." + CHR(10) + CHR(10) + "Please feel free to contact the Helpdesk at " + CHR(10) + "extension: xxxx if you need any assistance.", "Short on diskspace", 48)
GOTO "ENDSP5"
:SP5NOTIFY
Messagebox ("Please note that the Windows NT Service Pack on this system will be" + CHR(10) + "upgraded to Windows NT Service Pack 5 in order to meet Year 2000" + CHR(10) + "compliancy." + CHR(10) + "Please do NOT use this computer untill it is completly finished, " + CHR(10) + "otherwise your system may get irrepairable damaged. This computer" + CHR(10) + "will be automatically rebooted during this process." + CHR(10) + CHR(10) + "This computer will be ready for usage again when the logon screen is " + CHR(10) + "visible again for at least 5 minutes." + CHR(10) + CHR(10) + "Thank you kindly for your patience.", "Service Pack 5 installation notification", 48)
GOTO "AUTOLOGON"
:AUTOLOGON
DELVALUE ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "LegalNoticeCaption" )
? @SERROR
DELVALUE ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "LegalNoticeText" )
? @SERROR
WRITEVALUE ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DontDisplayLastUserName", "0", "REG_SZ" )
? @SERROR
WRITEVALUE ( "HKEY_LOCAL_MACHINE\SOFTWARE\Novell\NWGINA\Login Screen", "DefaultNetWareUserName", "localadminaccount", "REG_SZ" )
? @SERROR
WRITEVALUE ( "HKEY_LOCAL_MACHINE\SOFTWARE\Novell\NWGINA\Login Screen", "DefaultNetWarePassword", "password", "REG_SZ" )
? @SERROR
WRITEVALUE ( "HKEY_LOCAL_MACHINE\SOFTWARE\Novell\NWGINA\Login Screen", "NetWareAutoAdminLogon", "1", "REG_SZ" )
? @SERROR
WRITEVALUE ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultDomainName", "DOMAIN-NT1", "REG_SZ" )
? @SERROR
WRITEVALUE ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultUserName", "localadminaccount", "REG_SZ" )
? @SERROR
WRITEVALUE ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultPassword", "password", "REG_SZ" )
? @SERROR
WRITEVALUE ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "AutoAdminLogon", "1", "REG_SZ" )
? @SERROR
WRITEVALUE ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce", "SP5Install", "\\SERVER01\Netlogon\Kix32 \\SERVER01\Netlogon\SP5.kix", "REG_SZ" )
? @SERROR
GOTO "SP5START"
:SP5START
SLEEP 5
SHELL "%COMSPEC% /e:1024 /c copy \\SERVER01\netlogon\reboot.kix c:\temp"
? @SERROR
SLEEP 5
RUN "\\SERVER01\Netlogon\kix32 c:\temp\reboot.kix"
? @SERROR
GOTO "ENDSP5"
:ENDSP5
GOTO "ITEM5"
; ****************************************************************************
; End Service Pack 5 deployment (ITEM4)
; ****************************************************************************
---> Script Part 2 (SP5.kix)
GOTO "MAIN"
:MAIN
$CaptureError=SETCONSOLE("HIDE")
$CaptureError=SETCONSOLE("MINIMIZE")
$CaptureError=SETCONSOLE("ALWAYSONTOP")
GOTO "CONNECT"
:CONNECT
USE X: "\\SERVER06\SP5$"
? @SERROR
Sleep 5
GOTO "PREPARE"
:PREPARE
WRITEVALUE ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce", "999.PostSP5Install", "\\SERVER01\Netlogon\Kix32 \\SERVER01\Netlogon\PostSP5.kix", "REG_SZ" )
? @SERROR
GOTO "UNPACK"
:UNPACK
;SHELL "X:\SP5I386.EXE /X:c:\winnt\options\sp5 -u -o"
Sleep 30
GOTO "DEPLOY"
EPLOY
;RUN "C:\Winnt\options\SP5\update\update.exe -f -n -u -o"
GOTO "END"
:END
exit
-----> Script Part 3 (PostSP5.kix)
GOTO "MAIN"
:MAIN
$CaptureError=SETCONSOLE("HIDE")
$CaptureError=SETCONSOLE("MINIMIZE")
$CaptureError=SETCONSOLE("ALWAYSONTOP")
GOTO "CLEANREG"
:CLEANREG
WRITEVALUE ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "LegalNoticeCaption", "Legal Counsel Notice", "REG_SZ" )
? @SERROR
WRITEVALUE ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "LegalNoticeText", "Bla bla you are under arrest!", "REG_SZ" )
? @SERROR
DELVALUE ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultPassword" )
? @SERROR
DELVALUE ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "AutoAdminLogon" )
? @SERROR
DELVALUE ( "HKEY_LOCAL_MACHINE\SOFTWARE\Novell\NWGINA\Login Screen", "DefaultNetWarePassword" )
? @SERROR
DELVALUE ( "HKEY_LOCAL_MACHINE\SOFTWARE\Novell\NWGINA\Login Screen", "NetWareAutoAdminLogon" )
? @SERROR
WRITEVALUE ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultUserName", "", "REG_SZ" )
? @SERROR
WRITEVALUE ( "HKEY_LOCAL_MACHINE\SOFTWARE\Novell\NWGINA\Login Screen", "DefaultNetWareUserName", "", "REG_SZ" )
? @SERROR
WRITEVALUE ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DontDisplayLastUserName", "1", "REG_SZ" )
? @SERROR
GOTO "CLEANLOCAL"
:CLEANLOCAL
WRITEVALUE ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce", "SP5Install", "CMD /C del c:\temp\reboot.kix /q", "REG_SZ" )
? @SERROR
GOTO "SP5SUCCES"
:SP5SUCCES
WRITEVALUE ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce", "998.SP5Finished", "Notepad.exe \\SERVER01\Netlogon\SP5Installed.txt", "REG_SZ" )
? @SERROR
GOTO "SP5FINISH"
:SP5FINISH
SLEEP 90
RUN "\\SERVER01\Netlogon\kix32 c:\temp\reboot.kix"
GOTO "END"
:END
exit
-----> Reboot script
Sleep 5
SHUTDOWN ("", "Your system is being rebooted to start Service Pack 5 installation procedure", 0, 1, 1)