Link to home
Create AccountLog in
Avatar of amd_kickass
amd_kickass

asked on

VBScript to remove shares by server name

All,

I am looking for a VBscript to remove network drives when they are mapped to a specific server not by drive letter
e.g.

X: \\server1\share1
Y: \\server2\share
Z: \\server1\share33

in this example drives X & Z would be removed but these could be any letters on a different machine

Cheers,
Mark
ASKER CERTIFIED SOLUTION
Avatar of Shift-3
Shift-3
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of amd_kickass
amd_kickass

ASKER

Thanks,

It works correctly but does not end cleanly it terminates with the following error:
(14, 17) Microsoft VBScript runtime error: Type mismatch: 'objNetwork.RemoveNetworkDrive'

Regards,
Mark
I'm not able to replicate the error.  However, if it is removing the drives correctly then the simplest solution would be to add On Error Resume Next to the beginning of the script.