Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 18-05-2009
Member
 
Join Date: Mar 2009
Posts: 55
How to use vbscript to delete map persistent drives

I want to delete map persistent drives using vbscript. How would I code a vbscript for deleting of any persistent drives mapping ?

Can anyone help me providing the vbscript for How to use vbscript to delete map persistent drives ????

Please Help....!
Reply With Quote
  #2  
Old 18-05-2009
Member
 
Join Date: May 2008
Posts: 2,008
Re: How to use vbscript to delete map persistent drives

Here is one of the code to do the same hope this will help you....!

Code:
Dim Network 
Set Network = CreateObject("Wscript.network") 

Network.MapNetworkDrive "D:", "\\Server1\Data" ,true
Network.MapNetworkDrive "F:","\\Server2\groups" ,true
Network.MapNetworkDrive "G:", "\\Server1\alg" ,true
Reply With Quote
  #3  
Old 18-05-2009
Member
 
Join Date: May 2008
Posts: 2,293
Re: How to use vbscript to delete map persistent drives

Among all the mapped network drives on a computer. Here's one way: At first incident summary

Code:
Set objNetwork = CreateObject("Wscript.Network")

Set colDrives = objNetwork.EnumNetworkDrives

For i = 0 to colDrives.Count-1 Step 2
    objNetwork.RemoveNetworkDrive colDrives.Item(i)
Next
Reply With Quote
  #4  
Old 18-05-2009
Member
 
Join Date: Apr 2008
Posts: 2,001
Re: How to use vbscript to delete map persistent drives

A time comes, if you do not need any longer an assigned net drive assembly. Perhaps you are again the allocation of drive assembly letters, or in my case I would like to make only retrogressive assigned net drive assemblies, you with the examination. A further application of this technology would be for log off script to cleans the computer purpose this registration script is to be removed, an assigned net drive assembly P: Here is the key method: objNetwork.MapNetworkDrive.

Instructions :
  1. Preamble, create a mapped network drive = P: (See Below)
  2. Copy and paste the main script into notepad.
  3. Change the server name ALAN to the name of Your server. Check the share name = Drivers.
  4. Save the file with .vbs extension e.g. RemoveDrive.vbs
  5. Double click and observe drive letters in explorer. What you are looking for is the P:\ drive.
  6. If you get errors, check that you have amended the object names alan or home. If you still get Code 800xxxxx message boxes, pay close attention to the commas and speech marks on the second line.

Preamble: A Script to create a mapped network drive, in preparation for the main Example.

Code:
Set objNetwork = CreateObject("WScript.Network") 
Set objShell = CreateObject("WScript.Shell") 
DriveLetter1 = "P:"
RemotePath1 = "\\alan\Drivers" 

objNetwork.MapNetworkDrive DriveLetter1, RemotePath1 
objShell.PopUp "Drive " & DriveLetter1 & " connected successfully." 

Wscript.Quit

' End of example VBScript
Source : computerperformance.co.uk
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to use vbscript to delete map persistent drives"
Thread Thread Starter Forum Replies Last Post
Backtrack 5 - USB Persistent Changes not working Haleema Operating Systems 6 23-06-2011 10:33 PM
How can I delete System Volume Information on non important drives...please help!! Nadhe Windows XP Support 11 28-12-2010 04:24 PM
What does persistent wifi mean Isiah Networking & Security 6 20-05-2010 10:11 AM
persistent cookies Vibhas Technology & Internet 2 31-12-2008 09:09 AM
Persistent Platte Services - How do I delete? Bill Vista Help 3 02-09-2008 09:48 PM


All times are GMT +5.5. The time now is 02:55 AM.