Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Installer une imprimante via GPO

2 réponses
Avatar
oceanex
Bonjour
J'aimerais pouvoir ajouter une imprimante VIA GPO (ou de n'importe
quel manière) sur les postes des usagers.
Je n'utilise pas un serveur d'impression, c'est une imprimante
connecté directement sur le réseau (avec une addresse ip)

Je suis sur que ca peut se faire, j'ai cherché un peu, j'ai trouvé
quelques endroits ou il parle que sa peut se faire, mais je cherche
juste comment exactement.

Sur un forum il disait de faire cela

Citation:
If you have a domain try this:
1. create an ou
2. put workstations into ou
3. create a gpo linked to the ou
4. in the gpo "computer section"Admin
templates,system,group policy enable-
user group policy loopback proccecing mode (merge)
5. get the program called con2prt.exe (search google) and
put this in a folder on your server (netlogon etc)
6. create a batch file (in netlogon)
called "whatever.bat" in this write something like this-

@echo off
\\servername\netlogon\con2prt /f
\\servername\netlogon\con2prt /c
\\printserver\printer
\\servername\netlogon\con2prt /cd
\\printserver\printer

7. in the gpo "user settings" windows settings, scripts,
logon script point to the "whatever.bat" file


users that log onto the worstations in the ou you created
above will have all printers deleted and the ones
you specify in the script mapped./f is delete /c is
create /cd is create as default.

It works for me, i am network manager at a school and
needed a solution for the mapping of students to printers
depending on the room they were in.

it took a while to get this together but its here for
anybody now.
Fin de la citation

Est ce qu'il y a un moyen plus simple?
une meilleur idée et qui marcherait avec une addresse ip.

Je vous remercie d'avance

Gege

2 réponses

Avatar
Stéphane [MS]
Bonjour,

Non, vous ne pouvez pas utiliser une adresse IP dans ce script car Con2prt
ne faire qu'établir la connexion vers un serveur d'impression. Le
téléchargement du pilote d'impression repose sur le mécanisme standard des
serveurs d'impression de Microsoft.

En dehors de la problématique du pilote, il vous faudrait aussi créer le
port qui serait considéré comme local.

Je ne crois pas que cela puisse se faire, mais peut-être quelqu'un d'autre
connait une astuce.

Cdlt
Stéphane

"Gege" a écrit dans le message de news:

Bonjour
J'aimerais pouvoir ajouter une imprimante VIA GPO (ou de n'importe
quel manière) sur les postes des usagers.
Je n'utilise pas un serveur d'impression, c'est une imprimante
connecté directement sur le réseau (avec une addresse ip)

Je suis sur que ca peut se faire, j'ai cherché un peu, j'ai trouvé
quelques endroits ou il parle que sa peut se faire, mais je cherche
juste comment exactement.

Sur un forum il disait de faire cela

Citation:
If you have a domain try this:
1. create an ou
2. put workstations into ou
3. create a gpo linked to the ou
4. in the gpo "computer section"Admin
templates,system,group policy enable-
user group policy loopback proccecing mode (merge)
5. get the program called con2prt.exe (search google) and
put this in a folder on your server (netlogon etc)
6. create a batch file (in netlogon)
called "whatever.bat" in this write something like this-

@echo off
servernamenetlogoncon2prt /f
servernamenetlogoncon2prt /c
printserverprinter
servernamenetlogoncon2prt /cd
printserverprinter

7. in the gpo "user settings" windows settings, scripts,
logon script point to the "whatever.bat" file


users that log onto the worstations in the ou you created
above will have all printers deleted and the ones
you specify in the script mapped./f is delete /c is
create /cd is create as default.

It works for me, i am network manager at a school and
needed a solution for the mapping of students to printers
depending on the room they were in.

it took a while to get this together but its here for
anybody now.
Fin de la citation

Est ce qu'il y a un moyen plus simple?
une meilleur idée et qui marcherait avec une addresse ip.

Je vous remercie d'avance

Gege


Avatar
oceanex
Apres de nombreuse heures de recherche j'ai trouvé
Oui c'est tres possible, et je savais que cela le serait.
J'ai essayé se script et ca la marché, il télécharge les drivers, les
installes et crée l'imprimante.

il ne reste plus qu'a trouvé un moyen de pouvoir configuré cette
derniere sans devoir allé sur chaque poste (le dernier bac est en A4
et il doit etre en légal, je dois inclure une page de séparation, et
de petit truc comme ca que les users ne sont pas capable de faire
seul.)

si quelqu un connait la solution... elle serait plus que la bienvenue!

merci d'avance

gege

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: servershare"
WshShell.Run "xcopy x:prnadmin.dll %systemroot%system32 /D /R
/Y",0,true
WshShell.Run "regsvr32 /s %systemroot%system32prnadmin.dll",0,TRUE

'=================================================================== '= Adding the printer drivers '=================================================================== '========= Check for printer driver HP 4100 PS ===========
sKeyPathHP4100 = "HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlPrintEnvironmentsWindows
NT x86DriversVersion-3HP 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:Drivershp4100pshp4100ps.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