Add-PrinterConnection
Print Management: Adds connection to a network-based printer.
#Requires -Version 5.1
#Requires -Modules PrintManagement
[CmdletBinding()]
Param(
[Parameter(Mandatory = $true)]
[string]$ConnectionName
)
Process {
try {
Add-Printer -ConnectionName $ConnectionName -ErrorAction Stop | Out-Null
Write-Output "$(Get-Date -Format "yyyy-MM-dd HH:mm:ss") Add printer connection: $ConnectionName succeeded"
}
catch { throw }
}Name of the shared printer to which to connect.