Announcement

Collapse
No announcement yet.

Taking too long to map network drives...

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Taking too long to map network drives...

    Ey Up,
    Was wondering if you could help me again...

    Basically its taking too long to map the network drives with a VBS script on our network. Is there anything that can be done to the below coding to improve the speed of which it takes?

    Code:
    On Error Resume Next
    
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set WshNetwork = WScript.CreateObject("WScript.Network")
    Set objNetwork = CreateObject("WScript.Network")
    Set objNet = CreateObject("WScript.Network")
    strCompName = objNet.ComputerName
    
    '============={SITE}===============
    IF left(strCompName,3) = "XXX" THEN
    
    Dim objNetwork
    Dim strDriveLetter, strRemotePath, strUserName
    strDriveLetter = "X:"
    strRemotePath = "\\server\"
    Set objNetwork = WScript.CreateObject("WScript.Network")
    strUserName = objNetwork.UserName
    objNetwork.MapNetworkDrive strDriveLetter, strRemotePath & strUserName
    
    Set WshNetwork = WScript.CreateObject("WScript.Network")
    Set objNetwork = CreateObject("WScript.Network")
    objNetwork.MapNetworkDrive "K:" , "\\server\directory1"
    objNetwork.MapNetworkDrive "W:" , "\\server\directory2"
    objNetwork.MapNetworkDrive "Q:" , "\\server\directory3"
    END IF

    Thanks!

  • #2
    Re: Taking too long to map network drives...

    Well, you could lose this bit:

    Dim objNetwork
    Dim strDriveLetter, strRemotePath, strUserName
    strDriveLetter = "X:"
    strRemotePath = "\\server\"
    Set objNetwork = WScript.CreateObject("WScript.Network")
    strUserName = objNetwork.UserName
    objNetwork.MapNetworkDrive strDriveLetter, strRemotePath & strUserName

    Instead use ADUC user properties (profile tab) to set the home drive letter X to \\server\%username%

    You will lose the IF computername begins with XXX bit but hopefully user homedirectories do not depend on the computer they are using

    Not sure if this makes sense -- if not, let me know and I will do it with pictures

    Tom
    Tom Jones
    MCT, MCSE (2000:Security & 2003), MCSA:Security & Messaging, MCDBA, MCDST, MCITP(EA, EMA, SA, EDA, ES, CS), MCTS, MCP, Sec+
    PhD, MSc, FIAP, MIITT
    IT Trainer / Consultant
    Ossian Ltd
    Scotland

    ** Remember to give credit where credit is due and leave reputation points where appropriate **

    Comment


    • #3
      Re: Taking too long to map network drives...

      Hi ya,
      Sorry for not replying, bit busy ATM doing an audit of the building.
      Haven't had time to look at the logon script.

      Should be done by next week, I'll get back to ya!

      Comment

      Working...
      X