Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mapping Network Drives

Status
Not open for further replies.

sproosy

IS-IT--Management
Oct 31, 2002
94
0
0
AU
Heya!

I want to map an additional drive as well as a users home directory when they log on. Is there a logon script someone could point me at or any way to make the users connect to this drive??

Cheers Sproosy MCP

Keep it real!
 
Hello Sproosy !

Simply make a .bat or .cmd file and "net use the drives".

Net use:
NET USE [DRIVENAME]: \\[SERVERNAME]\[SHARENAME]

Example

NEN USE M: \\W2KSERVER\COMPANY.

then assign the script to the user and.... DONE !

\Lars

---
Why make things difficult, when it is possible to make them cryptic and totally illogic, with just a little more effort.
---
 
This is the script I use to do this. The T drive is mapped to a regular directory, the K drive is mapped to a users home folder. The varible s user and get user logon name are used to retrieve the logon name of the user and map to a folder with this name in a directory. In order for this to work your user directories must be named the same as their logon name.



' declare variables
dim wshnetwork
dim ie
dim sUser

' suppress error messages
on error resume next

' set reference to WSH network object
set wshnetwork=wscript.createobject("wscript.network")

' Get logon Name of Current User
sUser = wshnetwork.Username

' remove network drive in case it is already in use
wshnetwork.removenetworkdrive "K:"

' add network drive
wshnetwork.mapnetworkdrive "K:","\\Server\users\faculty\" + sUser

' add network drive
wshnetwork.mapnetworkdrive "T:","\\Server\Shared\Tracker"
 
Then apply this script through group policy to the Object that you want to run the script.
 
Maybe my servers are slow or the network is busy but I have found I have to have While/WEnd wrapped around the get user name line.

It would misfire periodically ( often enough to aggravate the users ) and fail to map the user drive.

Code:
While strUserName = ""
 strUserName = WSHNetwork.UserName
WEnd
WSHNetwork.MapNetworkDrive "U:", "\\Server\" + strUserName + "$"

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top