Windows 2000 Logon Scripts: CSCRIPT vs WSCRIPT
This article examines how Microsoft Windows 2000 executes automated logon scripts using the Windows Script Host (WSH) engines, comparing the command-line host (CSCRIPT) and the graphical host (WSCRIPT). It details how Windows 2000 handles standard output, user interaction, and process execution for each host, explaining why choosing the correct host is critical for preventing logon delays and hung sessions in enterprise environments.
Overview of Windows Script Host in Windows 2000
In Microsoft Windows 2000, logon scripts can be written in native
scripting languages like VBScript and JScript rather than legacy batch
files (.bat or .cmd). When a .vbs
or .js file is invoked during user logon—either via Active
Directory Group Policy or legacy user account properties—Windows relies
on Windows Script Host (WSH) to interpret and execute the code.
WSH includes two runtime binaries:
CSCRIPT.EXE: The command-line host.WSCRIPT.EXE: The Windows-based graphical host.
By default, Windows 2000 registers WSCRIPT.EXE as the
default system handler for script file extensions, but logon scripts can
explicitly invoke either binary depending on how policies or execution
paths are configured.
Execution Behavior: CSCRIPT vs WSCRIPT
The core difference between CSCRIPT and
WSCRIPT in the context of Windows 2000 logon processing
lies in how the operating system manages standard input, output, and
user interface threads.
1. Output and Dialog Handling
- CSCRIPT: Directs all output generated by methods
such as
WScript.Echoto standard output (stdout). If the script executes inside an open command window, text outputs sequentially line by line. It does not halt execution unless the script explicitly prompts for input viaWScript.StdIn. - WSCRIPT: Routes any
WScript.Echocall directly to a graphical Win32 message box (MessageBoxAPI). Each output statement stops the execution thread and waits for the interactive user to click the "OK" button before continuing to the next line of code.
2. Impact on the Logon Process
- CSCRIPT in Logon Scripts: Because output is written directly to the console buffer, automated logon scripts execute from start to finish without pausing for user intervention. This behavior is ideal for background configuration tasks, drive mappings, and environment variable assignments.
- WSCRIPT in Logon Scripts: If a script contains
diagnostic output or error messages,
WSCRIPTproduces sequential pop-up dialogs. If the logon script executes synchronously (which is standard behavior under certain Windows 2000 Group Policy settings), the user's desktop shell (Explorer.exe) will not fully load until all dialog boxes are acknowledged, causing the logon process to appear frozen.
3. Console Window Display
- CSCRIPT: Spawns a visible command-prompt window by default unless the logon script is executed via a Group Policy setting configured to run scripts hidden, or launched using a minimized wrapper.
- WSCRIPT: Executes completely invisibly in the background without allocating a console window, unless a graphical prompt or script error generates an interactive message box.
How Windows 2000 Determines the Execution Host
When a logon script runs in Windows 2000, the host is chosen through one of the following mechanisms:
- Explicit Execution via Group Policy or Batch File:
Administrators can define the command directly as:
This explicitly bypasses system file associations and guarantees the script executes within the console runtime.
cscript.exe //nologo \\domain\sysvol\domain\scripts\logon.vbs - File Association (Direct Script Invocation): If the
logon script is configured simply as
logon.vbs, Windows 2000 uses the host defined in the registry underHKEY_CLASSES_ROOT\VBSFile\Shell\Open\Command. In a default Windows 2000 installation, this points towscript.exe "%1" %*. - Global Host Reconfiguration: Administrators can
change the default host for the entire machine using the
//Hswitch:This updates the system settings so that any bare invocation of a script file defaults tocscript //H:CSCRIPTCSCRIPT.EXE.
Summary of Processing Differences
| Feature | CSCRIPT.EXE | WSCRIPT.EXE |
|---|---|---|
| Output Type | Command-line text
(stdout) |
GUI Pop-up (MessageBox) |
| Execution Impact | Non-blocking | Blocks execution until dismissed |
| Default Host | Requires explicit call or remapping | Default system host in Windows 2000 |
| Logon Suitability | Recommended for uninterrupted processing | Prone to hanging logon sessions |