Option Explicit
'* Variablen
Dim objNetwork, objPrinters
Dim intLoop
Dim blnDOS, blnWin
'* Presets
blnDOS = vbTrue
blnWin = vbTrue
'* Kommandozeile auswerten
if Wscript.Arguments.Count > 0 then
for intLoop = 0 to Wscript.Arguments.Count-1
if ucase(WScript.Arguments.Item(intLoop)) = "/D" then blnDOS = vbFalse
if ucase(WScript.Arguments.Item(intLoop)) = "/W" then blnWin = vbFalse
next
end if
if (not blnDOS) AND (not blnWin) then WScript.Quit
'* Netzdrucker auf dem aktuellen System suchen und Trennen
Set objNetwork = WScript.CreateObject("WScript.Network")
Set objPrinters = objNetwork.EnumPrinterConnections
For intLoop = 0 to objPrinters.Count - 1 Step 2
If (Left(objPrinters.Item(intLoop+1),2)="\\") then
If (UCase(Left(objPrinters.Item(intLoop),3))="LPT") AND blnDOS then
objNetwork.RemovePrinterConnection objPrinters.Item(intLoop),-1,-1
ElseIf blnWin then
objNetwork.RemovePrinterConnection objPrinters.Item(intLoop+1),-1,-1
End If
End If
Next
WScript.Quit
Damit sollten alle Netzwerkdrucker entfernt werden. Um einen Defalt zu setzten hatte ich noch keine zeit, kannst du mir aber sagen wie du ihn default gesetzt hast?