Printers

PrintManagement

https://docs.microsoft.com/en-us/powershell/module/printmanagement/?view=win10-ps

https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/pnputil-command-syntax
pnputil /add-driver C:\driver.inf

PrinterDriver

Get-PrinterDriver -Name *
Get-PrinterDriver -Name * -ComputerName $Computer
Add-PrinterDriver -ComputerName $Computer -Name "Canon Generic Plus PCL6"
Remove-PrinterDriver -Name "Canon Generic Plus PCL6"
Remove-PrinterDriver -ComputerName $Computer -Name "Canon Generic Plus PCL6"

PrinterPort

Add-PrinterPort -ComputerName $Computer -Name "MyPrinterPort" -PrinterHostAddress "IPaddress"

Printer

Remove-Printer -ComputerName $Computer -Name "MyPrinter"
Add-Printer -ComputerName $Computer -Name "MyPrinter" -DriverName $DriverName -PortName "MyPrinterPort"

Misc

Printer deployment does not work with the “Default Printer” setting, so scripting is the way:

#Get computers to install office on
$Computers = (Get-ADComputer -Filter * -SearchBase "OU=MyComputers,DC=contoso,DC=com").Name
#$Computers = "example"
ForEach ($Computer in $Computers)
{
    Write-Host "Working on $Computer" -ForegroundColor White

    Write-Host "Testing access to $Computer" -ForegroundColor White
    $HostUp = Test-Connection -ComputerName $Computer -BufferSize 12 -Count 1
    If (!($HostUp)) {
        Write-Warning -Message "Remote Host is not accessible!"
    }
    Else {
        Write-Host "Success!" -ForegroundColor Green
        #$items = Get-Item -Path \\fs\software\ODT\*
        #Write-Host "Creating Transfer folder on $Computer" -ForegroundColor Yellow
        #New-Item -Path \\$Computer\c$\Transfer -ItemType Directory -ErrorAction SilentlyContinue | Out-Null
        #foreach ($item in $items)
        #{
        #    Write-Host "Copying $Item over to $Computer\c$\Transfer\" -ForegroundColor Yellow
        #    Copy-Item -Path $item -Destination \\$Computer\C$\Transfer\ -Force
        #}
        #Write-Host "Starting setup on $Computer" -ForegroundColor White

        #Invoke-Command -ScriptBlock { set-location "C:\Transfer\"; .\setup.exe /configure remove_all.xml; .\setup.exe /configure installconfig.xml } -ComputerName $Computer -AsJob

        Add-PrinterDriver -ComputerName $Computer -Name "Canon Generic Plus PCL6"


        Add-PrinterPort -ComputerName $Computer -Name "PortName" -PrinterHostAddress "IPaddress"
        Add-Printer -ComputerName $Computer -Name "PrinterName" -DriverName "Canon Generic Plus PCL6" -PortName "PortName"
    }
}
Get-Job | Format-Table

https://docs.microsoft.com/en-us/powershell/module/printmanagement/?view=win10-ps