Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 505
  • Last Modified:

installing a printer via vbscript, with no user interaction

im trying to install a printer via vbscript with no user interaction

my code is returning, invalid arguments

I have also attached the INF file being used, (in txt format)

Option Explicit
On Error Resume Next
 
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
 
 
Const SOURCE = "\\%DSSERVER%\eXpress\Packages\Citrix\Source\910a-PSourceGlobal\"
 
Const COMMAND1 = "Rundll32 PrintUI.dll,PrintUIEntry /ia /f"
 
'Install "Canon CLC-iR C3220-C1 PCL5c" Driver 
 
WshShell.Run COMMAND1 & Space(1) & Chr(34) & SOURCE & "Canon CLC3220 PCL5c\P52KUKAL.INF" _
	& Chr(34) & " /m " & Chr(34) & "Canon CLC-iR C3220-C1 PCL5c" & Chr(34) & " /u", 0, True 
 
Set WshShell = Nothing

Open in new window

P52KUKAL.txt
0
lpkramit
Asked:
lpkramit
1 Solution
 
TakedaTCommented:
I did notice there is an environment variable in the path on line 8.  This would need to be retrieved differently.  I modified your script, give it a try.  If you get any errors, please post what they are and what lines they are on.


Option Explicit
On Error Resume Next
 
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
 
strDSServer = WshShell.ExpandEnvironmentStrings("%DSSERVER%")
Const SOURCE = "\\"&strDSServer&"\eXpress\Packages\Citrix\Source\910a-PSourceGlobal\"
 
Const COMMAND1 = "Rundll32 PrintUI.dll,PrintUIEntry /ia /f"
 
'Install "Canon CLC-iR C3220-C1 PCL5c" Driver 
 
WshShell.Run COMMAND1 & Space(1) & Chr(34) & SOURCE & "Canon CLC3220 PCL5c\P52KUKAL.INF" _
	& Chr(34) & " /m " & Chr(34) & "Canon CLC-iR C3220-C1 PCL5c" & Chr(34) & " /u", 0, True 
 
Set WshShell = Nothing

Open in new window

0
 
Mark PavlakCommented:
If you have a way to run this remotley or place in the startup folder on the users pc.
Set WshNetwork = CreateObject("WScript.Network")
PrinterPath = "\\ServerName\PrinterShareName"
PrinterDriver = "UNIDRV.DLL"
WshNetwork.AddWindowsPrinterConnection PrinterPath, PrinterDriver
WshNetwork.SetDefaultPrinter "\\ServerName\PrinterShareName" 

Open in new window

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now