How to Remove a Mapped Drive on VBS

How to Remove a Mapped Drive on VBS thumbnail
VBS scripts allows system administrators to remove mapped drives on a network.

The VBS (Visual Basic Script) scripting language supports the Component Object Model to access elements of the system in which it is executed. Microsoft Windows Script Host (WSH), Internet Explorer and Internet Information Services server can host VBS scripts. Windows system programmers often use VBS scripts for performing administrative tasks, such as management of the mapped network drives. You need to define the network object in order to remove a mapped drive on a network using the VBS script.

Instructions

    • 1

      Click the "Start" button in Windows and select "Microsoft Visual Studio."

    • 2

      Click "File" and select "VBScript" from the menu to VBS editor.

    • 3

      Add the following code in the window:

      Set objNetwork = CreateObject("WScript.Network")

      Set objShell = CreateObject("WScript.Shell")

      DriveLetter1 = "H:"

      RemotePath1 = "\\usr\device"

      objNetwork.MapNetworkDrive DriveLetter1, RemotePath1

      objShell.PopUp "Drive " & DriveLetter1 & " is disconnected."

      Wscript.Quit

    • 4

      Click "File," then "Save" to create the VBS script for removal of the "H" mapped drive on your network.

Related Searches:

References

Resources

  • Photo Credit Jupiterimages/Photos.com/Getty Images

Comments

You May Also Like

Related Ads

Featured