Reply
Old September 5th, 2007 Top | #21

OSNN Folding Team  
fitz's Avatar
XPista7eopard*ix
Joined: April 2004
Location: Chicagoland
Posts: 4,028
Reputation: 2947
Power: 168

Default Re: SBS 2003 assigning mapped drives?

Originally Posted by Heeter View Post
If there is two scripts that I would like to use on a user's profile, do I seperate the scripts with a ";" or just a space between them?
Didn't we go through this already?

http://forum.osnn.net/showpost.php?p=800908&postcount=8

With this setup, I will presume that I can create a different vbscript for each drive that I would like to map, would this be correct?

saving this file would be *.vbs, like in my situation it would be datadrive.vbs and specdrive.vbs, etc, etc?
funny.. madmatt asked me the same question in an IM..

basically, no - you don't create seperate scripts for each drive. The user account properties will only accept a single login script file (although, technically I suppose you could create seperate vbs files and call them through a bat file and have the bat file as your one login script.

But, generally, you'll wrap it into one file. You could remove the variables (strDriveLetter and strPath) and use the actual string values and write multiple connect lines like:
Code:
objNetwork.MapNetworkDrive "y:","\\server\share1"
objNetwork.MapNetworkDrive "z:","\\server\share2"
.
.
But you would have to wrap the lines to check each drive letter and disconnect the existing drive for each path if you wanted that functionality.

A better way would be to turn the mapping script section into a function/subroutine and call the function from the main script. Something along the lines of this:

Code:
MapDrive "x:","\\192.168.25.103\c$"
MapDrive "y:","\\192.168.25.103\e$"
wscript.quit

Function MapDrive(strDriveLetter,strPath)
  set objNet = CreateObject("Wscript.Network")
  set objFSO = CreateObject("Scripting.FileSystemObject")

  if not ( objFSO.DriveExists(strDriveLetter) ) then 
     objNet.MapNetworkDrive strDriveLetter,strPath
  else    
     set objDrive = objFSO.GetDrive(strDriveLetter)
     if not (objDrive.ShareName = strPath) then
        objNet.RemoveNetworkDrive strDriveLetter,true,true
        objNet.MapNetworkDrive strDriveLetter,strPath
     end if
  end if
End Function
fitz is offline   Reply With Quote
Old September 5th, 2007 Top | #22
 
Heeter's Avatar
Overclocked Like A Mother
Joined: July 2002
Location: In front of my computer
Posts: 2,729
Reputation: 684
Power: 154

Default Re: SBS 2003 assigning mapped drives?

Sorry, fitz, I didn't remember that part.

It is because I have a .bat file sitting there already for something else (I think it looks like a default .bat file), it is not for a second mapped drive.


Heeter
Heeter is offline   Reply With Quote
Old September 5th, 2007 Top | #23

OSNN Folding Team  
fitz's Avatar
XPista7eopard*ix
Joined: April 2004
Location: Chicagoland
Posts: 4,028
Reputation: 2947
Power: 168

Default Re: SBS 2003 assigning mapped drives?

Originally Posted by Heeter View Post
Sorry, fitz, I didn't remember that part.

It is because I have a .bat file sitting there already for something else (I think it looks like a default .bat file), it is not for a second mapped drive.
No worries

If you have an existing bat file you are using, you can either 1) move the bat file over to vbscript and have one vbscript to do it all, or 2) call the vbscript from within your bat file
Code:
call cscript //nologo //b <mapdrives.vbs>
fitz is offline   Reply With Quote
Old September 5th, 2007 Top | #24
 
Heeter's Avatar
Overclocked Like A Mother
Joined: July 2002
Location: In front of my computer
Posts: 2,729
Reputation: 684
Power: 154

Default Re: SBS 2003 assigning mapped drives?

You are amazing, Fitz

Can't thank you enough.

I will use that code in the bat file.

A hundred thousand thanks to you.


Heeter
Heeter is offline   Reply With Quote
Old September 12th, 2007 Top | #25

OSNN Folding Team  
fitz's Avatar
XPista7eopard*ix
Joined: April 2004
Location: Chicagoland
Posts: 4,028
Reputation: 2947
Power: 168

Default Re: SBS 2003 assigning mapped drives?

did you get this all sorted out then?
fitz is offline   Reply With Quote
Old September 12th, 2007 Top | #26
 
Heeter's Avatar
Overclocked Like A Mother
Joined: July 2002
Location: In front of my computer
Posts: 2,729
Reputation: 684
Power: 154

Default Re: SBS 2003 assigning mapped drives?

Thanks for asking Fitz,

No it still didn't work.

I cut/pasted the call vbscript into the bat file and it didn't work. Maybe I should post the bat file that is there already for you to see. What do you think?

I am going back to that office tomorrow and continue working on that setup.

Thanks again, Fitz,

Heeter
Heeter is offline   Reply With Quote

Reply

Bookmarks

Thread Tools

Posting Rules

Similar Threads
Thread Thread Starter Forum Replies Last Post
Office and Mapped Network Drives omg its nlm Windows Desktop Systems 5 January 29th, 2007 9:18pm
win 98 behind a router loosing mapped drives on XP mfenech Windows Desktop Systems 0 October 24th, 2006 7:26pm
Automatically re-connect mapped drives? saeltmarae2k Windows Desktop Systems 5 August 29th, 2006 12:11am
what causes mapped drives to be disconnected usghvn2002 Windows Server Systems 12 March 24th, 2006 9:12pm
Keep entering password for mapped drives Heeter Windows Server Systems 15 January 24th, 2006 10:25pm