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!
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!
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 ?
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 >
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..
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.
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.