Applies to Windows 8.1 or Windows Server R2
Windows 8.1 and Windows Server R2 introduces a component: "Printmanagement", which contains all the commands used to manage local and remote machine printers.
The following example demonstrates installing a printer driver and printer port, first installing a printer, sharing it, and setting some properties.
Copy Code code as follows:
$ComputerName = $env: ComputerName
$DriverName = ' Samsung scx-483x 5x3x Series XPS '
$IPAddress = ' 192.168.2.107 '
$PortName = ' networkprint_192.168.2.107 '
$PrinterName = ' Bwprint '
$ShareName = ' Office 12 '
Add-printerdriver-computername $ComputerName-name $DriverName
Add-printerport-name $PortName-computername $ComputerName
Add-printer-computername $ComputerName-name $PrinterName-drivername $DriverName-shared-sharename $ShareName- PortName $PortName
Set-printconfiguration-computername $ComputerName-printername $PrinterName-papersize A4
Of course, you have to run it to make sure that the adjustment variable $IPAddress point to the real presence of the printer address. Change the $computername from the local machine name to the remote machine name.
You can view all the PowerShell commands in the Printmanagement component in this way:
Copy Code code as follows:
Ps> Get-command-module printmanagement
CommandType Name ModuleName
----------- ---- ----------
Function Add-printer printmanagement
Function Add-printerdriver printmanagement
Function Add-printerport printmanagement
Function get-printconfiguration printmanagement
Function Get-printer printmanagement
Function Get-printerdriver printmanagement
Function Get-printerport printmanagement
Function Get-printerproperty printmanagement
Function Get-printjob printmanagement
Function Read-printernfctag printmanagement
Function Remove-printer printmanagement
Function Remove-printerdriver printmanagement
Function Remove-printerport printmanagement
Function Remove-printjob printmanagement
Function Rename-printer printmanagement
Function Restart-printjob printmanagement
Function Resume-printjob printmanagement
Function set-printconfiguration printmanagement
Function Set-printer printmanagement
Function Set-printerproperty printmanagement
Function Suspend-printjob printmanagement
Function Write-printernfctag printmanagement
In fact, they are just some PowerShell functions, not compiled binary commands.