' this script disconnects all disk and printer resources ' Create reference to the Wscript network object Dim WshNetwork On error Resume Next ' Call the addprinterconnection method Set WshNetwork = WScript.CreateObject("WScript.Network") Set oDrives = WshNetwork.EnumNetworkDrives Set oPrinters = WshNetwork.EnumPrinterConnections ' Delete all drives - except for M: For i = 0 to oDrives.Count - 1 Step 2 IF InStr(1,oDrives.Item(i), "M:")<>1 THEN WshNetwork.RemoveNetworkDrive oDrives.Item(i), true, true End If Next ' Delete all UNC-printers and LPT* - but not local printers. For i = 0 to oPrinters.Count - 1 Step 2 IF InStr(1,oPrinters.Item(i+1), "\\")=1 THEN IF InStr(oPrinters.Item(i), "LPT")=1 THEN WshNetwork.RemovePrinterConnection oPrinters.Item(i), true, true Else WshNetwork.RemovePrinterConnection oPrinters.Item(i+1), true, true End If End If Next