Skip to main content
Jorge Bernhardt Jorge Bernhardt
  1. Posts/

How to share a Printer with PowerShell

·233 words·2 mins· 100 views · 5 likes ·
Get-Printer Microsoft Microsoft Windows PowerShell

Hi, today I want to show you how to share a printer using PowerShell. The cmdlet I will use is Set-Printer. This cmdlet allows to establish or update the configuration of a specified printer.

Set-Printer
To share a printer with PowerShell, use the Set-Printer cmdlet with the following syntax:

Set-Printer `
    -Name "printer name" `
    -Shared $True|$False `
    -ShareName "share name"
The workaround in a local computer>

The workaround in a local computer #

With the Get-Printer cmdlet, we obtain the list of installed printers and their basic properties. The “Shared” column shows us if the printer is already shared.

Get-printer
Now that we have the printer’s data that we want to share, we use the Set-Printer cmdlet. Run the PowerShell console as administrator, and then type:
Set-Printer
Then you can verify the job with the Get-Printer cmdlet.

The workaround in a remote computer>

The workaround in a remote computer #

To share the printer from a remote server, use the -ComputerName parameter to specify the name or IP of the remote computer. The syntax is the following:

Set-Printer `
    -ComputerName "Remote Computer" `
    -Name "printer name" `
    -Shared $True|$False `
    -ShareName "share name"

Set-Printer
Again, we verify that the printer is shared with the Get-Printer cmdlet with the -ComputerName parameter.

Thanks for reading my post. I hope you find it useful.

If you want to know more about the Set-Printer cmdlet, check out this link: https://docs.microsoft.com/en-us/powershell/module/printmanagement/set-printer?view=win10-ps