
WshNetwork.UserName not present in Win9x Login Script
I've never got this too work under WIN9x. Here's some insight into what I
do:
In the batch file call logon.vbs with CScript.
Example
CScript //NOLOGO \\<Server>\<Share>\<Path>\Logon.vbs
In logon.vbs load the registry RunOnce key with a call to Logon.wsf (or
*.js, *.vbs, whatever) with WScript.
Example
Const HKLM_RUN = _
"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce\Logon Script"
Const RUN_DATA = "MainLogon.wsf"
Const SCRIPT_PATH = "WScript \\<Server>\<Share\<Path>\"
Const KEY_TYPE = "REG_SZ"
strFullPath = SCRIPT_PATH & RUN_DATA
WriteReg(HKLM_RUN, strFullPath, KEY_TYPE)
logon.wsf handles everything properly since it is now running in the WIN9x
GUI environ and you have acccess to anything and everything.
Example of available objects (I use a .wsf, very nice functionality!)
<object id="objFSO" progid="Scripting.FileSystemObject" reference="yes" />
<object id="objNetwork" progid="WScript.Network" reference="yes" />
<object id="objShell" progid="WScript.Shell" reference="yes" />
I'd like to see a show of hands from everyone whos actually got the
'recommended' way to work! I never could, and came up with the above
work-around.
HTH,
Marcus
Quote:
> that's not my issue.
> The whole loop thing for the username just runs indefinitely. It never
> validates the user name no matter how long you wait.
> I'm wondering if I have to map another network drive before I get into wsh
> to try to make the username appear.
> It's not ideal.
> > see my reply to your "WSH for Logon Script" post...
> > --
> > Michael Harris
> > Microsoft.MVP.Scripting
> > --
> > > Batch file runs:
> > > wscript vlogin.vbs
> > > I've even tried using
> > > Start /w wscript vlogin.vbs to make the dos batch program wait.
> > > The "Please wait while your login script executes" screen just stays
> > there.
> > > I've put in a popup in the loop after every 5000 tries, and I've
gotten
> up
> > > to 60,000 before I gave up and clicked cancel.
> > > If I click on the "Cancel" button on the please wait screen, the
script
> > > starts to run, but then loses the connection to the drive the script
is
> > > running from, and falls apart when it doesn't find certain files I'm
> > > checking.
> > > > Does it execute under wscript.exe or cscript.exe? AFAIK, you *need*
> > > wscript.exe in this case.
> > > > --
> > > > Michael Harris
> > > > Microsoft.MVP.Scripting
> > > > --
> > > > > all this does is hang my script..
> > > > > The "Please wait while your Logon Script" screen stays, and I've
> even
> > > thrown
> > > > > a timer in to see how many loops it's been going through, and it
> goes
> > > over
> > > > > 60,000
> > > > > > I have found the follow information
> > > > > > This needs to happen as a work around to
> > > > > > fix a bug with WSH on some Windows95
> > > > > > systems
> > > ---------------------------------------------------------------------
> > > > > > User = ""
> > > > > > Do While User = ""
> > > > > > User = WSHNetwork.UserName
> > > > > > Loop
> > --------------------------------------------------------------------
> > > > > > CU