Link to home
Start Free TrialLog in
Avatar of Antonio King
Antonio King

asked on

Remove all drives accept home folder

Our users home folder is set in the active directory.
I have a logon script that removes all drives and remaps them depending on computer location.

This removes the home folder aswel.
How do I change this code to ignore the U: drive?

' =============================================================================
' Force removal of all network drives
' =============================================================================
On Error Resume Next
DIM objNetwork,colDrives,i
 
Set objNetwork = CreateObject("Wscript.Network")
Set colDrives = objNetwork.EnumNetworkDrives
 
For i = 0 to colDrives.Count-1 Step 2
	objNetwork.RemoveNetworkDrive colDrives.Item(i),TRUE,TRUE
Next

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Michael Pfister
Michael Pfister
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Antonio King
Antonio King

ASKER

Perfect