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
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