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
Windows XPWindows OSWindows 2000

Avatar of undefined
Last Comment
Shift-3

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Shift-3

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
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
Shift-3

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.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy