SBS 2003 assigning mapped drives?

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
 
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
 
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>
 
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
 
did you get this all sorted out then?
 
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
 

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. :(

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,015
Messages
673,494
Members
5,621
Latest member
naeemsafi
Back