Registered member login:
Register Now
Altirigos » Deployment Solution » Scripting/Tools/Docs » issue with deploying script to add printer

» Current Poll
Do you leave the Aclient enabled?
YES - 82.17%
106 Votes
NO - 17.83%
23 Votes
Total Votes: 129
You may not vote on this poll.
» Stats
Members: 9,489
Threads: 11,748
Posts: 55,279
Top Poster: Nick (4,981)
Welcome our newest member, jbwex
» Online Users: 56
0 members and 56 guests
No Members online
Most users online at once 294, 06-30-2007 at 12:24 PM.
» March 2010
S M T W T F S
28 1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31 123
Reply
Old 06-29-2007, 10:03 AM   #1 (permalink)
 
Status: Super Altiris Admin
Join Date: 03-06-2006
Location: Calgary Alberta Canada
Posts: 487


issue with deploying script to add printer

Hello,
I am having an issue I can't figure out and am hoping someone can show me the "Error of my ways"
I am trying to install a few printers using a VB script and pushing it to the client with Software Delivery
Here is my script
----------------
Set objNetwork = CreateObject("WScript.Network")
objNetwork.AddWindowsPrinterConnection "\\server\PRT061"
objNetwork.AddWindowsPrinterConnection "\\server\PRT062"
objNetwork.SetDefaultPrinter "\\server\PRT061"
----------------

I have created a package and a task to deploy it to computers. I have pushed it to a couple test PC's and I can confirm the package downloads to the client. It then states that it "Failed to Start"
When I check the package on the local computer I see it and I can doubleclick it and it will install the printers but it won't install automatically as part of my software delivery task

Am I missing something?

Bill

Last edited by Bill Sullivan; 07-03-2007 at 01:28 PM..
Bill Sullivan is offline   Reply With Quote
Old 07-03-2007, 01:29 PM   #2 (permalink)
 
Status: Super Altiris Admin
Join Date: 03-06-2006
Location: Calgary Alberta Canada
Posts: 487


Bumping since I sent late last week.
Bill Sullivan is offline   Reply With Quote
Old 07-03-2007, 01:33 PM   #3 (permalink)
 
Status: Super Altiris Admin
Join Date: 10-28-2005
Location: Colorado
Posts: 1,364


I would navigate to the SWD folder and into the GUID subfolder on your client. Make a copy, now edit the file you run from the command line and insert a pause. You are probably getting an informational return code or some other less ciritcal return code. Once you find out what it is you can add it as a success code in the SWD task.
__________________
Brandon
Brandon is offline   Reply With Quote
Old 07-03-2007, 02:35 PM   #4 (permalink)
 
Status: Super Altiris Admin
Join Date: 03-06-2006
Location: Calgary Alberta Canada
Posts: 487


Nope no error code but I know that when I double click it, it does not show errors and it works jsut fine. Even a batch file pointing to the VBS with pause just works.
To me it is the agent that is not running the VBS correctly.
Bill Sullivan is offline   Reply With Quote
Old 07-03-2007, 03:20 PM   #5 (permalink)
 
Status: Super Altiris Admin
Join Date: 10-28-2005
Location: Colorado
Posts: 1,364


Are you using cscript.exe //NoLogo file.vbs ?
__________________
Brandon
Brandon is offline   Reply With Quote
Old 07-03-2007, 04:08 PM   #6 (permalink)
 
Status: Super Altiris Admin
Join Date: 03-06-2006
Location: Calgary Alberta Canada
Posts: 487


Still no difference. Works when I run it manually but my task says it runs but doesnt actually add the printers. Very odd to me although I am no scripter
Bill Sullivan is offline   Reply With Quote
Old 07-03-2007, 05:48 PM   #7 (permalink)
 
Nick's Avatar
 
Status: Altiris Architect (Site Founder)
Join Date: 01-01-2005
Location: RDU, North Carolina, USA
Posts: 4,981


