Jump to content

Printer script question


leiw
 Share

Recommended Posts

I want all user only map to in room printer, so they cannot map to another room printer.

Below is my script but still failure...

@echo off

net use y: \\file\ftp\%username%

net use x: \\file\public

if %computername%==office4 goto office

:office

rundll32 PrintUI.dll,PrintUIEntry /in /n \\file\lp01

goto end

:end

Thank !

Link to comment
Share on other sites

Hello, welcome to the Windows Forum, and sorry that you didn't get a reply yet.

Problem is that not too many people here are familiar with DOS scripting, including myself. However, let's try to find a solution.

You say "still failure"; can you be more specific? What fails; the flow, or the rundll32 command?

Looking at the flow, it is definitely wrong. You will always execute the rundll32 command. (if %computername%==office4, then you will go to label :office, if not you will anyway run into :office).

Try it as follows

@echo off

net use y: \\file\ftp\%username%

net use x: \\file\public

if NOT %computername%==office4 goto end

rundll32 PrintUI.dll,PrintUIEntry /in /n \\file\lp01

:end

Link to comment
Share on other sites

To assume there have office and computer room, when the user using office computers that the user only can see office printers but they must cannot see another room printers such as computer room.

So my script only who using office computers that can only see office printers and the script is run by group policy, but when the user not using office computers, they still can run the script ....

Thank !!

Link to comment
Share on other sites

If you use

runas /u:%COMPUTERNAME%\Administrator

in your batch file, it will run the script with administrator credentials. I believe the password has to be typed, but there is a way to have it automatic. I am sorry I cannot remember this off the top of my head.

here's some more information: http://blogs.msdn.com/aaron_margosis/archi.../24/193721.aspx

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy