Re: Can't setup printer on remote workstation using WMI

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I was having the same problem, so based a script on rundll32 printui.dll
command line as below.
A full list of options is available by entering 'rundll32
printui.dll,PrintUIEntry /?' at cmd prompt.

script ran command below against selected computers, then restarted the
spooler service. This command
will install network printer for all users on a pc.

Set shell = CreateObject("wscript.shell")
shell.run "rundll32 printui.dll,PrintUIEntry /ga /c\\" & strComputer & " /n"
& strPrinter

Pete Forman



"jacksterling84" <jacksterling84@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:E63B41C6-A231-46AD-A87C-6D941E2B1947@xxxxxxxxxxxxxxxx
>I have also noticed that the printers do not all list, actually only the
> first printer shows up.
>
> I tried some more experimenting, and this works, but only locally.
> (Remember
> that I need to use my credentials (admin) so that the drivers install
> properly - most of my users don't have admin rights on their
> workstations.)
>
> '---------------------------------------------------------------------------
> wscript.echo vbcrlf & vbcrlf & "**** Using script from :"
> wscript.echo "http://msdn.microsoft.com/library/default.asp?url="; &_
> "/library/en-us/wmisdk/wmi/wmi_tasks__printers_and_printing.asp"
> wscript.echo vbcrlf
> strComputer = "." ' this won't work if you put a remote computer in
> strComputer
> Set objWMIService = GetObject( _
> "winmgmts:{impersonationLevel=Impersonate}!\\" & _
> strComputer & "\root\cimv2")
> Set colPrinters = objWMIService.Get("Win32_Printer")
> Err.clear ' added by me
> errReturn = colPrinters.AddPrinterConnection (strPrinter)
> nLine=100 'added by me (100 is the line where the error will occur)
> wscript.echo vbcrlf & _
> "Error code returned from AddPrinterConnection=" & errReturn
> if Err = 0 then
> wscript.echo vbcrlf & "SUCCESS! - The printer was installed."
> else
> wscript.echo vbcrlf & "Error ( 0x " & hex(err.number) & _
> ") occured on line (" & nLine & ") :" & vbcrlf & _
> err.source & vbcrlf & err.description
> end if
> ' ------------------------------------------------
> And here is output from that section of code:
>
>
> **** Using script from :
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wmi_tasks__printers_and_printing.asp
>
> Error code returned from AddPrinterConnection=0
>
> SUCCESS! - The printer was installed.
>
> =========== If I put a remote computer into strComputer ===========
>
> **** Using script from :
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wmi_tasks__printers_and_printing.asp
>
> Error code returned from AddPrinterConnection=
>
> Error ( 0x 8004100C) occured on line (100) :
> SWbemObjectEx
> Not supported
>


.



Relevant Pages

  • Re: Question on input password on ssh prompt
    ... I am writing a perl script running on the XP, ... command to the remote host. ... Is that a way I can feed it the password without install any ... into linux entry thru ssh command. ...
    (comp.lang.perl.misc)
  • RE: Using LWP to Browse a Perl Page
    ... On running the command install Crypt::SSLeay I found that the scripts ... the address points to a Perl script. ... Did you view source for the frame or the original page? ...
    (perl.beginners)
  • Re: installing 1.8.7
    ... tar xzvf ruby-1.8.6-p111.tar.gz ... sudo make install ... file created by the tarcommand and then zipped by the gzip ... Within that directory is a shell script named 'configure'. ...
    (comp.lang.ruby)
  • Re: rundll "Printer runndll command failed"
    ... I am able to install the printers using rundll32 ... I'm trying to use rundll32 printui.dll,PrintUIEntry command ... capture the printer settings in a file that I can use during the ... The command I'm using is rundll32 printui.dll,PrintUIEntry /Ss ...
    (microsoft.public.windowsxp.print_fax)
  • Re: rundll "Printer runndll command failed"
    ... I am able to install the printers using rundll32 ... I'm trying to use rundll32 printui.dll,PrintUIEntry command ... capture the printer settings in a file that I can use during the ...
    (microsoft.public.windowsxp.print_fax)