Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to install printer, via a script, based on who the user is

Posted on 2010-08-25
12
Medium Priority
?
356 Views
Last Modified: 2012-05-10
II have 2 groups of users, one group that has network accounts that all begin with a number whereas the other group does not.  I want to see if there is a simple script that checks the username and if it starts with a number, add PrinterA(Group 1 queue).  If it does not begin with a number add PrinterA(Group 2 queue). So, this would be for the same printer, but I have 2 ports for that pritner, so I am creating a queue for 1 group and another queue for the other group.

If it is easier to check the login via AD that is fine too.  If there is a way to check the username, determine if it is in the Group 1 security group or the Group 2 security group then add the printer accordingly, that would work too.
0
Comment
Question by:Greg27
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 2
  • +1
12 Comments
 
LVL 4

Expert Comment

by:Gavincr001
ID: 33523876
Its best to place the users into seperate security groups then map according to group membership instead of numbers and names. have a look at this login script.
http://lazynetworkadmin.com/content/view/7/6/ 

0
 

Author Comment

by:Greg27
ID: 33523970
I just clicked on the link and it doesn't take me to a script, but to a general page with other links. Is there a different link that would show me the script?
0
 
LVL 26

Expert Comment

by:pony10us
ID: 33524157
0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 

Author Comment

by:Greg27
ID: 33524224
I am hoping I am just not blind, but I am not seeing where anyone responded to this question.
0
 

Author Comment

by:Greg27
ID: 33524308
Sorry pony10us, I just reread my quest and not sure I was clear in what I was saying. I looked at the link and it looks like the quest that user was asking would releate to my question, however I am not seeing where anyone responded to his question.
0
 
LVL 26

Expert Comment

by:pony10us
ID: 33524389
np Greg.  I realized after I posted the link what I had done but I don't know how to remove a comment once posted.  :(

In the meantime, I was trying to work something up.
0
 
LVL 26

Expert Comment

by:pony10us
ID: 33524425
Here is a site a little closer to what you have asked for:

http://www.petri.co.il/forums/showthread.php?t=6486
0
 
LVL 42

Expert Comment

by:kevinhsieh
ID: 33524568
I have stopped using scripts for adding printers and now I use Group Policy preferences.  

http://blogs.technet.com/b/grouppolicy/archive/2009/06/24/gp-preferences-set-a-default-printer.aspx

Clients need to be Vista or above, or XP with the Group Policy Preference Client Side Extensions (http://www.microsoft.com/downloads/details.aspx?FamilyID=e60b5c8f-d7dc-4b27-a261-247ce3f6c4f8&displaylang=en)
0
 

Author Comment

by:Greg27
ID: 33525642
Due to the fact that I have different printers for different labs (we have multiple labs), i have to use a script. I only want to setup 1 printer based on which lab they are in. So, I just really need to fiugre out the best way to determine if a user is part of either security group of figure out if the first character of the username is a number or a letter. I hope this makes sense. currently, our login scripts are batch files.
0
 
LVL 26

Accepted Solution

by:
pony10us earned 1000 total points
ID: 33525943
You can play with this and see if you can incorporate it into your script.  


@echo off    
   
if %username:~0,1% LEQ 9 (
echo Yippie
goto :end
)
:not
echo Boo
:end

Open in new window

0
 
LVL 42

Assisted Solution

by:kevinhsieh
kevinhsieh earned 1000 total points
ID: 33526035
With Group Policies you can assign the printer to the PC and not the user.
0
 

Author Closing Comment

by:Greg27
ID: 33678977
Thanks for the information!
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

OfficeMate Freezes on login or does not load after login credentials are input.
After seeing many questions for JRNL_WRAP_ERROR for replication failure, I thought it would be useful to write this article.
This tutorial will show how to push an installation of Backup Exec to an additional server in both 2012 and 2014 versions of the software. Click on the Backup Exec button in the upper left corner. From here, select Installation and Licensing, then I…
This tutorial will walk an individual through setting the global and backup job media overwrite and protection periods in Backup Exec 2012. Log onto the Backup Exec Central Administration Server. Examine the services. If all or most of them are stop…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question