Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleting and mapping network drives

Status
Not open for further replies.

jack1529

Technical User
Jun 19, 2008
7
US
I am new to vbs and I want to delete network drives if they exist and then map new network drives. Below is a script I put together but it does not work. Please help!

Set WSHNetwork = CreateObject("WScript.Network")
Set objNetwork = WScript.CreateObject("WScript.Network")

If exist WSHNetwork.RemoveNetworkDrive "V:"
If exist WSHNetwork.RemoveNetworkDrive "S:"
If exist WSHNetwork.RemoveNetworkDrive "B:"

wscript.sleep 500

WSHNetwork.MapNetworkDrive "V:", "\\...\"
WSHNetwork.MapNetworkDrive "S:", "\\...\"
WSHNetwork.MapNetworkDrive "B:", "\\...\...\" & objNetwork.ComputerName
 
Check the FAQ. There is a very good entry on log on scripts that will have the syntax you want to use.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top