![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
| Windows NT/2000/2003 Server/2008 Server Find support for Windows NT/2000/2003 Server/2008 Server editions. |
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) | |
|
Member, Networking Team
Join Date: Jan 2005
Location: Ohio
Posts: 1,040
OS: Windows Server 2003
|
VBS Login Script Map Network Drive
I am trying to convert some of our scripts over to vbs
The network drives are currently being mapped via batch scripts. All of the network drives are already mapped on most workstations. When the following script runs an error message pops up saying "device name already in use". Is there any way to make the script override any existing map and just re-map everytime executed? If a user has an old network drive using a drive letter we want mapped to another share, I want the script to override that. This is what I have so far, can some one direct me in the right direction? Thanks. Quote:
__________________
Because you can read this thank a teacher, because it's English thank a soldier. |
|
|
|
|
| Important Information |
|
Join the #1 Tech Support Forum Today - It's Totally Free!
TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free. Join TechSupportforum.com Today - Click Here |
|
|
#2 (permalink) | |
|
Registered User
Join Date: Jun 2006
Location: Mid-West
Posts: 111
OS: WinXP Pro
|
This should do it.
Quote:
This will not overwrite existing maps it will just allow the error that is generated if a drive letter is already taken to be skipped. I would like at the following place: http://www.microsoft.com/technet/scr...a/hsgarch.mspx Last edited by levi.rogers; 02-22-2007 at 04:21 PM. Reason: Mistake... |
|
|
|
|
|
|
#3 (permalink) | |
|
Member, Networking Team
Join Date: Jan 2005
Location: Ohio
Posts: 1,040
OS: Windows Server 2003
|
Quote:
Thanks!
__________________
Because you can read this thank a teacher, because it's English thank a soldier. |
|
|
|
|
|
|
#4 (permalink) | |
|
Member, Networking Team
Join Date: Jan 2005
Location: Ohio
Posts: 1,040
OS: Windows Server 2003
|
Update:
Quote:
__________________
Because you can read this thank a teacher, because it's English thank a soldier. |
|
|
|
|
|
|
#5 (permalink) |
|
Member, Networking Team
Join Date: Jan 2005
Location: Ohio
Posts: 1,040
OS: Windows Server 2003
|
It has to be something with the %username%. I am guessing vbs is a little different. Any oneknow how to correctly fill out that line?
Thanks again.
__________________
Because you can read this thank a teacher, because it's English thank a soldier. |
|
|
|
|
|
#7 (permalink) |
|
Registered User
Join Date: Jun 2006
Location: Mid-West
Posts: 111
OS: WinXP Pro
|
This is how I think it works...
Code:
' MNDUserName.vbs
' VBScript to map a network drive to the UserName.
' Author Guy Thomas http://computerperformance.co.uk/
' Version 1.3 - April 24th 2005
' -----------------------------------------------------------------'
Option Explicit
Dim objNetwork
Dim strDriveLetter, strRemotePath, strUserName
strDriveLetter = "J:"
strRemotePath = "\\grand\home"
' Purpose of script to create a network object. (objNetwork)
' Then to apply the MapNetworkDrive method. Result J: drive
Set objNetwork = WScript.CreateObject("WScript.Network")
' Here is where we extract the UserName
strUserName = objNetwork.UserName
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath _
& "\" & strUserName
' Extra code just to add a message box
WScript.Echo " Launch Explorer, check: "& strDriveLetter
WScript.Quit
' End of MapNetworkDrive Example logon script.
|
|
|
|
|
|
#8 (permalink) |
|
Member, Networking Team
Join Date: Jan 2005
Location: Ohio
Posts: 1,040
OS: Windows Server 2003
|
The way it is setup is:
*This is the My Documents re-direction: User John Smith: Home Folder \\server\users\john.smith\my documents *I want the mapped drive to map the home folder: \\server\users\john.smith
__________________
Because you can read this thank a teacher, because it's English thank a soldier. |
|
|
|
|
|
#9 (permalink) |
|
Member, Networking Team
Join Date: Jan 2005
Location: Ohio
Posts: 1,040
OS: Windows Server 2003
|
The above script works! I just need it to not display the error message when the drive is already mapped.
__________________
Because you can read this thank a teacher, because it's English thank a soldier. |
|
|
|
![]() |
| Thread Tools | |
|
|