Microsoft KB Archive/233976

{|
 * width="100%"|

Cannot Retrieve UserName Property in Windows Script Host

 * }

Q233976

-

The information in this article applies to:


 * Microsoft Windows 95
 * Microsoft Windows 98

-

SYMPTOMS
When you try to retrieve the UserName property using the WScript.Network object in a Windows 95/98 logon script, you receive a null value.

CAUSE
This issue occurs because a Windows 95/98 logon script is run before the logon process is complete.

RESOLUTION
To work around this issue, use a While loop to continue to retrieve the value as long as it remains null.

The following VBScript code is a sample of how to implement the workaround.

Dim strUserName Set WSHNetwork = CreateObject("WScript.Network") While strUserName = "" strUserName = WSHNetwork.UserName WEnd Additional query words:

Keywords : kbenv kbprogramming kbtool

Issue type : kbprb

Technology : kbWin95search kbWin98search kbWin95 kbWin98