Deployer imprimante
MJ75
-
ORKOID Messages postés 3 Statut Membre -
ORKOID Messages postés 3 Statut Membre -
Bonjour je cherche a faire un script vbs qui ajoute une imprimante (tcp/ip)
sur une machine distante.
J'ai deja essayer un script: (en local, pour le faire a distance je dois
rajouter -s aprés "-p nom_imprimante")
script prnmngr.vbs -a -p STAFFIMP -m "HP LaserJet 1100 (MS)" -r
IP_10.50.51.142
Le probleme etant que ce script fonctionne que si les port TCP/IP existe
(IP_10.50.51.142)
en gros je cherche a faire un deployment d'imprimante.
Merci d'avance.
pouvez vous m'aider
sur une machine distante.
J'ai deja essayer un script: (en local, pour le faire a distance je dois
rajouter -s aprés "-p nom_imprimante")
script prnmngr.vbs -a -p STAFFIMP -m "HP LaserJet 1100 (MS)" -r
IP_10.50.51.142
Le probleme etant que ce script fonctionne que si les port TCP/IP existe
(IP_10.50.51.142)
en gros je cherche a faire un deployment d'imprimante.
Merci d'avance.
pouvez vous m'aider
A voir également:
- Deployer imprimante
- Spouleur imprimante - Guide
- Télécharger pilote imprimante hp - Télécharger - Pilotes & Matériel
- E0 imprimante hp - Forum Matériel & Système
- Imprimante temporairement arrêtée ✓ - Forum Imprimante
- Télécharger pilote imprimante hp deskjet 2320 pour windows 10 - Forum Imprimante
1 réponse
SALUT JE SUIS EXACTEMENT DANS LA MÊME PROBLEMATIQUE QUE TOI...
si tu as la solution finale, n'ésite pas à me contacter: erwan.bluteau@laposte.fr
mais pour la création de ton port je connais un autre script VBS qui s'appel PRNPORT.VBS , étudie le et dis moi ce que tu en as retiré.
je te passe un script sur lequel je travail mais que je n'ai pas encore réussi à faire fonctionner:
The example is a HP laserjet 4100 with a Postscript Driver. The IP address of the printer is 192.168.1.200
'*******************
On Error Resume Next
Dim WshNetwork
Dim WshShell
Set WSHNetwork = WScript.CreateObject("WScript.Network")
'========= Register prnadmin.dll file on client computer ============
Set WshShell = Wscript.CreateObject("Wscript.Shell")
WshShell.Run "net use x: \\server\share"
WshShell.Run "xcopy x:\prnadmin.dll %systemroot%\system32\ /D /R /Y",0,true
WshShell.Run "regsvr32 /s %systemroot%\system32\prnadmin.dll",0,TRUE
'====================================================================
'= Adding the printer drivers =
'====================================================================
'========= Check for printer driver HP 4100 PS ============
sKeyPathHP4100 = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Environments\Windows NT x86\Drivers\Version-3\HP LaserJet 4100 PS"
If RegKeyExists(sKeyPathHP4100) Then
'WScript.Echo "Key exists"
Else
'WScript.Echo "Key do not exist"
Set WshShell = Wscript.CreateObject("Wscript.Shell")
WshShell.Run "rundll32 printui.dll,PrintUIEntry /ia /m ""HP LaserJet 4100 PS"" /h ""Intel"" /v ""Windows 2000"" /f x:\Drivers\hp4100ps\hp4100ps.inf /u" , 2 , true
End If
'====================================================================
'= Check for installed printers =
'====================================================================
Dim myPort_192_168_1_200
myPort_192_168_1_200 = 0
strComputer = "."
Set oSvc = GetObject("winmgmts:\\" & strComputer )
Set Printers = oSvc.Get("win32_printer").Instances_
default = false
for each printer in Printers
if printer.portname = "IP_192.168.1.200" then
myPort_192_168_1_200 = 1
else
'MsgBox "else:" &printer.name ,ok
End If
next
if myPort_192_168_1_200 <> 1 then
'====================================================================
'= HP4100 = 192.168.1.200 =
'====================================================================
'************** Create the port *************************************
dim oPort
dim oMaster
Set oPort = CreateObject("Port.Port.1")
Set oMaster = CreateObject("PrintMaster.PrintMaster.1")
oPort.PortName = "IP_192.168.1.200"
oPort.PortType = 1
oPort.HostAddress ="192.168.1.200"
oMaster.PortAdd oPort
if ErrHP4100 <> 0 then
msgbox "There was an error creating the port. 200"
end if
'********************************************************************
'************** Create the printer **********************************
dim oPrinter
Set oPrinter = CreateObject("Printer.Printer.1")
oPrinter.PrinterName = "HP4100" ' name of the printer as it appears in the Printers folder
oPrinter.DriverName = "HP LaserJet 4100 PS" ' name that is referenced in ntprint.inf or specific driver
oPrinter.PortName = "IP_192.168.1.200" ' Specify a port name. Can also point to LPT or COM port.
oMaster.PrinterAdd oPrinter
If ErrHP4100 <> 0 then
msgbox "There was an error creating the printer. 200"
end if
'********************************************************************
End If
WshShell.Run "net use x: /delete"
' --- Subroutine Check Registry for printer driver key-----------------
Function RegKeyExists(sRegKey)
Set oShell = CreateObject("WScript.Shell")
RegKeyExists = True
sRegKey = Trim (sRegKey)
If Not Right(sRegKey, 1) = "\" Then
sRegKey = sRegKey & "\"
End if
On Error Resume Next
RegReadReturn = oShell.RegRead(sRegKey)
If Err Then
If LCase(Left(err.description,7)) = "invalid" Then
'key not found...
RegKeyExists = False
End if
Err.clear
End if
On Error Goto 0
si tu as la solution finale, n'ésite pas à me contacter: erwan.bluteau@laposte.fr
mais pour la création de ton port je connais un autre script VBS qui s'appel PRNPORT.VBS , étudie le et dis moi ce que tu en as retiré.
je te passe un script sur lequel je travail mais que je n'ai pas encore réussi à faire fonctionner:
The example is a HP laserjet 4100 with a Postscript Driver. The IP address of the printer is 192.168.1.200
'*******************
On Error Resume Next
Dim WshNetwork
Dim WshShell
Set WSHNetwork = WScript.CreateObject("WScript.Network")
'========= Register prnadmin.dll file on client computer ============
Set WshShell = Wscript.CreateObject("Wscript.Shell")
WshShell.Run "net use x: \\server\share"
WshShell.Run "xcopy x:\prnadmin.dll %systemroot%\system32\ /D /R /Y",0,true
WshShell.Run "regsvr32 /s %systemroot%\system32\prnadmin.dll",0,TRUE
'====================================================================
'= Adding the printer drivers =
'====================================================================
'========= Check for printer driver HP 4100 PS ============
sKeyPathHP4100 = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Environments\Windows NT x86\Drivers\Version-3\HP LaserJet 4100 PS"
If RegKeyExists(sKeyPathHP4100) Then
'WScript.Echo "Key exists"
Else
'WScript.Echo "Key do not exist"
Set WshShell = Wscript.CreateObject("Wscript.Shell")
WshShell.Run "rundll32 printui.dll,PrintUIEntry /ia /m ""HP LaserJet 4100 PS"" /h ""Intel"" /v ""Windows 2000"" /f x:\Drivers\hp4100ps\hp4100ps.inf /u" , 2 , true
End If
'====================================================================
'= Check for installed printers =
'====================================================================
Dim myPort_192_168_1_200
myPort_192_168_1_200 = 0
strComputer = "."
Set oSvc = GetObject("winmgmts:\\" & strComputer )
Set Printers = oSvc.Get("win32_printer").Instances_
default = false
for each printer in Printers
if printer.portname = "IP_192.168.1.200" then
myPort_192_168_1_200 = 1
else
'MsgBox "else:" &printer.name ,ok
End If
next
if myPort_192_168_1_200 <> 1 then
'====================================================================
'= HP4100 = 192.168.1.200 =
'====================================================================
'************** Create the port *************************************
dim oPort
dim oMaster
Set oPort = CreateObject("Port.Port.1")
Set oMaster = CreateObject("PrintMaster.PrintMaster.1")
oPort.PortName = "IP_192.168.1.200"
oPort.PortType = 1
oPort.HostAddress ="192.168.1.200"
oMaster.PortAdd oPort
if ErrHP4100 <> 0 then
msgbox "There was an error creating the port. 200"
end if
'********************************************************************
'************** Create the printer **********************************
dim oPrinter
Set oPrinter = CreateObject("Printer.Printer.1")
oPrinter.PrinterName = "HP4100" ' name of the printer as it appears in the Printers folder
oPrinter.DriverName = "HP LaserJet 4100 PS" ' name that is referenced in ntprint.inf or specific driver
oPrinter.PortName = "IP_192.168.1.200" ' Specify a port name. Can also point to LPT or COM port.
oMaster.PrinterAdd oPrinter
If ErrHP4100 <> 0 then
msgbox "There was an error creating the printer. 200"
end if
'********************************************************************
End If
WshShell.Run "net use x: /delete"
' --- Subroutine Check Registry for printer driver key-----------------
Function RegKeyExists(sRegKey)
Set oShell = CreateObject("WScript.Shell")
RegKeyExists = True
sRegKey = Trim (sRegKey)
If Not Right(sRegKey, 1) = "\" Then
sRegKey = sRegKey & "\"
End if
On Error Resume Next
RegReadReturn = oShell.RegRead(sRegKey)
If Err Then
If LCase(Left(err.description,7)) = "invalid" Then
'key not found...
RegKeyExists = False
End if
Err.clear
End if
On Error Goto 0