Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

login script map network drive...

Posted on 2006-07-12
5
Medium Priority
?
904 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 2000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

by Batuhan Cetin In this article I will be guiding through the process of removing a failed DC metadata from Active Directory (hereafter, AD) using the ntdsutil tool in a Windows Server 2003 environment. These steps are not necessary in a Win…
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

636 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