
Using the VBS network module
Q233976 - Cannot Retrieve UserName Property in Windows Script Host
http://support.microsoft.com/support/kb/articles/Q233/9/76.ASP
Dim strUserName
On Error Resume Next
Set WSHNetwork = CreateObject("WScript.Network")
While strUserName = ""
strUserName = WSHNetwork.UserName
WEnd
On Error GoTo 0
--
Michael Harris
Microsoft.MVP.Scripting
--
Please do not email questions - post them to the newsgroup instead.
--
I have a VBScript that is being ran from my NOVELL login script.
It works sparidically.
When I use this in a subroutine:
Set WshNetwork = WScript.CreateObject("WScript.Network")
UN = WshNetwork.UserName
I get the following error:
The operation being requested was not performed because the
user has not logged on to the network.
The specified service does not exist.
Well like I said, this script is being run from a login script, If I wasn't
logged on to the network, I wouldn't be able to run the script in the first
place.
The weirdest part is that the error does not appear consistently (at least
not
htat I've noticed). Sometimes the script completes with no errors, sometimes
it
doesn't.
If there is anyone that has seen this before and knows a solution, I would
greatly appreciate it.
Matt Early