jaramart
asked on
Network Drive Scripts
Howdy i am just wondering if anyone has a script either batch or VBS that connects networked Mapped Drives at loggon. However i want it to be able to Remove the drive letter assigned to removable drives ie. USB or card Readers. so that that mappings are uniformed accross the site.
thanks
thanks
You can also remove all mapped drives without error
net use * /delete
ASKER
Can you give it parameters ie. remove all except c:
The net use command will not map drives or remove local drive letters that have already been assigned by the local machine.
You'll need an application to eject local devices - I have used the one described in this link with success: http://www.howtogeek.com/howto/windows-vista/create-a-shortcut-or-hotkey-to-immediately-eject-a-specific-usb-drive/
You can use the FileSystemObject to loop through all the drives and check if each 1) conflicts with a network mapping and 2) it's drive type is removable, and if so run the command in the link above.
http://msdn.microsoft.com/en-us/library/hww8txat(v=VS.85).aspx
You can use the FileSystemObject to loop through all the drives and check if each 1) conflicts with a network mapping and 2) it's drive type is removable, and if so run the command in the link above.
http://msdn.microsoft.com/en-us/library/hww8txat(v=VS.85).aspx
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Can you give it parameters ie. remove all except c:
Can't think of a way except the elaborate
net use D: /delete
net use E: /delete
etc
Yes, you can just loop through the Drives and if DriveLetter <> "C:" then delete it.
However, 1) you can't use "net use /delete" to remove USB drives, and 2) I don't see any sense in removing drive letters unless they conflict with a network mapping.
However, 1) you can't use "net use /delete" to remove USB drives, and 2) I don't see any sense in removing drive letters unless they conflict with a network mapping.
Open in new window