回答:
.VBSファイルを使用すると、次のことができます。
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery ("SELECT * FROM Win32_Printer")
Set colOperatingSystems = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem")
'DETERMINE OPERATING SYSTEM
For Each objOperatingSystem in colOperatingSystems
sOS = objOperatingSystem.Caption
objLogFile.WriteLine "OS defined as: " & objOperatingSystem.Caption
Next
'DETERMINE THE DEFAULT PRINTER
If InStr(sOS,"2000") <> 0 Then
For Each oPrinter in colItems
If oPrinter.Attributes And ATTR_DEFAULT Then
sDefaultPrinter = oPrinter.ShareName
End If
Next
Else
For Each objPrinter In colItems
If objPrinter.Default Then
sDefaultPrinter = objPrinter.ShareName
End If
Next
End If
'INITIALIZE THE LOCAL PRINTER OBJECTS
Set objNetwork = CreateObject("WScript.Network")
Set objLocalPrinters = objNetwork.EnumPrinterConnections
'LOOP THROUGH YOUR PRINTERS
For iCount = 0 to objLocalPrinters.Count - 1 Step 2
If InStr(UCase(Trim(objLocalPrinters.Item(iCount+1))), "PRINTERNAMETOREMOVE") <> 0
'REMOVES PRINTERS
objNetwork.RemovePrinterConnection objLocalPrinters.Item(iCount+1)
'ADDS PRINTERS
objNetwork.AddWindowsPrinterConnection "\\[PRINT SERVER]\[PRINTER NAME]"
'IF THE PRINTER WE REMOVED WAS THE DEFAULT PRINTER, SET THE NEW ONE AS THE DEFAULT
If InStr(UCase(Trim(objLocalPrinters.Item(iCount+1))), UCase(Trim(sDefaultPrinter))) <> 0 Then
objNetwork.SetDefaultPrinter "\\[PRINT SERVER]\[PRINTER NAME]"
End If
End If
Next
これは、バッチスクリプトで使用するコマンドです。
prncfg
事前にドキュメントを確認してください。
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/prncnfg.mspx