OK, before everyone tells me to look at the FAQs... I have!
I have ascript that deletes all mapped network drives, but I want to preserve their H: drive (user Home Dir).
Here's the basic remove all:
===============
On error resume next
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set oDrives = WshNetwork.EnumNetworkDrives
Set oPrinters = WshNetwork.EnumPrinterConnections
For i = 0 to colDrives.Count-1 Step 2
WshNetwork.RemoveNetworkDrive oDrives.Item(i),true,true
Next
For i = 0 to oPrinters.Count - 1 Step 2
WshNetwork.RemovePrinterConnection oPrinters.Item(i+1)
Next
==========================
How do I keep users' H: drive and remove all the others?
Thanks!!
Brandon
I have ascript that deletes all mapped network drives, but I want to preserve their H: drive (user Home Dir).
Here's the basic remove all:
===============
On error resume next
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set oDrives = WshNetwork.EnumNetworkDrives
Set oPrinters = WshNetwork.EnumPrinterConnections
For i = 0 to colDrives.Count-1 Step 2
WshNetwork.RemoveNetworkDrive oDrives.Item(i),true,true
Next
For i = 0 to oPrinters.Count - 1 Step 2
WshNetwork.RemovePrinterConnection oPrinters.Item(i+1)
Next
==========================
How do I keep users' H: drive and remove all the others?
Thanks!!
Brandon