How to Install The Print Server Role Using PowerShell

In today’s tutorial, we’ll show you how you can use PowerShell to add the print server role on Microsoft Server 2022 and share your network printers.

These days, the print server is not exactly the most important network service out there, but it is still a very important function for many companies and it’s unlikely to disappear anytime soon.

Many companies still use printers to print out reports, invoices and other documents, so it’s important to know how to set up and configure this kind of service. And by using PowerShell, you can save yourself a lot of time and also automate repetitive tasks.

In this tutorial, we’ll show you how to do the following:

  • Part 1 – Install the Print Server role using PowerShell
  • Part 2 – Deploy a shared printer on the print server

 

How to Add Network Printers Using PowerShell

 

Before you get started…

To successfully complete this tutorial, you will need the following:

  • To be registered with an organisation on the Jotelulu platform and to have logged in.

 

 

Part 1 – Installing the Print Server Role Using PowerShell

The very first thing you need to do is install the Print Server role on your server. You can do this either through Server Manager or PowerShell, but for the purposes of this tutorial, we’re going to stick to PowerShell.

First, open PowerShell with administrator permissions and run “Install-WindowsFeature -Name Print-Server” (1). Then, wait while the role is installed.

Once installed, you will see a message telling you to restart the server to complete the installation process (2). To do this, simply run the command “Restart-Computer”.

Part 1 - Install the Print Server role and restart the server
Part 1 – Install the Print Server role and restart the server

NOTE: The server may take a while to apply the changes and restart. How long it takes will depend on your server specifications.

 

Part 2 – Deploying A Shared Printer on the Print Server

To see a list of all the available printer drivers on your server, run the command “Get-PrinterDriver” (3).

Part 2 - List the available printer drivers on the system
Part 2 – List the available printer drivers on the system

You can also run the command “Get-Printer” (4) to see the available printers.

Part 2 - List the printers available on the system
Part 2 – List the printers available on the system

Next, you need to add the printer drivers to the Driver Store. To do this, you will need to download the most recent drivers from the manufacturer’s website. It’s also worth testing the drivers on a pilot environment before adding them to your production environment.

To do add the drivers to Driver Store, run the command “pnputil.exe -i -a <PATH>” (5), where <PATH> is the complete file path for the .inf file that contains the drivers.

Here’s an example:

pnputil.exe -i -a “C:\HP Universal Print Driver\ps-x64-7.0.1.24923\hpbuio2001.inf”

Once you’ve run the command, check the lines that read “Total attempted:” and “Number successfully imported:”. If everything has been done correctly, the two numbers should be the same (6).

Part 2 - Import the printer drivers for the printer that you want to install
Part 2 – Import the printer drivers for the printer that you want to install

Now that the drivers have been added to Driver Store, it’s time to install them on the print server. To do this, run the command “Add-PrinterDriver -Name <Name>” (7), where <Name> is the name of the printer being installed.

For example:

Add-PrinterDriver –Name “HP Universal Printing PCL 6”

Part 2 - Install the printer drivers on the print server
Part 2 – Install the printer drivers on the print server

Next, you need to Add the standard TCP/IP printer port by running “Add-PrinterPort -Name <IP Address> -PrinterHostAddress <IP Address>” (8), where <IP> is the printer’s IP address.

For example:

Add-PrinterPort -Name “10.1.1.123” -PrinterHostAddress “10.1.1.123”

Part 2 - Add the standard TCP/IP printer port for your new printer
Part 2 – Add the standard TCP/IP printer port for your new printer

Finally, you need to create a shared print queue, and this uses easily the most complicated command in this tutorial.

The command to run is “Add-printer -Name <Printer_Name> -DriverName <Driver_Name> -shared -ShareName <Share_Name> -PortName <Port> -Published” (9).

Where:

  • Name <Printer_Name>: is the name of the printer.
  • DriverName <Driver_Name>: is the name of the printer driver.
  • Shared: indicates that it’s a shared queue.
  • ShareName <Share_Name>: is the name that the printer will be shared as.
  • PortName <Port>: the port used for sharing.
  • Published: indicates that the queue has been published.

NOTE: If you want to keep things simple, there’s no harm in entering the same name for all these parameters.

For example:

Add-printer -Name “HP Universal Printing PCL 6” -DriverName “HP Universal Printing PCL 6-shared -ShareName “HP Universal Printing PCL 6” -PortName “10.1.1.123” –Published

Part 2 - Creating a shared printer queue using PowerShell
Part 2 – Creating a shared printer queue using PowerShell

Now run the command “Get-Printer” (10) to see the available printers and check that your new printer has been installed and published correctly.

Part 2 - Check that you can see the new printer
Part 2 – Check that you can see the new printer

Alternatively, you could go to Printers & Scanners to check that you can see the new printer (11) and access the print queue, management settings, etc.

Part 2 - Go to Printers &amp; Scanners to check that the new printer is visible
Part 2 – Go to Printers & Scanners to check that the new printer is visible

Congratulations! You have now successfully added a print server and deployed a new shared printer, all using PowerShell!

 

Summary

In this tutorial, we’ve shown you how to add the Print Server role using PowerShell on Windows Server 2022, but the process is valid for other versions of Windows Server, such as 2016 or 2019. You’ve also learnt how to add a new shared printer to your print server. As you have seen, the process is very straightforward and can be completed in literally a matter of minutes. Using PowerShell can save a lot of time, and also allows the potential for automating repetitive tasks.

We hope you’ve found this tutorial useful, but if you do come across any problems, don’t hesitate to contact us. We’ll be happy to help any way we can.

Thanks for choosing Jotelulu!

Categories:Servers

Fill out the form and one of our Sales team will contact you soon.

growth@jotelulu.com  |  jotelulu.com 

You can unsubscribe from these communications at any time. For more information,  check our Privacy Policy.

 

We make the difficult easy

Existing Disaster Recovery tools often require advanced knowledge to manage, demanding expertise that is difficult to acquire.

Jotelulu’s Disaster Recovery aims to make the difficult easy and offers a very simple deployment based on a three-step configuration:

Origin (Primary Site)
Determine the origin location of the subscription on which the Disaster Recovery service will be established.

Destination (Recovery Site)
Set the destination location (availability zone) where you want the Recovery Site to be deployed.

Replication characteristics
Specify the data related to the number of copies to be kept and the frequency at which the replication will be performed.