Results 1 to 4 of 4

Thread: How to use vbscript to delete map persistent drives

  1. #1
    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....!

  2. #2
    Join Date
    May 2008
    Posts
    2,012

    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

  3. #3
    Join Date
    May 2008
    Posts
    2,297

    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

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    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

Similar Threads

  1. Backtrack 5 - USB Persistent Changes not working
    By Haleema in forum Operating Systems
    Replies: 6
    Last Post: 23-06-2011, 10:33 PM
  2. Replies: 11
    Last Post: 28-12-2010, 04:24 PM
  3. What does persistent wifi mean
    By Isiah in forum Networking & Security
    Replies: 6
    Last Post: 20-05-2010, 10:11 AM
  4. persistent cookies
    By Vibhas in forum Technology & Internet
    Replies: 2
    Last Post: 31-12-2008, 09:09 AM
  5. Persistent Platte Services - How do I delete?
    By Bill in forum Vista Help
    Replies: 3
    Last Post: 02-09-2008, 09:48 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,885,095.74448 seconds with 16 queries