
18-05-2009
|
 | 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 :- Preamble, create a mapped network drive = P: (See Below)
- Copy and paste the main script into notepad.
- Change the server name ALAN to the name of Your server. Check the share name = Drivers.
- Save the file with .vbs extension e.g. RemoveDrive.vbs
- Double click and observe drive letters in explorer. What you are looking for is the P:\ drive.
- 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 |