Reputation: 363
I have made a script for adding a printer and port to a print server. The server handles the queue's and uses add a queue to start printing. However since the server is quite far from many of the printers i would like to activate the option "Print directly to the printer" (Which is found in, Printer ->Properties -> Advanced)
What is the PowerShell equivalent for this option?
$PortName = Read-Host "Name of port : "
$PortIp = Read-Host "IP Adress : "
Add-PrinterPort -Name $PortName -PrinterHostAddress $PortIp
Get-PrinterDriver
Write-Host "---------------------"
$PrintDriver = Read-Host "Print driver :"
if ($PrintDriver.Equals("HP")){ $PrintDriver = "HP Universal Printing PCL 6"}
$PrinterLocation = Read-Host "Location : "
Add-Printer -Name $PortName -DriverName $PrintDriver -Shared -Location $PrinterLocation -Published -PortName $PortName
I have tried -RenderingMode
but i couldnt see that that made any difference
Upvotes: 1
Views: 3192
Reputation: 612
You can do this with PowerShell and WMI:
$printer = Get-WmiObject -Class Win32_Printer -Filter "Name = 'PrinterName'"
$printer.Direct = $true
$printer.Put()
Probably should put a try {} catch {} around that as well.
This will also set the SpoolerEnabled
(deprecated read only property) and the DoCompleteFirst
property both to $false
.
http://www.powertheshell.com/reference/wmireference/root/cimv2/win32_printer/
Upvotes: 1