What rights are you running the script with?
__________________
Scire potentia est (knowledge is power)
Nick is offline   Reply With Quote
Old 07-03-2007, 07:01 PM   #8 (permalink)
 
Status: Super Altiris Admin
Join Date: 03-06-2006
Location: Calgary Alberta Canada
Posts: 487


Tried system or user still no help.
Nick,
Have you built a job like this in the past?
Maybe creating this from scratch with some direction from you or someone here would be the best bet.
Bill Sullivan is offline   Reply With Quote
Old 07-03-2007, 07:17 PM   #9 (permalink)
 
Nick's Avatar
 
Status: Altiris Architect (Site Founder)
Join Date: 01-01-2005
Location: RDU, North Carolina, USA
Posts: 4,981


I can't remember if I've tried to do this or not in the past. If the vbscript just isn't doing it for you though, have you tried creating a RIP executable to install the printers?

The package won't be nearly as small as a vbscript but it may save a few dents in the wall and bruises on your fist.
__________________
Scire potentia est (knowledge is power)
Nick is offline   Reply With Quote
Old 07-04-2007, 02:43 AM   #10 (permalink)
 
Hoveyg's Avatar
 
Status: Junior Altiris Admin
Join Date: 02-12-2006
Location: Qatar
Age: 30
Posts: 20


Here is the script I used to install printers. You just need to pass in the room name or number, and the IP address of the printer and it should install a local printer. To install a network printer, it shouldn't take much to change my script. Just need to play with the paramaters rundll32 printui.. Works fine. Had some problems trying to set it to a default printer.. Tried 3 different methods but wouldn't work.. (worked when I ran it locally on the PC, but when run through the DS, it claimed it worked but never did get set)


