Login Script -- variables 
Author Message
 Login Script -- variables

Hi all,

I have set up a PDC for my network of Win95 Clients, and would like to
be able to map a drive on a per user basis.

I have already tried:
   net use u: \\<servername>\<sharename>
but it is static.

What I want to do is get the username of the user as they log in, and
use it to map the share. (ie if my username is 'mhebert', I want to map
drive u: to \\<servername>\mlhebert, but if I log in as 'bsmith', it
should connect me to \\<servername>\bsmith using the SAME logon script.

Is there an environment variable to do this?

Thanks,
Matt Hebert

Sent via Deja.com http://www.*-*-*.com/
Share what you know. Learn what you don't.



Mon, 10 Dec 2001 03:00:00 GMT  
 Login Script -- variables
Sure - here is the VBScript

set WSHNetwork = WScript.CreateObject("WScript.Network")

WSHNetwork.MapNetworkDrive "V:", "\\YourServer" + WSHNetwork.Username

WSHNetwork.MapNetworkDrive "H:", "\\YourServer" +
WSHNetwork.ComputerName


Quote:

> Hi all,

> I have set up a PDC for my network of Win95 Clients, and would like to
> be able to map a drive on a per user basis.

> I have already tried:
>    net use u: \\<servername>\<sharename>
> but it is static.

> What I want to do is get the username of the user as they log in, and
> use it to map the share. (ie if my username is 'mhebert', I want to
map
> drive u: to \\<servername>\mlhebert, but if I log in as 'bsmith', it
> should connect me to \\<servername>\bsmith using the SAME logon
script.

> Is there an environment variable to do this?

> Thanks,
> Matt Hebert

> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


Mon, 10 Dec 2001 03:00:00 GMT  
 Login Script -- variables
After posting this here, I have had trouble on my network getting this
to work (NT server w/ Win95 clients) during execution of a logon
script.  I can map drives with the WSHNEtwork.ComputerName variable but
not with the WSHNEtwork.UserName variable.  I am running NT 4,0 Server
SP4 and ie 5 on win95B machines with ie5.

For whatever reason, during the logon, the script does not return
the .UserName variable.

Anyone know why this happens?


Quote:

> Sure - here is the vbscript

> set WSHNetwork = WScript.CreateObject("WScript.Network")

> WSHNetwork.MapNetworkDrive "V:", "\\YourServer" + WSHNetwork.Username

> WSHNetwork.MapNetworkDrive "H:", "\\YourServer" +
> WSHNetwork.ComputerName



> > Hi all,

> > I have set up a PDC for my network of Win95 Clients, and would like
to
> > be able to map a drive on a per user basis.

> > I have already tried:
> >    net use u: \\<servername>\<sharename>
> > but it is static.

> > What I want to do is get the username of the user as they log in,
and
> > use it to map the share. (ie if my username is 'mhebert', I want to
> map
> > drive u: to \\<servername>\mlhebert, but if I log in as 'bsmith', it
> > should connect me to \\<servername>\bsmith using the SAME logon
> script.

> > Is there an environment variable to do this?

> > Thanks,
> > Matt Hebert

> > Sent via Deja.com http://www.deja.com/
> > Share what you know. Learn what you don't.

> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


Tue, 11 Dec 2001 03:00:00 GMT  
 Login Script -- variables

RE: Login Script -- variables%username%

  Set up a home directory in User manger

  and the following line in your logon script                    
    net use driveletter: /home

Quote:
  -----Original Message-----

  Posted At: 25/06/99 04:42
  Conversation: Login Script -- variables
  Subject:Login Script -- variables

  Hi all,

  I have set up a PDC for my network of Win95 Clients, and would like to
  be able to map a drive on a per user basis.

  I have already tried:
     net use u: \\<servername>\<sharename>
  but it is static.

  What I want to do is get the username of the user as they log in, and
  use it to map the share. (ie if my username is 'mhebert', I want to map
  drive u: to \\<servername>\mlhebert, but if I log in as 'bsmith', it
  should connect me to \\<servername>\bsmith using the SAME logon script.

  Is there an environment variable to do this?

  Thanks,
  Matt Hebert

  Sent via Deja.com http://www.deja.com/
  Share what you know. Learn what you don't.



Tue, 11 Dec 2001 03:00:00 GMT  
 Login Script -- variables
Before you use username, wait for it be non-blank...
This is a known issue and a common workaround.

while wshnetwork.username = ""
wend

--
Michael Harris

| After posting this here, I have had trouble on my network getting this
| to work (NT server w/ Win95 clients) during execution of a logon
| script.  I can map drives with the WSHNEtwork.ComputerName variable but
| not with the WSHNEtwork.UserName variable.  I am running NT 4,0 Server
| SP4 and ie 5 on win95B machines with ie5.
|
| For whatever reason, during the logon, the script does not return
| the .UserName variable.
|
| Anyone know why this happens?
|


| > Sure - here is the vbscript
| >
| > set WSHNetwork = WScript.CreateObject("WScript.Network")
| >
| > WSHNetwork.MapNetworkDrive "V:", "\\YourServer" + WSHNetwork.Username
| >
| > WSHNetwork.MapNetworkDrive "H:", "\\YourServer" +
| > WSHNetwork.ComputerName
| >


| > > Hi all,
| > >
| > > I have set up a PDC for my network of Win95 Clients, and would like
| to
| > > be able to map a drive on a per user basis.
| > >
| > > I have already tried:
| > >    net use u: \\<servername>\<sharename>
| > > but it is static.
| > >
| > > What I want to do is get the username of the user as they log in,
| and
| > > use it to map the share. (ie if my username is 'mhebert', I want to
| > map
| > > drive u: to \\<servername>\mlhebert, but if I log in as 'bsmith', it
| > > should connect me to \\<servername>\bsmith using the SAME logon
| > script.
| > >
| > > Is there an environment variable to do this?
| > >
| > > Thanks,
| > > Matt Hebert
| > >
| > > Sent via Deja.com http://www.deja.com/
| > > Share what you know. Learn what you don't.
| > >
| >
| > Sent via Deja.com http://www.deja.com/
| > Share what you know. Learn what you don't.
| >
|
|
| Sent via Deja.com http://www.deja.com/
| Share what you know. Learn what you don't.



Tue, 11 Dec 2001 03:00:00 GMT  
 Login Script -- variables

RE: Login Script -- variables%username% will work for NT clients but not for win95 clients.  Here is a sample script that you can call from a batch file:

set WSHNetwork = WScript.CreateObject("WScript.Network")

While WSHNetwork.ComputerName = ""
Wend

WSHNetwork.MapNetworkDrive "V:", "\\servername\" + WSHNetwork.Username

WSHNetwork.MapNetworkDrive "H:", "\\servername\" + WSHNetwork.ComputerName


  %username%

    Set up a home directory in User manger

    and the following line in your logon script                    
      net use driveletter: /home

Quote:
    -----Original Message-----

    Posted At: 25/06/99 04:42
    Conversation: Login Script -- variables
    Subject:Login Script -- variables

    Hi all,

    I have set up a PDC for my network of Win95 Clients, and would like to
    be able to map a drive on a per user basis.

    I have already tried:
       net use u: \\<servername>\<sharename>
    but it is static.

    What I want to do is get the username of the user as they log in, and
    use it to map the share. (ie if my username is 'mhebert', I want to map
    drive u: to \\<servername>\mlhebert, but if I log in as 'bsmith', it
    should connect me to \\<servername>\bsmith using the SAME logon script.

    Is there an environment variable to do this?

    Thanks,
    Matt Hebert

    Sent via Deja.com http://www.deja.com/
    Share what you know. Learn what you don't.



Tue, 11 Dec 2001 03:00:00 GMT  
 Login Script -- variables
Thank you very much for the hlep, Michael.  However, this does not seem
to work for me...here is a sample of how I used it - maybe I used it
incorrectly?

set wshnetwork = wscript.creatobject(wscript.network")
while wshnetwork.username = ""
wend
if wshnetwork.username = "joeblow" then
wshnetwork.mapnetworkdrive "T:", "\\server\share" End if

It runs fine AFTER the client has already logged in but not during
execution of the logon script...



Quote:
> Before you use username, wait for it be non-blank...
> This is a known issue and a common workaround.

> while wshnetwork.username = ""
> wend

> --
> Michael Harris




Quote:
> | After posting this here, I have had trouble on my network getting
this
> | to work (NT server w/ Win95 clients) during execution of a logon
> | script.  I can map drives with the WSHNEtwork.ComputerName variable
but
> | not with the WSHNEtwork.UserName variable.  I am running NT 4,0
Server
> | SP4 and ie 5 on win95B machines with ie5.
> |
> | For whatever reason, during the logon, the script does not return
> | the .UserName variable.
> |
> | Anyone know why this happens?
> |


> | > Sure - here is the vbscript
> | >
> | > set WSHNetwork = WScript.CreateObject("WScript.Network")
> | >
> | > WSHNetwork.MapNetworkDrive "V:", "\\YourServer" +
WSHNetwork.Username
> | >
> | > WSHNetwork.MapNetworkDrive "H:", "\\YourServer" +
> | > WSHNetwork.ComputerName
> | >


> | > > Hi all,
> | > >
> | > > I have set up a PDC for my network of Win95 Clients, and would
like
> | to
> | > > be able to map a drive on a per user basis.
> | > >
> | > > I have already tried:
> | > >    net use u: \\<servername>\<sharename>
> | > > but it is static.
> | > >
> | > > What I want to do is get the username of the user as they log
in,
> | and
> | > > use it to map the share. (ie if my username is 'mhebert', I
want to
> | > map
> | > > drive u: to \\<servername>\mlhebert, but if I log in
as 'bsmith', it
> | > > should connect me to \\<servername>\bsmith using the SAME logon
> | > script.
> | > >
> | > > Is there an environment variable to do this?
> | > >
> | > > Thanks,
> | > > Matt Hebert
> | > >
> | > > Sent via Deja.com http://www.deja.com/
> | > > Share what you know. Learn what you don't.
> | > >
> | >
> | > Sent via Deja.com http://www.deja.com/
> | > Share what you know. Learn what you don't.
> | >
> |
> |
> | Sent via Deja.com http://www.deja.com/
> | Share what you know. Learn what you don't.

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


Fri, 14 Dec 2001 03:00:00 GMT  
 Login Script -- variables
This DOES work as long as it is prefaced with
       On Error Resume Next

Thanks Michael!


Quote:

> Thank you very much for the hlep, Michael.  However, this does not
seem
> to work for me...here is a sample of how I used it - maybe I used it
> incorrectly?

> set wshnetwork = wscript.creatobject(wscript.network")
> while wshnetwork.username = ""
> wend
> if wshnetwork.username = "joeblow" then
> wshnetwork.mapnetworkdrive "T:", "\\server\share" End if

> It runs fine AFTER the client has already logged in but not during
> execution of the logon script...



> > Before you use username, wait for it be non-blank...
> > This is a known issue and a common workaround.

> > while wshnetwork.username = ""
> > wend

> > --
> > Michael Harris



> > | After posting this here, I have had trouble on my network getting
> this
> > | to work (NT server w/ Win95 clients) during execution of a logon
> > | script.  I can map drives with the WSHNEtwork.ComputerName
variable
> but
> > | not with the WSHNEtwork.UserName variable.  I am running NT 4,0
> Server
> > | SP4 and ie 5 on win95B machines with ie5.
> > |
> > | For whatever reason, during the logon, the script does not return
> > | the .UserName variable.
> > |
> > | Anyone know why this happens?
> > |


> > | > Sure - here is the vbscript
> > | >
> > | > set WSHNetwork = WScript.CreateObject("WScript.Network")
> > | >
> > | > WSHNetwork.MapNetworkDrive "V:", "\\YourServer" +
> WSHNetwork.Username
> > | >
> > | > WSHNetwork.MapNetworkDrive "H:", "\\YourServer" +
> > | > WSHNetwork.ComputerName
> > | >


> > | > > Hi all,
> > | > >
> > | > > I have set up a PDC for my network of Win95 Clients, and would
> like
> > | to
> > | > > be able to map a drive on a per user basis.
> > | > >
> > | > > I have already tried:
> > | > >    net use u: \\<servername>\<sharename>
> > | > > but it is static.
> > | > >
> > | > > What I want to do is get the username of the user as they log
> in,
> > | and
> > | > > use it to map the share. (ie if my username is 'mhebert', I
> want to
> > | > map
> > | > > drive u: to \\<servername>\mlhebert, but if I log in
> as 'bsmith', it
> > | > > should connect me to \\<servername>\bsmith using the SAME
logon
> > | > script.
> > | > >
> > | > > Is there an environment variable to do this?
> > | > >
> > | > > Thanks,
> > | > > Matt Hebert
> > | > >
> > | > > Sent via Deja.com http://www.deja.com/
> > | > > Share what you know. Learn what you don't.
> > | > >
> > | >
> > | > Sent via Deja.com http://www.deja.com/
> > | > Share what you know. Learn what you don't.
> > | >
> > |
> > |
> > | Sent via Deja.com http://www.deja.com/
> > | Share what you know. Learn what you don't.

> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


Fri, 14 Dec 2001 03:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Users login script = variable?

2. Getting variables out of VB and into Dos Login Script

3. Login Script to Create Text file using ADSI variables

4. Login Script to Create Text file using ADSI variables

5. Assigning Client Script Variables to Application level variables inside of a Client Script

6. Pass client script variable to server script variable

7. Passing variables for NT-login?

8. vbscript login scripts - starting a script from the Windows 95 command prompt

9. Script to remove login script by OU.

10. Using a WSH Script as a Login Script

11. Login script - Script running before user logs on.

12. Login script - Script running before user logs on.

 

 
Powered by phpBB® Forum Software