Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Installing printers drivers from power shell on win client

$
0
0

Hi,

I am using a powershell script to install printer drivers from our print server. I am getting a error.

Sript :-

(New-Object -ComObject WScript.Network).AddWindowsPrinterConnection("\\ptprint\pg1-b")

(New-Object -ComObject WScript.Network).SetDefaultPrinter('\\ptprint\pg1-b')

PTPRINT is our print server and pg1-b is printer shared name.

Error : -

Exception calling "AddWindowsPrinterConnection" with "1" argument(s): "The I/O operation has been aborted because of
either a thread exit or an application request. (Exception from HRESULT: 0x800703E3)"
At C:\Users\amitkumar_patil\Desktop\addprinter.ps1:4 char:1
+ (New-Object -ComObject WScript.Network).AddWindowsPrinterConnection("\\ptprint\p ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ComMethodTargetInvocation

Exception calling "SetDefaultPrinter" with "1" argument(s): "There is no printer called "\\ptprint\pg1-b"."
At C:\Users\amitkumar_patil\Desktop\addprinter.ps1:10 char:1
+ (New-Object -ComObject WScript.Network).SetDefaultPrinter('\\ptprint\pg1-b')
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ComMethodTargetInvocation

1. How to solve this ?

2. Is my way to install drivers is incorrect via power shell ?


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>