Hallo
Ich muss mit hilfe von Vbcript ein code für unseren Firma erstellen.
1.Es muß überprüft werden welche netwerkdrucker bei ClientA ,ClientB ,…vorhanden sind.
2. Falls Drucker1,Drucker2,… nicht vorhanden sind soll die zugefügt werden.
3.DruckerX muss als Standarddrucker difiniert werden.
Hier ist mein vbscribt der nicht funktioniert!!
Const WbemAuthenticationLevelPktPrivacy = 6
Set objWbemLocator = CreateObject(„WbemScripting.SWbemLocator“)
Set objWMIService = objwbemLocator.ConnectServer(strComputer, „root\cimv2“, strUsername, strPassword)
objWMIService.Security_.authenticationLevel = WbemAuthenticationLevelPktPrivacy
Set objPrinters = objWMIService.ExecQuery(„Select * From Win32_Printer“)
For Each objPrinter In objPrinters
if not objprinter.name =" 1.OG-Oki C5400n-Farb" then
Set objNetwork = Wscript.CreateObject („WScript.Network“)
objNetwork.AddWindowsPrinterConnection „\server\1.OG-Oki C5400n-Farb“
if not objprinter.name =„1.OG-Kyocera Mita KM-5035 KX“ then
Set objNetwork = Wscript.CreateObject („WScript.Network“)
objNetwork.AddWindowsPrinterConnection „\server\1.OG-Kyocera Mita KM-5035 KX“
if not objprinter.name =„1.OG-HP LaserJet 4200tn“ then
Set objNetwork = Wscript.CreateObject („WScript.Network“)
objNetwork.AddWindowsPrinterConnection „\server\1.OG-HP LaserJet 4200tn“
if not objprinter.name =„1.OG-HP LaserJet 4100tn“ then
Set objNetwork = Wscript.CreateObject („WScript.Network“)
objNetwork.AddWindowsPrinterConnection „\server\1.OG-HP LaserJet 4100tn“
objNetwork.SetDefaultPrinter ("\server\1.OG-Kyocera Mita KM-5035 KX")
end if
WScript.Echo objPrinter.Name
Next
danke im voraus