Learn how to a build a cloud-first strategyRegister Now

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

Logon Batch Script

Experts,

I have deployed logon scripts in my environment under the user configuration. The batch code is:

@ech off

start /high \\printserver\printername

The script does the job at the logon but a message pops up stating Before you can use the printer \\path, it must be set up on your computer. Do you want windows to set up the printer and continue this operation?

How can I eliminate this message? Is there a code that can be added so it would connect the user to the printer without prompting?


0
Phipps-IT
Asked:
Phipps-IT
  • 11
  • 10
  • 3
  • +2
1 Solution
 
InteractiveMindCommented:
> Do you want windows to set up the printer and continue this operation?

I'm guessing that you can bypass this, by typing in either "Y" or "N", correct? If so, then you can resort to a pipe to bypass the message, like so:

   @echo off
   echo y| start /high \\printserver\printername


Good luck.
0
 
InteractiveMindCommented:
Hm..
>> but a message pops up

Would I then be correct to say that this message is in a new window? (As opposed to the message being outputted to the Command Line window).

If so, firstly try passing a 'y' parameter to the command, like so:

   @echo off
   start /high \\printserver\printername /y

If no luck, then you'll probably need to resort to some external scripting (probably achievable in VB).
0
 
Phipps-ITAuthor Commented:
Ok,

l tested it with the y but it didn't work,

Is the character after y a pipe?
0
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!

 
techiesue83Commented:
I think the "/y" should actually be a "<y".  It's been a while, but I'm pretty sure it is not a slash...  May be a pipe as well.
0
 
Phipps-ITAuthor Commented:
I ran it through the command prompt but I got the prompt again. what does Y stands for?
0
 
InteractiveMindCommented:
> Is the character after y a pipe?
Yes.

> I think the "/y" should actually be a "<y".  
This is incorrect -- the '<' character is an input-redirection operand, which is used to input multiple strings to a command (whereas you're limited to only one command when using the pipe).

I'll have a think, and see if I can think up an alternative..
0
 
InteractiveMindCommented:
> what does Y stands for?
By using the "Y", we're attempting to bypass the prompt (as most prompts require either a "Y" (for "Yes") or "N"..); whichever one suits your situation best.
0
 
Phipps-ITAuthor Commented:
I ran:

start /high \\printserver\printername "<y" and "y" but still get the prompt
0
 
techiesue83Commented:
Try using the solution recommended by InteractiveMind but put a space between the "y" and the pipe symbol:

 echo y | start /high \\printserver\printername
0
 
InteractiveMindCommented:
> Try using the solution recommended by InteractiveMind but put a space between the "y" and the pipe symbol:
Feel free to try it, but I'm confident that this won't make a difference; they will both do the same thing. Also, we've already established that due to the popup message being a window (other than a Command Line message), an echo redirection would not take effect on it.
0
 
Phipps-ITAuthor Commented:
Strangely the echo Y | start /high \\printserver\printername did the job on my machine which is XP but it prompts on the test machine that is running 2000 Pro.???????????
0
 
InteractiveMindCommented:
!?! Really !?!

How very odd! lol
0
 
JesterTooCommented:
>>start /high \\printserver\printername <<

Using the "start" command initiates a new window in which to run the command... I don't think you can pipe data into that new window.  On my system when I issue that statement (with my values for printserver\printername) I get a gui window that displays the printer queue.  I don't get the message you see but, then, the printer I'm using is already setup and is the default on my workstations.

What, specifically, are you trying to achieve by placing this command in your logon script?  There may be another acceptable way to accomplish it.

HTH,
Lynn
0
 
Phipps-ITAuthor Commented:
We have Over 200 computers and many different organizations. each OU has its own printer. Users in each OU needs to be connected to their own network printers. We don't want them to see the prompt. We need to deploy a GPO to install the printer at the logon with out taking their attention
0
 
Phipps-ITAuthor Commented:
I just tested it again. It works on winXP but not on 2000???
0
 
InteractiveMindCommented:
I'm sure that this won't work, but just so that we can 100% rule it out, try this quickly:

   start /high \\printserver\printername & echo y
0
 
techiesue83Commented:
Once the printer is set up on each users station, does the prompt still occur?  If not, it might be just as easy to notify your users what to expect and to respond to the prompt in the affirmative when they get it.  Not necessarily the prettiest solution, but may keep you from pulling your hair out.  

On the other hand, if the prompt always appears, that won't help.

One thing I have done is to customize logon scripts for departments. Assuming that your users are categorized in groups by department.  You can then test the userid and use the appropriate print server for that department at logon.  That can be done by if-then-else statements in the logon script or by using different scripts for each dept.
 
0
 
PreeceCommented:
I noticed in your first post that you misspelled echo:




Experts,

I have deployed logon scripts in my environment under the user configuration. The batch code is:

@ech off

start /high \\printserver\printername

The script does the job at the logon but a message pops up stating Before you can use the printer \\path, it must be set up on your computer. Do you want windows to set up the printer and continue this operation?

How can I eliminate this message? Is there a code that can be added so it would connect the user to the printer without prompting
0
 
Phipps-ITAuthor Commented:
No,

it did not work, however I found a program called adprintx. I deployed it along with a script:
@echo off
adprintx  /cd "\\printserver\printername"

it worked for me.
0
 
InteractiveMindCommented:
Preece,

the @echo off command, only prevents command echos'; the only effect it would have, is output-related (as opposed to the performance/processes).
0
 
PreeceCommented:
It was just an observation!  ; - )  
0
 
Phipps-ITAuthor Commented:
Thats correct,

0
 
InteractiveMindCommented:
Fair enough  ^_~
0
 
Phipps-ITAuthor Commented:
I am sorry I don't undrestand what you mean with observation
0
 
InteractiveMindCommented:
He was merely replying to my comment (explaining about the @echo off command). Nevermind. :-)

> it did not work, however I found a program called adprintx. I deployed it along with a script:
> @echo off
> adprintx  /cd "\\printserver\printername"

> it worked for me.

Is that alright as a final solution? If so, if you found it yourself, then please request a "PAQ - Refund", in the Community Support.

Regards;
0
 
Phipps-ITAuthor Commented:
My knowledge with programming is very little. Thank you all the info you provided me.

Bobby
0
 
InteractiveMindCommented:
Thank you very much, Bobby.  :-)
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 11
  • 10
  • 3
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now