Usage: installprinter.bat (ROOM#) (PrinterIP)

Inside installprinter.bat
---------------------------------
set labnumber=%1
set printerIP=%2

if "%3" equ "" (
set drivername=HP LaserJet 4250 PCL 6
) else (
set drivername=%~3
)

if "%4" equ "" (
set driverlocation=\\DSserver\Current Packages\Printer Setup\PrinterDrivers\PCL64250\oem26.inf
) else (
set driverlocation=%~4
)

REM Setup port
Cscript //H:CScript //S
prnport.vbs -a -r "IP_%printerIP%" -h %printerIP% -o raw -n 9100 -me -i 1 -y public

REM Sets up printer and drivers.
RUNDLL32 PRINTUI.DLL,PrintUIEntry /if /Gw /q /b "%drivername% - Lab %labnumber%" /f"%driverlocation%" /r "IP_%printerIP%" /m "%drivername%"

REM Sets Default Printer (Suppose to)
(Could never get it to set default printer)
Hoveyg is offline   Reply With Quote
Old 07-04-2007, 05:29 AM   #11 (permalink)
 
Status: Super Altiris Admin
Join Date: 11-09-2006
Location: London
Posts: 718


Quote:
Originally Posted by Bill Sullivan
Still no difference. Works when I run it manually but my task says it runs but doesnt actually add the printers. Very odd to me although I am no scripter
Does the task run successfully using Software Delivery? You said earlier it shows 'Failed to start'.

Sometimes, if a SWD task shows an error, more detail can be found in the bottom third section of AeXSWDPolicy.xml where the Program information is.
andykn is offline   Reply With Quote
Old 07-09-2007, 12:45 PM   #12 (permalink)
 
Status: Super Altiris Admin
Join Date: 10-28-2005
Location: Colorado
Posts: 1,364


Quote:
Originally Posted by Hoveyg
REM Sets up printer and drivers.
RUNDLL32 PRINTUI.DLL,PrintUIEntry /if /Gw /q /b "%drivername% - Lab %labnumber%" /f"%driverlocation%" /r "IP_%printerIP%" /m "%drivername%"

REM Sets Default Printer (Suppose to)
(Could never get it to set default printer)
Hoveyg: have you considered using prnmngr.vbs here instead? You may have better luck setting defaults (using -t).
__________________
Brandon
Brandon is offline   Reply With Quote
Old 07-09-2007, 04:24 PM   #13 (permalink)
 
carymon's Avatar
 
Status: Super Altiris Admin
Join Date: 11-28-2005
Location: Mississippi, USA
Posts: 309


This may not help but I often overlook the simple and obvious.

One of the first things I do when I have a package which deploys to the client but won't install, is to delete the task and recreate it. It may sound weird but Altiris seems to be very picky about changes in the directory even if it's only a file being modified. (My guess is the database gets confused with the timestamp difference.)
carymon is offline   Reply With Quote
Old 06-03-2008, 03:34 PM   #14 (permalink)
 
Rick M's Avatar
 
Status: Altiris Admin
Join Date: 10-27-2006
Location: New York
Posts: 67


I wrote a script just like the first one in the thread...simple 2 lines of VBScript to map a printer. It works just fine if I double click it, but if I send it with the Deployment Server....no joy. So what's the problem?

I have tried to run the VB directly
I have tried to uses cscript to call the .vbs

I have tried it with system account
I have tried it with a domain account

??
Rick M is offline   Reply With Quote
Old 06-03-2008, 04:42 PM   #15 (permalink)
 
Status: Super Altiris Admin
Join Date: 02-13-2008
Location: Chicago
Posts: 149


I have seen this with some of our printer scripts and the only way I was able to get this to work was to setup a job in the registry runonce that call my printer script - once the user logs in it will execute my script and printer installs without any issues....it's a workaround not a fix but thought I would throw it out there.
almanza is offline   Reply With Quote
Old 06-03-2008, 04:46 PM   #16 (permalink)
 
Rick M's Avatar
 
Status: Altiris Admin
Join Date: 10-27-2006
Location: New York
Posts: 67


Yeah thanks for that...it gets printers on there at least right?

I am hoping to give my help desk people the ability to throw a job at a machine to map a printer. User calls up, "I want the high quality color printer that staples!" and we can just throw the job at the machine and tell them "We have notified the office manager that you will be printing color flyers for your candle party. Have a nice day."

alas...we cannot do this.
Rick M is offline   Reply With Quote
Old 06-03-2008, 04:55 PM   #17 (permalink)
 
Status: Super Altiris Admin
Join Date: 02-13-2008
Location: Chicago
Posts: 149


correct, printers will get installed just fine (this is assuming your script installs the printers if you manually run them)

you can still have the helpdesk send the job to the pc by setting up a job for the registry add but the printer would only show up after the users logs off\on to their pc

the other option would be to have a job add a shortcut to their start menu and have the shortcut point to your script\s on the network somewhere and all they would have to do is click on it (would make sure to give them "read only" permissions) the nice thing about this would be you can update your script on the network to reflect any changes for the printers...it does require user interaction but it's just a thought.
almanza is offline   Reply With Quote
Old 06-03-2008, 05:31 PM   #18 (permalink)
 
Rick M's Avatar
 
Status: Altiris Admin
Join Date: 10-27-2006
Location: New York
Posts: 67


Now that's a creative solution :-)

If noone can explain how to make this work (or certainly declare that it will not) I am use the shortcut idea.

Thanks
Rick M is offline   Reply With Quote
Old 06-03-2008, 10:59 PM   #19 (permalink)
 
deemacgee's Avatar
 
Status: Super Altiris Admin
Join Date: 12-01-2005
Location: Sydney, Australia
Posts: 131


I used to email the link to users -

"Here, click on this: \\printsrv1\printer_queue.
Then make sure you select it in Word/PowerPoint/Acrobat/etc..."

Really only necessary for special occasions, since default printers were connected via a login script...
__________________
I don't want more choice, I just want nicer things!

Edina Monsoon (Jennifer Saunders)
Absolutely Fabulous, "Jealous"
deemacgee is offline   Reply With Quote
Old 05-15-2009, 08:57 AM   #20 (permalink)
 
Status: Altiris Admin
Join Date: 03-29-2009
Location: Wisconsin
Posts: 42


This is ridiculous.

This should work.
Petrucci914 is offline   Reply With Quote
Old 07-15-2009, 02:22 PM   #21 (permalink)
 
Status: Altiris Admin
Join Date: 03-29-2009
Location: Wisconsin
Posts: 42


Anybody get anywhere with this?

Other VBS scripts work, but it only seems to be when it involves printers.

Really really annoying....
Petrucci914 is offline   Reply With Quote
Old 07-15-2009, 05:18 PM   #22 (permalink)
 
Status: Super Altiris Admin
Join Date: 02-13-2008
Location: Chicago
Posts: 149


Wonder if you added a stop print spooler then add your printer followed by a start print spooler - not sure if this would make a difference - just thinking out loud....
almanza is offline   Reply With Quote
Old 07-16-2009, 11:08 AM   #23 (permalink)
 
Status: Junior Altiris Admin
Join Date: 10-21-2008
Location: Des Moines
Posts: 8


I had this same issue....my solution

BACKGROUND: I had this same issue when deploying new printers quick. Since our company doesn't utilize a login script for this yet, I figured doing simple VB script much like what Bill posted would do the trick. WRONG. Again, I execute manually on the machine and it works great, but always fails in DS. I came to the conclusion that it's not working under the specific user that's logged in. What's more is, if the PC is logged off, it still won't work using this type of script. Yes, I've tried the 'Run script in console user session' too and that doesn't work.

MY SOLUTION: I actually use two simple VB scripts. The first script is the one that I push with DS to my clients. I can push this whether or not the client is logged on or off. It adds 2 entries to the Active Setup registry path. One entry references the original script, which is in a network location accessible by all, and the other entry I use as a versioning marker with just the date.

For those of you who don't know what Active Setup does, it will run anything you wish for that particular user, under the elevated NTAUTHORITY/System account which gives that user the permissions required to 'install'. I can't post URLs for some dumb reason, but do a google search for 'Active Setup'. There's a great explanation on AppDeploy's site.

CONS: The only con about doing it this way that I don't like is that if the user is logged on, they must logoff and then back on to get the printers.

PROS: However, the good thing is that you can install this now from a logged off PC, AND this setting will take effect for all other users that login.

Here is one of the scripts I send out through DS, that adds the Active Setup reg setting:

Code:
'Add Canon7000 Printer - User must logoff and logon for printer to add
 
Set WshShell = WScript.CreateObject("WScript.Shell")
 
'**********************Add Canon7000 to Active Setup******************************
WshShell.RegWrite "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\Canon7000\StubPath","\\Server\filelocation\Canon7000.vbs","REG_SZ"
WshShell.RegWrite "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\Canon7000\Version","04.08.09","REG_SZ"
Make sure that on the following line, you change the name for each different application you wish to install via Active Setup...

EXAMPLE:
Currently I have this for the Canon7000 Printer:
"HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\Canon7000\StubPath"

If I wanted to install say an HP4300 Printer I'd change it to this:
"HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\HP4300\StubPath"

This is essential for Active Setup to work.. Each application or install needs to be in a unique reg key.


My Canon7000.vbs code looks like this:

Code:
'Add Canon 7000 Printer
On Error Resume Next
sPrinterPath = "\\printsvr1\Canon_7000"
Set wshNetwork = WScript.CreateObject("WScript.Network")
 
WSHNetwork.AddWindowsPrinterConnection sPrinterPath


Sorry for the long post, but hope this helps everyone!
biscuitgod is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Powered by vBadvanced CMPS v3.0 RC2

All times are GMT -4. The time now is 06:18 AM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
vB.Sponsors
Altirigos