derfeivel85
Goto Top

Druckerinstallation per WSH

Fehlermeldungen bei wenigen Rechnern im Netzwerk. Nicht Profil abhängig da auf anderen Rechner unter gleichem Login kein Fehler.

Hallo zusammen,

bei uns läuft mit der Anmeldung folgendes Script:

const kActionUnknown     = 0
const kActionAdd         = 1
const kActionAddConn     = 2
const kActionDel         = 3
const kActionDelConn     = 4
const kActionList        = 5
const kActionDelAll      = 6
const kActionDelConnAll  = 7

const kErrorSuccess      = 0
const KErrorFailure      = 1

const kPrinterNetwork    = 16                             
const kLocalPrinterFlag  = 64


'  
' Delete a printer connection  
'  
function DelPrinterConnection(strPrinter)

    on error resume next



    dim oMaster
    dim iRetval
    
    set oMaster = CreateObject("PrintMaster.PrintMaster.1")  

    oMaster.PrinterConnectionDel strPrinter

    if Err.Number = kErrorSuccess then

         
        iRetval = kErrorSuccess

    else
                     
        iRetval = kErrorFailure             
        
    end if
    
    DelPrinterConnection = iRetval

end function

    dim oMaster
    dim oPrinter
    dim iTotal
    dim iCount
    
    '  
    ' Total number of connections found  
    '  
    iTotal = 0
    
    '  
    ' Total number of connections deleted  
    '  
    iCount = 0
    
    set oMaster = CreateObject("PrintMaster.PrintMaster.1")  

    for each oPrinter in oMaster.Printers

        if Err.Number = kErrorSuccess then
        
            '  
            ' Test if the printer is not local   
            '      
            if (oPrinter.Attributes and kLocalPrinterFlag) <> kLocalPrinterFlag then
   
                iTotal = iTotal + 1
                
                if DelPrinterConnection(oPrinter.PrinterName) = kErrorSuccess then
                
                    iCount = iCount + 1
                    
                end if
                                                                
                Err.Clear           
            
            end if
           
                                                    
        end if

    next


Set WshNetwork = CreateObject("WScript.Network")  
dim txt,sig


txt=WshNetWork.ComputerName
sig=Left(txt,1)

strPrinterPath1 = "\\strserv\" & sig & "-D22-sw"  
strPrinterPath2 = "\\strserv\" & sig & "-D39-Kopierer"  
strPrinterPath3 = "\\strserv\" & sig & "-D39-Farbe"  
strPrinterPath4 = "\\strserv\" & sig & "-D40-sw"  
strPrinterPath5 = "\\strserv\" & sig & "-D42-sw"  
strPrinterPath6 = "\\strserv\" & sig & "-D43-sw"  
strPrinterPath7 = "\\strserv\" & sig & "-D47-sw"  
strPrinterPath8 = "\\strserv\" & sig & "-D53-sw"  
strPrinterPath9 = "\\strserv\" & sig & "-D55-sw"  
strPrinterPath10 = "\\strserv\" & sig & "-D56-sw"  
strPrinterPath11 = "\\strserv\" & sig & "-D60-SW"  
strPrinterPath12 = "\\strserv\" & sig & "-G06-SW"  
strPrinterPath13 = "\\strserv\" & sig & "-D46-sw"  
strPrinterPath14 = "\\strserv\" & sig & "-D52-sw"  



' Beispiel  
'strPrinterPath2 = "\\s-server\" & sig & "Farbe"  


WshNetwork.AddWindowsPrinterConnection strPrinterPath1
WshNetwork.AddWindowsPrinterConnection strPrinterPath2
WshNetwork.AddWindowsPrinterConnection strPrinterPath3
WshNetwork.AddWindowsPrinterConnection strPrinterPath4
WshNetwork.AddWindowsPrinterConnection strPrinterPath5
WshNetwork.AddWindowsPrinterConnection strPrinterPath6
WshNetwork.AddWindowsPrinterConnection strPrinterPath7
WshNetwork.AddWindowsPrinterConnection strPrinterPath8
WshNetwork.AddWindowsPrinterConnection strPrinterPath9
WshNetwork.AddWindowsPrinterConnection strPrinterPath10
WshNetwork.AddWindowsPrinterConnection strPrinterPath11
WshNetwork.AddWindowsPrinterConnection strPrinterPath12
WshNetwork.AddWindowsPrinterConnection strPrinterPath13
WshNetwork.AddWindowsPrinterConnection strPrinterPath14

'Drucker Als default setzen  
'WshNetwork.SetDefaultPrinter strPrinterPath3  

dim cRechnername, one, two

txt=WshNetWork.ComputerName
one = Left(txt,1)
two = Mid(txt,3,3) 
cRechnername = one & "-" & two  

'##############  
'Raum S-D22  
'##############  
if "S-D22" = cRechnername then  
                
	WshNetwork.SetDefaultPrinter strPrinterPath1
end if


'##############  
'Raum S-D40  
'##############  
if "S-D40" = cRechnername then  
 
	WshNetwork.SetDefaultPrinter strPrinterPath4
end if

'##############  
'Raum S-D42  
'##############  
if "S-D42" = cRechnername then  
 
	WshNetwork.SetDefaultPrinter strPrinterPath5
end if


'##############  
'Raum S-D43  
'##############  
if "S-D43" = cRechnername then  
	                
	WshNetwork.SetDefaultPrinter strPrinterPath6

end if



'##############  
'Raum S-D44  
'##############  
if "S-D44" = cRechnername then  
	                
	WshNetwork.SetDefaultPrinter strPrinterPath4

end if



'##############  
'Raum S-D46  
'##############  
if "S-D46" = cRechnername then  
	                
	WshNetwork.SetDefaultPrinter strPrinterPath13
end if


'##############  
'Raum S-D47  
'##############  
if "S-D47" = cRechnername then  
	                
	WshNetwork.SetDefaultPrinter strPrinterPath7

end if


'##############  
'Raum S-D52  
'##############  
if "S-D52" = cRechnername then  
	                
	WshNetwork.SetDefaultPrinter strPrinterPath14

end if



'##############  
'Raum S-D53  
'##############  
if "S-D53" = cRechnername then  
	                
	WshNetwork.SetDefaultPrinter strPrinterPath8

end if



'##############  
'Raum S-D55  
'##############  
if "S-D55" = cRechnername then  
	                
	WshNetwork.SetDefaultPrinter strPrinterPath9

end if




'##############  
'Raum S-D56  
'##############  
if "S-D56" = cRechnername then  
	                
	WshNetwork.SetDefaultPrinter strPrinterPath10

end if


	


'##############  
'Raum S-D60  
'##############  
if "S-D60" = cRechnername then  
	                
	WshNetwork.SetDefaultPrinter strPrinterPath11

end if


'##############  
'Raum S-G06  
'##############  
if "S-G06" = cRechnername then  
	                
	WshNetwork.SetDefaultPrinter strPrinterPath12

end if

Dieses soll den passenden Drucker nach dem jeweiligen Rechnername installieren. ( Rechnername = D-60 = Drucker des Raums D-60)

Das hat bisher auch immer gut funktioniert. Nun haben wir aber das 2. mal seit Weihnachten folgendes Problem:

User meldet sich an und bekommt folgende Fehlermeldung:

48325bea2796e47d5eae90bf4ae6a0c4-1

Es wird der 1. Drucker der Liste der Räume genommen, sprich der Drucker von D-22.
Userprofil neu machen ohne Erfolg
Rechner neu installiert hat nur bei 1 von 4 Rechnern das Problem behoben.
WSH neu installiert - ohne Erfolg
regsrv32 /u prnadmin.dll - ohne Erfolg

Findet jmd den Fehler? Schon kurz vor Weihnachten waren die gleichen Drucker betroffen: D-60; D-53; D-43. D-42 ist nach Rechnerneuinstallation wieder funktionstüchtig, Rechner D-40-02 war an Weihnachten betroffen, bisher nicht.


Kann mir jmd noch nen Tipp geben???

Vielen Dank schonmal.

Content-Key: 108611

Url: https://administrator.de/contentid/108611

Ausgedruckt am: 29.03.2024 um 12:03 Uhr

Mitglied: 60730
60730 10.02.2009 um 16:55:50 Uhr
Goto Top
Servus,

schau dir mal die an und stelle dein .vbs in Code Blöcke, so macht es mehr Spass Zeile 124 zu finden.

Gruß
Mitglied: derfeivel85
derfeivel85 12.02.2009 um 10:00:15 Uhr
Goto Top
Hoffe so ist es besser und ich hab die Formatierungshilfe richtig genutzt