Registry running state
By default, when WPKG runs, it changes a registry entry in HKLM\Software\WPKG to indicate the WPKG state to other programs (like logon scripts, which can inform you that the WPKG service is installing software and you should hold on a while).
This can be turned off (it's on by default) by passing /norunningstate to wpkg.js.
HKLM\Software\WPKG\running can be "true" (REG_SZ) or "false".
This feature was introduced in WPKG 0.9.8.
The following logon.vbs logon script can be used to take advantage of this feature:
'========================================================================== ' ' NAME: Logon.vbs ' DESC: Logon to a given Windows network, connecting network drives ' printers and creating shortcuts. ' ' AUTHOR: Andre Ilie ' DATE : 5/10/2005 ' '========================================================================== Option Explicit 'ON ERROR RESUME NEXT Dim WSHShell Dim Path Dim IEWin Dim sStatus ' full path of the script like dirname() path = WScript.ScriptFullName path = Left(path, InstrRev(path, "\")) ' registry constants (should be the same like in WPKG.js) const WPKG_RUNNING = "HKLM\Software\WPKG\running" ' progress window constants const MAX_LINE_LEN = 20 const MAX_LINES = 9 const IE_READY = 4 const EXITDELAY = 5000 ' wait 5 secs until closing ' *** COMMON OBJECTS *** Set WSHShell = CreateObject("WScript.Shell") Set IEWin = WScript.CreateObject("InternetExplorer.Application") ' set environment variables ' *** MAIN *** ' UI setup, needs to be done first to allow viewing messages CreateIE() ' Wait For WPKG to complete work WaitForWPKG() CleanExit() ' **** END OF PROGRAM **** ' **** FUNCTIONS **** 'Quit the Script only if not in DEBUG mode sub CleanExit() on error resume next LogMsg("Logon done. Have fun.") Wscript.sleep EXITDELAY ' delay till the user is happy IEWin.quit ' quit Internet Explorer Window wscript.quit ' not needed for IE-Quit event End sub ' clear an error Sub ErrorClear() if Err <> 0 then 'wscript.echo "ERROR: " & Err.Description Err.Clear End If End SUB ' clear LogMsg buffer SUB ClearLogMsg() on error resume next ' don't complain if eventlog is full sStatus = "" IEWin.Document.All.status_msg.innerText = sStatus ErrorClear() End Sub ' just adds the message without CRLF SUB AddLogMsg(msg) on error resume next ' don't complain if eventlog is full sStatus = sStatus & msg IEWin.Document.All.status_msg.innerText = sStatus ErrorClear() End Sub SUB LogMsg (msg) on error resume next ' don't complain if eventlog is full sStatus = sStatus & vbCRLF & msg IEWin.Document.All.status_msg.innerText = sStatus ErrorClear() End SUB ' wait for Windows Packager to complete the work Sub WaitForWPKG() dim regval dim loopcount dim progresscount ' check for key existence to avoid error LogMsg "Updating your system " if RegKeyExists(WPKG_RUNNING) then do regval = WSHShell.RegRead(WPKG_RUNNING) if regval = "true" then ' clear window if full if progresscount = MAX_LINE_LEN * MAX_LINES then ClearLogMsg() progresscount = 0 else progresscount = progresscount + 1 End If ' don't forget the space or it will be not wrapped ' when shown in IE.Window AddLogMsg ". " ' needs to be 1s as we are counting time here also Wscript.sleep 1000 End If Loop until regval = "false" ' flush the screen ClearLogMsg() End If End Sub Function RegKeyExists(keyname) on error resume next dim ret dim regval regval = WSHShell.RegRead(keyname) ' use error object to see if RegKey is there or not if Err <> 0 then ret = false else ret = true end if Err.Clear RegKeyExists = ret End Function ' PRETTY OUTPUT FUNCTIONS SUB CreateIE() ' MS IE windows is invisible, we need only the dialog 'IEWin.navigate "about:blank" ' empty document ' Important: Wait till MSIE is ready On Error Resume Next ' without this error will occure randomly With IEWin .navigate path + "logon.html" Do until .ReadyState = IE_READY Wscript.sleep 200 Loop .height=230 .width=300 .resizable=0 ' no resize button .Document.Body.Scroll = "no" ' no scroll bars .menubar=0 .toolbar=0 .statusBar=0 .AddressBar=0 ' delay until we are ready to talk to IE Do While (.Busy) Wscript.Sleep 200 Loop .left=(.document.ParentWindow.screen.availWidth - .width) /2 .top=(.document.ParentWindow.screen.availHeight - .height) /2 .visible=1 Do While (.Busy) Wscript.Sleep 200 Loop End With End SUB
This logon script uses logon.html file to show users a window with a short description:
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Network Logon</title> </head> <body bgcolor="white" bgproperties="fixed" marginwidth=0 leftmargin=5> <font face="Verdana, Arial, Helvetica"> <p align="left" id="status_msg"><strong>Please wait...</strong></p> </font> </body> </html>