AIM : To export Network Printer from one Windows 10 machine to an output file and using that output file import it to another Windows 10 machine on the same network.
Research work:
The following Powershell cmd shows the Mapped printers for a user:
cmdlet 1)
Get-WMIObject Win32_Printer -ComputerName $env:COMPUTERNAME | where{$_.Name -like “*\\*”} | select sharename,name
NOTE: The above cmd does not show the DriverName which is a critical parameter for the next command
The command that I am planning to use to import the Network Printer:
cmdlet 2)
Syntax:
rundll32 printui.dll,PrintUIEntry /Xs /n\SERVER\PRINTERSHARENAME DriverName "Lexmark C752 PS3"
since I didnt have the drivername , I tried to run it anyways as the driver is already installed on the second Windows 10 box.
rundll32 printui.dll,PrintUIEntry /Xs /n"\tdr09\AlphaIT(prtq3) KONICA MINOLTA C550i"
But I get error after running the cmd:
===========================================================================
[Window Title]
Printers
[Main Instruction]
The arguments are invalid.
[OK]
===========================================================================
Problem:
1) The cmdlet 1 doesnt provide the DriverName so the cmdlet 2 is failing with the above error.
=======================================================================
Method 2 Based on feedback from @Massimo
I tried to use the following command :
get-printer | where{$_.Name -like "\"} | Format-Table -AutoSize
enter image description here
The Output looks like this:
Name ComputerName Type DriverName PortName Shared Publ ishe d
\trq02\AXEIT(ptq2) KONICA MINOLTA C550i ptq02 Connection KONICA MINOLTA C650iSeries 10.246.0.173 True F...
I can pipe it out to a text file but how can I make PowerShell read this file and add the Printer.
NOTE: If I run the following cmd manually then Printer add works fine.
add-printer "\trq02\AXEIT(ptq2) KONICA MINOLTA C550i"