Printer Deployment with powershell

jahazieljahaziel Member Posts: 175 ■■■□□□□□□□
Hello guys,
Trying to power script printer deployment.

So far I been able to get these two lines to work..

Add-Printer -Name "HP M401n" -DriverName "HP M401n" -PortName
Add-PrinterPort -Name -PrinterHostAddress ""

But I can't seem to get the Add-Printerdrivers command to work..
Here is the command and what I receive

PS C:\Windows\system32> Add-PrinterDriver -Name test -InfPath "C:\Users\Jay\Desktop\HPM401n\hpcm401u.inf"
Add-PrinterDriver : One or more specified parameters for this operation has an invalid value.
At line:1 char:1
+ Add-PrinterDriver -Name test -InfPath "C:\Users\Jay\Desktop\HPM401n\hpcm401u.inf ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (MSFT_PrinterDriver:ROOT/StandardCimv2/MSFT_PrinterDriver) [Add-Printer
Driver], CimException
+ FullyQualifiedErrorId : HRESULT 0x80070057,Add-PrinterDriver


  • CodeBloxCodeBlox Member Posts: 1,363 ■■■■□□□□□□
    Why don't you use a GPO instead? Also, I think it sucks that the driver is in a user profile ("Jay")... What happens if "Jay" leaves and someone decides to cleanup profiles?
    Currently reading: Network Warrior, Unix Network Programming by Richard Stevens
  • jahazieljahaziel Member Posts: 175 ■■■□□□□□□□
    I'll see if the system admin will let us do that.. but not sure. Also, im testing out the script before deploying it using my local profile.
  • linuxabuserlinuxabuser Member Posts: 97 ■■□□□□□□□□
    GPO is the only way to go.
  • ptilsenptilsen Member Posts: 2,835 ■■■■■■■■■■
    The error message doesn't necessarily point to this, but the -Name parameter must match the driver's actual name as indicated in the INF (and displayed in the printer properties GUI after installation). Print driver name is not user-choosable (mind you, you can edit the INF, but you can't put whatever you want in the command).

    Overall, I will say that scripting full printer installation with drivers is enough of a pain to make GPP preferable, even for local TCP/IP printers. Scripting can still be useful in certain scenarios, but probably very few. If you are able to provide a print server cluster over a fast network connection, local TCP/IP printer connections are certainly not worth the effort over just using a print server.

    Also, keep in mind that the printer cmdlets are only available in PowerShell 3.0 in Windows 8/Server 2012 and on, and you have to deploy PS 3.0, including dependencies, if you want to use them for Windows XP through 7 clients (pre-XP of course is not an option). I actually went to the trouble of essentially duplicating them with individual PowerShell scripts via WMI, but the Cmdlets are more robust than my scripts and still, as stated, probably not the direction you really want to go.
    Working B.S., Computer Science
    Complete: 55/120 credits SPAN 201, LIT 100, ETHS 200, AP Lang, MATH 120, WRIT 231, ICS 140, MATH 215, ECON 202, ECON 201, ICS 141, MATH 210, LING 111, ICS 240
    In progress: CLEP US GOV,
    Next up: MATH 211, ECON 352, ICS 340
Sign In or Register to comment.