Printer driver management and user-based printer management
Printer driver installation
The printer driver installation will occur in 2 steps
- Adding the drivers to Windows
:: Commande dos
:: Installing printers Drivers in Windows
pnputil /add-driver "c:\Drivers\Printers\*.inf" /subdirs /install
- Adding drivers to the spooler
# Powershell command to inject drivers into the spooler.
Add-PrinterDriver -Name "KONICA MINOLTA 4020_3320 PCL6"
Add-PrinterDriver -Name "KONICA MINOLTA 4700PSeries PCL6"
Add-PrinterDriver -Name "KONICA MINOLTA 20 Printer"
Driver management by a user
Once the drivers are in the spooler, the user can install their printers themselves (adding ports and selecting available drivers from the spooler).
Exemple with SNMP detect
# script powershell
# Find printer model
$printer1 = "adresseIP ou NomDNS de l'imprimante"
$SNMP = New-Object -ComObject olePrn.OleSNMP
$snmp.open($Printer1,"public",2,3000)
$Model1 = $SNMP.GetTree('.1.3.6.1.2.1.25.3.2.1.3')
# Suppress printer if exist
Get-Printer | Where name -eq 'PRT01' | Remove-Printer
# Suppress LPR port if exist
Get-PrinterPort | Where name -eq 'prt01' | Remove-PrinterPort
if ($Model1 -match "KONICA MINOLTA bizhub 3320") {
# Create LPR port
Add-PrinterPort -Name 'prt01' -PrinterHostAddress $Printer1
# Create printer
add-printer -name "PRT01" -drivername "KONICA MINOLTA 4020_3320 PCL6" -port "prt01"
}
0 Comments