I'm having serious difficulties getting a script I'm working on to successfully create a printer. So far, I have managed to successfully create printer ports, but there have always been errors when creating the printer.
The CSV file in which it collects information is as follows:
PrinterName,PrinterPort,IPAddress,Location,Comment,PrintDriver, Testprint1,Testport1,10.10.10.10,IT_Test,Test_1,HP LaserJet 4200 PCL 5e,
The error message I get is the following:
Exception calling "Put" with "0" argument(s): "Generic failure " At C:\myversion.ps1:53 char:19 + $objNewPrinter.Put <<<< () + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : DotNetMethodException
The code I use is:
trap { $error[0].Exception | get-member } $objNewPrinter.Put() Write-Host ("`tCreating " + $strPrinterName.Count + " Printer's`t") $objPrint = [WMICLASS]"\\timvista\ROOT\cimv2:Win32_Printer" $objPrint.psbase.scope.options.EnablePrivileges = $true
Does anyone have any thoughts on what a general failure is and how to fix it?
source share