Solved

login script map network drive...

Posted on 2006-07-12
5
899 Views
Last Modified: 2012-08-13
Hi:

i need a login script to map network drives,so i wrote a script using wscript.shell(vbs),
then use the net use command to disconnect drive first then remap these drive,
i need map three network drive,but when i reboot the computer,the map drive just appear two...
if i  logout then login these network drives map success,and i can see all three network drive...
anyone know how to solve it??  

thanks
0
Comment
Question by:darkeryu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 6

Accepted Solution

by:
glennbrown2 earned 500 total points
ID: 17092579
i use this to map my drives

***********************************
On Error Resume Next

'Declare variables
Dim wshNetwork, fso, strComputer, objUser, objPolicy, objFirewall

'Set variables
Set wshNetwork = CreateObject("WScript.Network")
Set objShell = WScript.CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Set strComputer = WshNetwork.ComputerName

'check existing drives if connected
If fso.DriveExists ("G:") = True Then
WshNetwork.RemoveNetworkDrive "G:"
End If

If fso.DriveExists ("H:") = True Then
WshNetwork.RemoveNetworkDrive "H:"
End If

'map network drives
wshNetwork.MapNetworkDrive "G:", "\\SERVER1\Company"

wshNetwork.MapNetworkDrive "H:", "\\SERVER1\" & wshNetwork.UserName&"$"

'reset variables to nothing
Set wshNetwork = Nothing
Set fso = Nothing
Set objUser = Nothing
Set strComputer = Nothing
***************************************************************
0
 
LVL 16

Expert Comment

by:glenn_1984
ID: 17092717
You could also use a simple batch file.

net use f: /d   (disconnect drive first)
net use f: //servername/sharename  (map drive f:)
net use  //servername/sharename (map directly to share)
0
 
LVL 14

Expert Comment

by:canali
ID: 17095273

::mapThreeDrive.cmd
@echo off
::delete shares if exist
if exist f:\NUL  net use f: /d
if exist g:\NUL net use g: /d
if exist h:\NUL net use h: /d
:: map network drives
net use f: \\servername\one
net use g:  \\servername\two
net use h:  \\servername\three
0
 
LVL 6

Author Comment

by:darkeryu
ID: 17096468
hi all:

i know how to map it,but when i map network drive,not all network drives remap,if client reboot...
but when users loginout and login again all network drives will be map...

thanks
0
 
LVL 16

Expert Comment

by:glenn_1984
ID: 17108193
are you using
net use f: /d  (delete the mapping - before you try to create the mapping?)

or have you tried

net use f: /persistent:yes
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This may not be a text book method to resolve VSS backup issues but it seemed to have worked on few of the Windows 2003 servers we had issues while performing a Volume Shadow Copy backup. If you have issues while performing a shadow copy backup usin…
I've always wanted to allow a user to have a printer no matter where they login. The steps below will show you how to achieve just that. In this Article I'll show how to deploy printers automatically with group policy and then using security fil…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question