Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Remount exisitng mounted network drive?

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,59745
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Remount exisitng mounted network drive?
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Remount exisitng mounted network drive? - 5/2/2008 1:32:51 AM   
  oxyi

 

Posts: 7
Score: 0
Joined: 2/15/2008
Status: offline
 Hi !!  
I did a DFS root consolidation, and none of my clients network drive would work without remounting all of them again, but
the problem is that each client have his or her own different network drive, I was wondering is there a vbscript
that can detect what network drive was mounted, and unmount it and remount all the existing one again?
I've search around, but most of them just simple mounting the drive and not detecting what was mounted and remounting it.

Anyone can point me to the right direction would be much appreciated!

 
 
Post #: 1
 
 RE: Remount exisitng mounted network drive? - 5/2/2008 1:43:41 AM   
  dm_4ever


Posts: 1938
Score: 30
Joined: 6/29/2006
From: Orange County, California
Status: offline
Search for these or look at the documentation for them...

WScript.Network
EnumNetworkDrives Method
RemoveNetworkDrive Method
MapNetworkDrive Method

http://msdn.microsoft.com/en-us/library/s6wt333f(VS.85).aspx

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to oxyi)
 
 
Post #: 2
 
 RE: Remount exisitng mounted network drive? - 5/2/2008 4:01:59 AM   
  Rischip


Posts: 341
Score: 2
Joined: 3/26/2007
Status: online
I'm getting pulled away from playtime to go do some work. So here's a start.


      

_____________________________

Rischip
Author of - The Grim Linker

(in reply to dm_4ever)
 
 
Post #: 3
 
 RE: Remount exisitng mounted network drive? - 5/6/2008 6:26:02 AM   
  oxyi

 

Posts: 7
Score: 0
Joined: 2/15/2008
Status: offline
Thanks Rischip,

for your code, don't I need to access the registry HKCU\Network to read the drive that's mounted and the remotepath ?
Because my biggest problem right now is i don't know how to :

Loop from drive letter F-Z to check whether which letter is being used,
then store the driveletter and path information to each its own value,
dismount the drive
then use the two value that I stored and remount back the same drive


On your code, your IF statment kinda lost me there, why are you Moding 2 ?

Thanks !

(in reply to Rischip)
 
 
Post #: 4
 
 RE: Remount exisitng mounted network drive? - 5/6/2008 8:00:35 AM   
  Rischip


Posts: 341
Score: 2
Joined: 3/26/2007
Status: online
Map yourself a Z: drive, or any other drive (change the Z: in the code to match where you mount.)
Then try this code. It should become self explanatory.


      

< Message edited by Rischip -- 5/6/2008 8:02:16 AM >


_____________________________

Rischip
Author of - The Grim Linker

(in reply to oxyi)
 
 
Post #: 5
 
 RE: Remount exisitng mounted network drive? - 5/6/2008 8:03:00 AM   
  Rischip


Posts: 341
Score: 2
Joined: 3/26/2007
Status: online
I almost forgot. Since I wrote the whole thing I require BEER 

_____________________________

Rischip
Author of - The Grim Linker

(in reply to Rischip)
 
 
Post #: 6
 
 RE: Remount exisitng mounted network drive? - 5/6/2008 9:31:03 AM   
  oxyi

 

Posts: 7
Score: 0
Joined: 2/15/2008
Status: offline
let me try out the code, but while I am testing,  here is some new castels !  

Thanks !

(in reply to Rischip)
 
 
Post #: 7
 
 RE: Remount exisitng mounted network drive? - 5/7/2008 8:19:41 AM   
  oxyi

 

Posts: 7
Score: 0
Joined: 2/15/2008
Status: offline
Yap the script does mount and remount it. AWESOMENESS!

BUT.. how would i go about looping thru all the drive letter ??


I have an idea like this,I don't know if it would work, this is my first time coding in VB script


      


Basically , I will have the program loop thru my string of letters, and append each letter and advance it and compare to see if the drive exist or not,
if it exist, then it will run your code, if not, it  should just go back to the loop and check the next letter. This last part I am not sure if I code it correctly
I don't know if i get the logic correctly , or if there is a easier way to append all the drive letters, but with my limited vb knowlege , this is the only way I know how..

Also btw, does vbscript work for the NT login ?

Thanks again for all the help !



(in reply to oxyi)
 
 
Post #: 8
 
 RE: Remount exisitng mounted network drive? - 5/7/2008 10:14:27 PM   
  Rischip


Posts: 341
Score: 2
Joined: 3/26/2007
Status: online
The script already runs through all network drives. Pull out the If driveLetter = "Z:" Then AND the corresponding End IF, and you're done. Well you might want to pull out all of the msgbox's also, or at least comment them.

This part goes through all the connected drives. There's no need to start at an ambiguous letter.

Set netWorkDrives = wshNetwork.EnumNetworkDrives

For i = 0 To netWorkDrives.Count - 1

_____________________________

Rischip
Author of - The Grim Linker

(in reply to oxyi)
 
 
Post #: 9
 
 RE: Remount exisitng mounted network drive? - 5/8/2008 1:25:54 AM   
  oxyi

 

Posts: 7
Score: 0
Joined: 2/15/2008
Status: offline
OH snapped, you were right !!   *happy*

Dude, you da bomb, what was I thinking comparing thru a series of string !!

Thank you very very very much for helping me out !!


(in reply to Rischip)
 
 
Post #: 10
 
 RE: Remount exisitng mounted network drive? - 5/8/2008 5:34:56 AM   
  Rischip


Posts: 341
Score: 2
Joined: 3/26/2007
Status: online
You are welcome. As a general rule we help with code, not write it. This just happened to be something I was adding to another script I'm working on. So I just posted it.

_____________________________

Rischip
Author of - The Grim Linker

(in reply to oxyi)
 
 
Post #: 11
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Remount exisitng mounted network drive? Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts