Rem: Using WSH Logon Scripts for Win9x


I created a .vbs logon script for a mixed environment of Windows 2000, Windows NT 4.0, and Windows 98 machines running Microsoft Active Directory Service Interfaces (ADSI) 2.5 and Windows Script Host (WSH) 2.0. The script works on the Win2K and NT 4.0 clients but not the Win98 clients. Do you know what's wrong?

Determining the exact problem is difficult without seeing the logon script and the error message that appears on your Win98 clients. However, you might be experiencing a problem that commonly occurs when you use WSH on Win9x clients. WSH-based logon scripts often use the WshNetwork object's UserName property to retrieve the name of the currently logged-on user. However, Win9x logon scripts start before the user is fully logged on to the domain. As a result, the UserName property value isn't available when the logon script begins executing.

To work around this problem, the logon script needs to continuously check for the value of the UserName property until that value becomes available, at which point the logon script can continue. One way to continuously check for this value is to use VBScript's Do...Loop statement. As the code in Listing 6 shows, you begin by initializing the strUsername variable to an empty string. Next, you test the value of strUsername. If strUsername is empty, you initialize the string with the value of the Network object's Username property. The loop continues until the Username property value becomes available, thereby initializing strUsername, which causes the loop to exit.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.