Compare commits

..

2 Commits

View File

@ -1,17 +1,36 @@
# install the driver inf # "ClassroomColor": "Dell C2660dn Color Laser PS",
"PNPUtil.exe /add-driver \\\\ucs\\software\\drivers\\dell\\c2660dn_PS\\DLPRFAL.inf /install": {% set printers = {
cmd.run: "ClassroomColor_HP": "HP LJ300-400 color M351-M451 PCL6 Class Driver",
- shell: powershell "Classroom_MFP": "Brother MFC-9970CDW Printer"
- unless: Get-PrinterDriver -Name 'Dell C2660dn Color Laser PS' }
%}
# add the driver as a printer driver
"Add-PrinterDriver -Name 'Dell C2660dn Color Laser PS'": # install all printer driver inf files
"PNPUtil.exe /add-driver \\\\ucs\\software\\drivers\\printers\\*.inf /subdirs /install":
cmd.run: cmd.run:
- shell: powershell - shell: powershell
- unless: Get-PrinterDriver -Name 'Dell C2660dn Color Laser PS' # TODO: ideally would actually check for success better
- success_retcodes: [1]
{% for printer, driver in printers.items() %}
# add the driver as a printer driver
"Add-PrinterDriver -Name '{{ driver }}'":
cmd.run:
- shell: powershell
- unless: Get-PrinterDriver -Name '{{ driver }}'
# add the printer # add the printer
"Add-Printer -Name ClassroomColor -PortName 'http://ucs.sawtooth.claremontmakerspace.org:631/printers/ClassroomColor' -DriverName 'Dell C2660dn Color Laser PS'": "Add-Printer -Name '{{ printer | replace('_', ' ')}}' -PortName 'http://ucs.sawtooth.claremontmakerspace.org:631/printers/{{ printer }}' -DriverName '{{ driver }}'":
cmd.run: cmd.run:
- shell: powershell - shell: powershell
- unless: Get-Printer -Name ClassroomColor - unless: Get-Printer -Name '{{ printer | replace('_', ' ') }}'
{% endfor %}
# enable duplexer for Classroom HP
"Set-PrinterProperty -PrinterName 'ClassroomColor HP' -PropertyName Config:DuplexUnit -Value Installed":
cmd.run:
- shell: powershell
- unless:
- if ($(Get-PrinterProperty -PrinterName "ClassroomColor HP" -PropertyName Config:DuplexUnit).value -eq "Installed") { exit 0 } else { exit 1 }