This topic contains 3 replies, has 2 voices, and was last updated by
October 2, 2013 at 1:57 am #10464
I was wondering if anyone could possibly lend a hand?
We have eight printers across two sites. I would like all the users in OU1 (Site 1) to have printers 1,2,3 and 4 and all users in OU2 (Site 2) to have printers 5,6,7 and 8.
Printers 1 and 4 in OU1 and printers 5 and 8 in OU2 are colour.
Printers 2 and 3 in OU1 and printers 6 and 7 in OU2 are black and white.
However, we only have two printing AD groups (print_colour and print_black_and_white).
We have 25 Active Directory 'role' groups. Each user belongs to one role group, which is a member of all the various AD groups required for their job role. The role groups are members of 'print_colour' and 'print_black_and_white' however, the AD role groups are not site-specific, so we can only use the two OUs to separate the users geographically.
Ideally what I would like to do is to have each user log on and have just the four printers at their site mapped via a logon script. I'm guessing it would be something along the lines of:
"If the user is a member of this OU and their role group is a member of this printing group, give them printer w,x,y and z"
I won't be able to make any changes to (or add) any Active Directory groups.
Hope this makes sense.
Can anyone suggest a way of achieving this logon script with Powershell?
Thanks in advance.
October 2, 2013 at 2:15 am #10465ParticipantPoints: 0Rank: Member
Wouldn't this be much easier to achieve through a GPO preference?
Why can't you get the AD & groups changed – it would make life simpler
What do you currently use for logon scripts – it would be better to put the printer mappings there
October 2, 2013 at 2:44 am #10466
Yes, we tried this first, but for some reason the printers aren't being added, despite the group policy being applied. We can't see what's wrong with it and we need to get the change for a logon script submitted today so it can be approved by tomorrow's cut-off. The second site (ou2) isn't live yet, but is going live at the weekend, hence the urgency. I copied the existing master GPO twice and applied it to both sites. For some reason it's not adding the printers. When we re-link the old one (containing just printers 1,2,3 and 4) the printers get added.
We decided to just use a script to map the relevant printers at logon for now and at least that'll give us a bit more breathing space to see what's going on with the policy inheritance etc further down the line.
Don't worry if it's too cumbersome/convoluted. It was more of a workaround just to get everything ready for the site going live. Thought I'd ask the question.
October 3, 2013 at 11:18 am #10525
Actually, on second thoughts I want to simplify this:
I would like to give all the users in OU1 printers 1,2,3 and 4 and give all the users in OU2 printers 5,6,7 and 8. Each user can have all four printers on their site and just select their own default printer.
I've got the command to add the printer: (New-Object -ComObject WScript.Network).AddWindowsPrinterConnection("\\Server\Printer_1") etc. I've tested that and it works.
So I'm guessing I need to use 'if' and 'elseif' (or is it 'switch'?) to basically say if the user is a member of ou1, add printers 1,2,3,4 or if the user is a member of ou2, then add printers 5,6,7,8
Can anyone help me with the logon script required to do this?
Any assistance is greatly appreciated.
The topic ‘Map Printers via logon script’ is closed to new replies.