Network Logon Script - Please help?

zerog83

n00b
Joined
Sep 20, 2002
Messages
50
I'm working on a new logon script (using VBscript) to map printers and network drives for our users. The issue I'm having is when I try to map a drive that is determined by the user's logon name, specifically the mail server... basically:

name: John Doe
logon name: doejoh
mapped directory: \\dc\shared\doejoh\mailbox

How do I use VBScript to grab the user's logon name, and how do I edit my code to throw that variable in the path to the user's mailbox?

objNetwork.MapNetworkDrive "n:", "\\system\shared\WHATDOIPUTHERE\mailbox"

Any help would be greatly appreciated
 
%USERNAME% is the variable i've always used over the years in our win2k/2k3 domain login scripts at work... give it a shot
 
Try this

Code:
Dim strUserName
Set objNetwork = WScript.CreateObject( "WScript.Network" )
strUserName = objNetwork.userName
objNetwork.MapNetworkDrive "n:", "\\system\shared\" & strUserName & "\mailbox"
 
Try this

Code:
Dim strUserName
Set objNetwork = WScript.CreateObject( "WScript.Network" )
strUserName = objNetwork.userName
objNetwork.MapNetworkDrive "n:", "\\system\shared\" & strUserName & "\mailbox"

Looking at the code and seeing the problem solved, I almost feel like I have to apologize for being such a noob when it comes to scripting! Thank you very much, this solved my problem!

Prodigy - your command would have worked in a command shell script, but not in VBScript. We're actually phasing out our MANY command scripts and implementing a single VBS to map out all of our network drives and printers. Thank you for your input though :D
 
Back
Top