Example of using printmanagement to manage printers in PowerShell _powershell

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.