[Autogenerated] Bethany Pie shop has an aging printer that several departments
rely on for printing shipping labels and other documents.
The printer has become unreliable recently,
with jobs getting stuck in the queue and requiring constant
monitoring and manual intervention to keep it printing,
you have approval to purchase a new network printer
that can meet the shop's needs.
Your goal is to set up the printer configure it properly on
the print server and gracefully retire the old printer once
the migration is complete, let's see how this is done in the demo.
Now let's now do a printer migration with PowerShell.
So to do that first, we need to assess our current environment.
We're going to use the GIT printer command to first list
all the printers installed on our server.
This gives me an overview of all the printers that are currently available.
I see the old printer in there.
So I know I'm on the right server.
Next,
we want to make sure that the printer port for our old
printer aptly named old printer is present.
So i'll use the GIT printer port command for this.
There it is.
I see the printer port exists for the old printer.
At least I know what I'm working with here.
It's also important to check to see if there are any
print jobs stuck in the old printer.
These are tasks sent to the printer that still might be in the queue.
If there are any,
we'll need to communicate with the job owners so they can
resubmit them once the new printer is online.
So to find print jobs and the old printer,
I can use the get print job command looks like there's
a single print job in the queue.
Not too bad.
Now on to setting up the new printer first,
we need to add a printer port for the new printer using a printer port.
Our new network printer is at the IP address of 10.0 0.0 0.3.
All right, looks like one already exists.
Looks like I've already did this in the demo environment.
So let's do a quick troubleshooting session here.
Let's remove it to remove it.
We can specify the name of new printer and then I believe
we can pipe that to remove printer port.
Yep.
Then now once we have it removed, we can add it back and there it is.
Now we need to create the new printer.
In our case,
we're using the Microsoft print to PDF driver name because we
don't actually have a physical printer here.
So I can add a new printer with the A printer command.
Specify the name of the new printer,
the port that we just created and whatever driver you need the
printer to use looks like it was successful.
Next, we need to share the new printer.
Sharing a printer allows others on the same network
to use it to share a printer.
We can use the set printer command lit and we can just get the new printer.
Let's make sure that that actually works first and then we
can pipe that printer object to set printer using the shared
parameter and setting it to true.
There we go.
As we're bringing in the new printer online,
we need to remove sharing capabilities from the old printer.
So this prevents users from sending jobs to the printer that's no longer in use.
And through that, you may have guessed,
we simply get the old printer and pipe that to set
printer and this time set share to false.
There we go.
Later on.
Once you've confirmed the new printer is working correctly,
you can remove the old printer completely from the server to do that.
You can first remove the old printer port if it's
not being used by anything else.
And it says it is in use by one or more printers.
All right.
If it's in use by one or more printers, let's just remove the first printer.
There we go.
And then we can remove the printer port and used by one or more printers.
All right, let's see.
So it looks like after some troubleshooting with nothing being wrong,
I just ran removed printer port again.
And this time it worked, it looks like my demo environment is a little slower.
So after I remove the printer,
it took about a minute to completely free up that printer port.
And then once it was free, I could remove it just fine.
So success,
the new printer is online and the old printer and its port is removed for good.