logon scripts 
Author Message
 logon scripts

I placed this script in the logon directory of a win2000 server , so when I
log with the win98 machine  it fails at startup because of the
onet.username. But when I am logged I can execute this same script and it
works well.
What's the problem?
It seems the onet.username variable doesn't exist before the user is
connected.
Thanks for response.

dim oNet
set oNet = createobject("wscript.network")

enleve_lecteur "Y:"
oNet.mapnetworkdrive "Y:" , "\\svr_hwt\" & oNet.username & "$" , true

sub enleve_lecteur(lettre)
set oDrive = oNet.enumNetworkDrives
for i=0 to (oDrive.count -2) step 2
 if oDrive(i)=lettre then
  oNet.RemoveNetworkDrive lettre , true , true
 end if
next
end sub



Sun, 13 Jul 2003 22:48:30 GMT  
 logon scripts
Q233976 - Cannot Retrieve UserName Property in Windows Script Host
http://support.microsoft.com/support/kb/articles/Q233/9/76.ASP

Note that the solution in this KB article neglects to mention that you need to turn on error
trapping (On Error Resume Next) and then turn it off afterwards (On Error GoTo 0)...

--
Michael Harris
Microsoft.MVP.Scripting
--

Please do not email questions - post them to the newsgroup instead.
--


Quote:
> I placed this script in the logon directory of a win2000 server , so when I
> log with the win98 machine  it fails at startup because of the
> onet.username. But when I am logged I can execute this same script and it
> works well.
> What's the problem?
> It seems the onet.username variable doesn't exist before the user is
> connected.
> Thanks for response.

> dim oNet
> set oNet = createobject("wscript.network")

> enleve_lecteur "Y:"
> oNet.mapnetworkdrive "Y:" , "\\svr_hwt\" & oNet.username & "$" , true

> sub enleve_lecteur(lettre)
> set oDrive = oNet.enumNetworkDrives
> for i=0 to (oDrive.count -2) step 2
>  if oDrive(i)=lettre then
>   oNet.RemoveNetworkDrive lettre , true , true
>  end if
> next
> end sub



Mon, 14 Jul 2003 02:53:29 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. logon.exe script.vbs in profile (logon script)

2. How can I get logon server name and IP address from logon script using wsh

3. Win98, Logon script & finding logon server

4. CLPB Mini FAQ

5. Skipping columns in DBGrid (Re-Post)

6. vb script as network logon script

7. Running Scripting Host Files as Logon Script

8. WSH Script in NT Logon Script

9. Where to learn Logon Scripting?

10. logon script

11. Q: Logon Script Mapping?

12. Logon Scripts

 

 
Powered by phpBB® Forum Software