Hi Everyone,
I am new to vb scripting...and i need a script that does the following tasks..

1)Prompt Admin to enter the printer path in the form \\PrintServer\Printer
2)Run the command printui.dll,PrintUIEntry /ga /c\\machine /n\\PrintServer\Printer /j"LanMan PrintServices"

I have made a script but its throwing error on running. Please help me ..
Servername=InputBox("Enter the Servername and the printer name in this format \\PrintServer\Printer")
Set objShell = Wscript.CreateObject("Wscript.Shell")
objshell.run ("%comspec% rundll32""printui.dll""PrintUIEntry""/ga""Servername""/j"""LanMan PrintServices""),1,True
0 Comments   [ + ] Show Comments


Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.


Bit late in the day, but for anyone wandering in here in the future...

The original simply suffered from an over-abundance of quote marks. Also, the use of COMSPEC was unnecessary:

Servername =InputBox("Enter the server name and the printer name in this format: \\PrintServer\Printer")
Set objShell = Wscript.CreateObject("Wscript.Shell")
objShell.Run("rundll32 printui.dll PrintUIEntry /ga" & Servername & "/j LanMan PrintServices"),1,True
Answered 07/31/2007 by: VBScab
Red Belt

Please log in to comment
Answer this question or Comment on this question for clarity