Forum Discussion
Jun 21, 2022
Blogpost - Adding printer drivers to Endpoint Manager using PowerShell
Wrote a blogpost about adding printerdrivers to Endpoint Manager, scripts are: (Fore more details, https://powershellisfun.com/2022/06/21/adding-printer-drivers-with-endpoint-manager-and-powershell/)
Install_Printerdrivers.ps1
$drivers = Import-Csv .\Drivers.csv -Delimiter ','
foreach ($driver in $drivers) {
C:\Windows\Sysnative\pnputil.exe -a $driver.Path
Start-Sleep -Seconds 5
Add-PrinterDriver -Name $driver.name
}
New-Item -Path c:\programdata\customer\Printers\printers.txt -Force:$true -Confirm:$false
Remove_Printerdrivers.ps1
$drivers = Import-Csv .\Drivers.csv -Delimiter ','
foreach ($driver in $drivers) {
Remove-PrinterDriver -Name $driver.name -Confirm:$false
Start-Sleep -Seconds 5
C:\Windows\Sysnative\pnputil.exe -d $driver.Path
}
remove-Item -Path c:\programdata\customer\Printers -Recurse -Force:$true -Confirm:$false
drivers.csv
Name,Path
Canon Generic Plus PCL6,Canon\C5840i\GPlus_PCL6_Driver_V240_32_64_00\x64\Driver\cnp60ma64.inf
Canon Generic Plus PS3,Canon\C165\GPlus_PS3_Driver_V240_32_64_00\x64\Driver\cns30ma64.inf
HP ColorLaserJet MFP M278-M281 PCL-6 (V4),HP\HP ColorLaserJet MFP M278-M281 PCL-6 (V4)\hpzead2a4_x64.inf
HP DesignJet Universal Print Driver HPGL2(v5.9.0),HP\HP Designjet Universal\win-x64-hpgl2-drv\hpi91edx.inf
HP LaserJet M507 PCL-6 (V4),HP\M507\HP_LJM507\HP_LJM507_V4\hpkoca2a4_x64.inf
HP LaserJet Mono PCLmS Class Driver,HP\HP LaserJet Mono PCLmS\prnhpcl1.inf
HP LaserJet Pro M501 PCL-6,HP\HP_LaserJet_Pro_M501_Series\hpbi652a4_x64.inf
HP Universal Printing PCL 6,HP\HP Universal\hpcu225u.inf
HP Universal Printing PCL 6 (v6.7.0),HP\HP Universal\hpcu225u.inf
HP Universal Printing PCL 6 (v7.0.0),HP\CP2025\upd-pcl6-x64-7.0.0.24832\hpcu250u.inf
HP Universal Printing PCL 6 (V7.0.1),HP\HP Universal Print Driver\pcl6-x64-7.0.1.24923\hpcu255u.inf
Generic 36C-9SeriesPCL,Konica Minolta\Generic 36C-9SeriesPCL\koaycja_.inf
Install.cmd
powershell.exe -executionpolicy bypass .\install_printerdrivers.ps1
Uninstall.cmd
powershell.exe -executionpolicy bypass .\remove_printerdrivers.ps1
Create a .intunewinpackage with this and use a detection on c:\programdata\customer\printers\printers.txt
No RepliesBe the first to reply