Categories
Welcome Center
Education & Development
Discussions
Certification Preparation
Recent Posts
Groups
Free Resources
Ebooks
Free Workshops
Trending Certifications Infographic
Infosec Training
IT & Security Training
Live Boot Camps
Security Awareness Training
About Infosec Institute
Home
Discussions
Off Topic
Printer Deployment with powershell
jahaziel
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 10.121.31.80
Add-PrinterPort -Name 10.121.31.80 -PrinterHostAddress "10.121.31.80"
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
Find more posts tagged with
Save $250 on 2025 certification boot camps from Infosec!
Book now with code EOY2025
Button
Comments
CodeBlox
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?
jahaziel
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.
linuxabuser
GPO is the only way to go.
ptilsen
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.
Quick Links
All Categories
Recent Posts
Activity
Unanswered
Groups
Best Of
INFOSEC Boot Camps
$250
OFF
Use code
EOY2025
to receive $250 off your 2025 certification boot camp!
BROWSE BOOT CAMPS