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

Tags: , , , , ,

Sponsored Links



How to use vbscript to delete map persistent drives

Software Development


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: 1,990
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
Zecho's Avatar
Member
 
Join Date: May 2008
Posts: 2,267
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
kelfro's Avatar
Member
 
Join Date: Apr 2008
Posts: 1,976
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


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
Delete files, folders, drives safely in Linux Spy$Eyes Tips & Tweaks 1 13-01-2011 01:42 PM
How can I delete System Volume Information on non important drives...please help!! Ronald Reitch LMT Windows XP Support 12 28-12-2010 04:24 PM
What does persistent wifi mean Isiah Networking & Security 6 20-05-2010 11:11 AM
Batch File program to search all physical drives and delete .jpg , .jpeg files freeuserlogin Windows Server Help 4 12-11-2009 10:20 AM
Persistent Platte Services - How do I delete? Bill Vista Help 3 02-09-2008 10:48 PM


All times are GMT +5.5. The time now is 03:50 AM.