Link to home
Start Free TrialLog in
Avatar of dawnsedgetech
dawnsedgetech

asked on

Powershell, Create Printer / Port - Need to assign existing port, not create one

These are all 2008 R2 server so they don't have the new PowerShell 4.0 Printer cmdlets so that's not an option.  

I grabbed a powershell script from the internet to quickly add IP printer queues across multiple machine.  We have 3 enterprise print servers and then 4 Epic EPS servers.  Essentially, a printer will be added to 1 of the 3 enterprise servers and all 4 Epic EPS print servers.  If the printer and port does not exist, this script and accompanying CSV file works very well!  But our Epic set requires us to make separate objects with same printer / port to denote trays.  

Ex: Printer1, Printer1_T2, Printer1_RX

It's the same physical printer and port, just a different printer name.  The issue with the script is that I cannot seem to add a printer and assign it an existing port without it taking over the previously created printer object in the code so you end up with just one printer object, typically the last one in the CSV.  So no matter what happens, it only ever creates just one printer object per server no matter how many different objects with different names you try to create.

I've experimented with leaving the "PORT" cell blank on the secondary named printer, but it still will not create a new printer object.  Still just runs over and refreshed the first made object.  Had tried running the script with the main object name, then changing the CSV and running again separately.  Same issue.

Any PowerShell coding help would be awesome.  I'm attaching the ps1 and csv for examples.
add-printer-PS1.TXT
addprinters.csv
ASKER CERTIFIED SOLUTION
Avatar of dawnsedgetech
dawnsedgetech

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of hdhondt
I've requested that this question be closed as follows:

Accepted answer: 0 points for dawnsedgetech's comment #a40849501

for the following reason:

This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.