I am writing a network logon script using VBScript and am trying to retreive
the current users logon name using the wshNetwork.UserName property....
Sub GetUser
Dim wshNetwork
Set wshNetwork = WScript.CreateObject("WScript.Network")
UserName = ""
Do
UserName = wshNetwork.UserName
Loop while UserName = ""
Set wshNetwork = Nothing
End Sub
The problem is that when the above code is called from the network logon DOS
batch file, it stops with the error "The operation being requested was not
performed because the user has not logged on to the network."
How do I get round this?
Regards,
Stephen
In article <eJJwz1hG$GA....@cppssbbsa02.microsoft.com>,
stephen...@sgsgroup.com says...
> Hi,
>
> I am writing a network logon script using VBScript and am trying to retreive
> the current users logon name using the wshNetwork.UserName property....
>
> Sub GetUser
> Dim wshNetwork
>
> Set wshNetwork = WScript.CreateObject("WScript.Network")
> UserName = ""
on error resume next
> Do
> UserName = wshNetwork.UserName
> Loop while UserName = ""
> Set wshNetwork = Nothing
on error goto 0
> End Sub
>
> The problem is that when the above code is called from the network logon DOS
> batch file, it stops with the error "The operation being requested was not
> performed because the user has not logged on to the network."
>
> How do I get round this?
>
> Regards,
>
> Stephen
>
>
>
--
Todd A. Scalzott to...@kastle.com
Director, Information Technology Kastle Systems, LLC
(703) 528-8800
Todd A. Scalzott <to...@kastle.com> wrote in message
news:MPG.12763c46b...@msnews.microsoft.com...
this discussion has a long history now. I got it never working on
W95(A!!!!!), even with all posted tricks. The most importent tip for me,
comes some days ago, where someone (???) in this groups posted to use the
old "PUTINENV.EXE" to get the username while running the logon (.BAT) script
and after this, read the environment variable by WSH (PUTINENV.EXE put's
it's results in the environment). I made only one first step to see, that
PUTINENV.EXE will really work with W95A and it did. So it should be possible
to read the username (and other network settings - PUTINENV.EXE is a very
small but powerful tool).
Best regards,
Manfred Braun
(Private)
Lange Roetterstrasse 7
D68167 Mannheim
Germany
mailto:_mbr...@manfred.mannheim-netz.de
(Remove the anti-spam-underscore to mail me!)
Stephen Speirs <stephen...@sgsgroup.com> schrieb in im Newsbeitrag:
uqSVjwjG$GA....@cppssbbsa02.microsoft.com...
Mike Whalen
Windows Script Dev
Stephen Speirs <stephen...@sgsgroup.com> wrote in message
news:uqSVjwjG$GA....@cppssbbsa02.microsoft.com...
On error goto 0, while not documented, works just great in VBScript and
is very useful.
In article <uqSVjwjG$GA....@cppssbbsa02.microsoft.com>,
stephen...@sgsgroup.com says...
Do you have a URL for dejanews - it is a new one to me. And yes you're
right, 'On Error Goto 0' does work - my appologies.
Thanks again,
Stephen
Todd A. Scalzott <to...@kastle.com> wrote in message
news:MPG.1277c797a...@msnews.microsoft.com...
Bill James
Stephen Speirs <stephen...@sgsgroup.com> wrote in message
news:##p2Xo6G$GA.250@cppssbbsa04...
It is but they've rebranded and are now just deja.com so http://deja.com is
the one they now encourage (I imagine dejanews.com won't disappear ever
though.
Jim.
--
Todd A. Scalzott to...@kastle.com
Director, Information Technology Kastle Systems, LLC
(703) 528-8800
In article <Ox7$QI7G$GA...@cppssbbsa02.microsoft.com>, J...@jibbering.com
says...
Regrettably, there really is no such thing as a free lunch (nor a free
web resource). Either the archive needs to be subscription based,
handled by a 'not-for-profit' (such as with the W3 consortium) or,
unfortunately, we will have to put up with the ads to keep it in
business.
Tom Lavedas
-----------
http://www.pressroom.com/~tglbatch/
Den Tue, 19 Oct 1999 15:13:54 +0100, skrev du:
>Thanks Todd, but I'm afraid it still doesn't work - it just sits in a loop
>indefinetely. Also, I don't think "On Error Goto 0" is valid in VBScript (VB
>yes, VBScript no).
Use wscript instead of cscript.