This is pretty similar to the Print Script and uses the same formatting, the following example maps two drives R and S drives if you want to add more then you will need to change the script accordingly.
The script starts out with the (On Error Resume Next) again like the printer script so that it will move onto the next line of code if there is any errors
On Error Resume Next
Set objSysInfo = CreateObject("ADSystemInfo")
Set objNetwork = CreateObject("Wscript.Network")
'removes mapped drive R
objNetwork.RemoveNetworkDrive "R:", True, True
'removes mapped drive S
objNetwork.RemoveNetworkDrive "S:", True, True
'creates maped drive R
objNetwork.MapNetworkDrive "R:", "\\Server\Share1"
'creates maped drive S
objNetwork.MapNetworkDrive "S:", "\\Server\Share2"
This script will remove the two drives before it adds them as with the printer script, un like the printer script it still works even if the drives are not already mapped, if they are already there it will remove and re-add them. You can simply copy and past this script and change it to suit your needs this also needs to be saved with the file extension of *.vbs (mapdrives.vbs) and can be used with a Group Policy or can be double clicked and run.
No comments:
Post a Comment