PC Review


Reply
Thread Tools Rate Thread

Assigning Printers w/ GPO per machine

 
 
Aziraphale
Guest
Posts: n/a
 
      6th May 2004
I've spent the last two days scouring the web for a
solution to this, and all I've found are scripts that work
per user, but not per machine. Perhaps it's a permissions
setting, but here goes.

I work in a school. Each classroom has a printer. Users
(students) use multiple computers in multiple rooms
throughout the day. Computers are grouped into OUs based
on room. Each machine needs to print to the printer in
its room. The printers need to be installed by default.
I want to assign them per machine

I know that Policy Maker can do this, but my boss won't
spring for it.

I've swept this forum for script solutions, as well as
TechNet, but although all the scripts I found seem to work
when I'm logged in as a user, none of them work when run
as a startup script. They *run*, but they don't do
anything.

I don't want to use a logon script that assigns printers
based on computer names, so please don't suggest that.
For reasons too complicated to explain here, the machines
will all share similar names with unique numbers (MS-CLASS-
###). I need to assign a printer on a per machine level.

Since I'm currently running a Startup script, I'm
wondering if it's some kind of permissions issue?
(Startup scripts run as LocalSystem)

What have I missed?

Thanks!
 
Reply With Quote
 
 
 
 
Ken
Guest
Posts: n/a
 
      6th May 2004
If you're not using roaming profiles, you could make the
printer in the room as part of the default user profile.
Alternatively, if the printer is a local printer,
shouldn't it automagically show up in the printers?

Ken

>-----Original Message-----
>I've spent the last two days scouring the web for a
>solution to this, and all I've found are scripts that

work
>per user, but not per machine. Perhaps it's a

permissions
>setting, but here goes.
>
>I work in a school. Each classroom has a printer.

Users
>(students) use multiple computers in multiple rooms
>throughout the day. Computers are grouped into OUs

based
>on room. Each machine needs to print to the printer in
>its room. The printers need to be installed by

default.
>I want to assign them per machine
>
>I know that Policy Maker can do this, but my boss won't
>spring for it.
>
>I've swept this forum for script solutions, as well as
>TechNet, but although all the scripts I found seem to

work
>when I'm logged in as a user, none of them work when run
>as a startup script. They *run*, but they don't do
>anything.
>
>I don't want to use a logon script that assigns printers
>based on computer names, so please don't suggest that.
>For reasons too complicated to explain here, the

machines
>will all share similar names with unique numbers (MS-

CLASS-
>###). I need to assign a printer on a per machine level.
>
>Since I'm currently running a Startup script, I'm
>wondering if it's some kind of permissions issue?
>(Startup scripts run as LocalSystem)
>
>What have I missed?
>
>Thanks!

 
Reply With Quote
 
Aziraphale
Guest
Posts: n/a
 
      6th May 2004
Thanks Ken, for the good suggestions.

The printer is a network printer, not a local printer. We
don't use roaming profiles yet (a policy decision, not
mine). The problem with the default user profile solution
is that if the machines get moved to another room (and
thus the default user profile is changed), and a kid logs
on who already has a profile, then he/she will end up with
the wrong printer.

I do find it a bit mind-blowing that there doesn't seem to
be an effective, elegant solution for what seems like an
obvious problem built into Windows 2000/XP/2003.

Any other suggestions are welcome!
>-----Original Message-----
>If you're not using roaming profiles, you could make the
>printer in the room as part of the default user profile.
>Alternatively, if the printer is a local printer,
>shouldn't it automagically show up in the printers?
>
>Ken
>
>>-----Original Message-----
>>I've spent the last two days scouring the web for a
>>solution to this, and all I've found are scripts that

>work
>>per user, but not per machine. Perhaps it's a

>permissions
>>setting, but here goes.
>>
>>I work in a school. Each classroom has a printer.

>Users
>>(students) use multiple computers in multiple rooms
>>throughout the day. Computers are grouped into OUs

>based
>>on room. Each machine needs to print to the printer in
>>its room. The printers need to be installed by

>default.
>>I want to assign them per machine
>>
>>I know that Policy Maker can do this, but my boss won't
>>spring for it.
>>
>>I've swept this forum for script solutions, as well as
>>TechNet, but although all the scripts I found seem to

>work
>>when I'm logged in as a user, none of them work when run
>>as a startup script. They *run*, but they don't do
>>anything.
>>
>>I don't want to use a logon script that assigns printers
>>based on computer names, so please don't suggest that.
>>For reasons too complicated to explain here, the

>machines
>>will all share similar names with unique numbers (MS-

>CLASS-
>>###). I need to assign a printer on a per machine level.
>>
>>Since I'm currently running a Startup script, I'm
>>wondering if it's some kind of permissions issue?
>>(Startup scripts run as LocalSystem)
>>
>>What have I missed?
>>
>>Thanks!

>.
>

 
Reply With Quote
 
Aziraphale
Guest
Posts: n/a
 
      7th May 2004
I have a very inelegant solution, so if someone has
something better, please let me know.

Basically, I run a machine startup script to copy a
generically named printer install script to a directory on
the client. Then I have a user logon script that calls
the local copy of the printer script.

As I said, inelegant, but it solves the problem for the
time being. I would still prefer something cleaner.

A.

>-----Original Message-----
>Thanks Ken, for the good suggestions.
>
>The printer is a network printer, not a local printer.

We
>don't use roaming profiles yet (a policy decision, not
>mine). The problem with the default user profile

solution
>is that if the machines get moved to another room (and
>thus the default user profile is changed), and a kid logs
>on who already has a profile, then he/she will end up

with
>the wrong printer.
>
>I do find it a bit mind-blowing that there doesn't seem

to
>be an effective, elegant solution for what seems like an
>obvious problem built into Windows 2000/XP/2003.
>
>Any other suggestions are welcome!
>>-----Original Message-----
>>If you're not using roaming profiles, you could make the
>>printer in the room as part of the default user

profile.
>>Alternatively, if the printer is a local printer,
>>shouldn't it automagically show up in the printers?
>>
>>Ken
>>
>>>-----Original Message-----
>>>I've spent the last two days scouring the web for a
>>>solution to this, and all I've found are scripts that

>>work
>>>per user, but not per machine. Perhaps it's a

>>permissions
>>>setting, but here goes.
>>>
>>>I work in a school. Each classroom has a printer.

>>Users
>>>(students) use multiple computers in multiple rooms
>>>throughout the day. Computers are grouped into OUs

>>based
>>>on room. Each machine needs to print to the printer in
>>>its room. The printers need to be installed by

>>default.
>>>I want to assign them per machine
>>>
>>>I know that Policy Maker can do this, but my boss won't
>>>spring for it.
>>>
>>>I've swept this forum for script solutions, as well as
>>>TechNet, but although all the scripts I found seem to

>>work
>>>when I'm logged in as a user, none of them work when

run
>>>as a startup script. They *run*, but they don't do
>>>anything.
>>>
>>>I don't want to use a logon script that assigns

printers
>>>based on computer names, so please don't suggest that.
>>>For reasons too complicated to explain here, the

>>machines
>>>will all share similar names with unique numbers (MS-

>>CLASS-
>>>###). I need to assign a printer on a per machine

level.
>>>
>>>Since I'm currently running a Startup script, I'm
>>>wondering if it's some kind of permissions issue?
>>>(Startup scripts run as LocalSystem)
>>>
>>>What have I missed?
>>>
>>>Thanks!

>>.
>>

>.
>

 
Reply With Quote
 
Andrew Mitchell
Guest
Posts: n/a
 
      7th May 2004
"Aziraphale" <(E-Mail Removed)> said

> I have a very inelegant solution, so if someone has
> something better, please let me know.
>
> Basically, I run a machine startup script to copy a
> generically named printer install script to a directory on
> the client. Then I have a user logon script that calls
> the local copy of the printer script.
>
> As I said, inelegant, but it solves the problem for the
> time being. I would still prefer something cleaner.
>


You could call a vbscript routine from the login script to determine the OU
then install the printer based on that OU.
The ADSystemInfo object will give you the DN (Distinguished Name) of the
computer, which is a string containing (among other details) the OU of the
machine.



'********** Start Script **********
'First - Delete any printers installed during previous login

set wshNetwork = CreateObject ("WScript.Network")

'Enumerate all existing network printers and remove them
Set clPrinters = WshNetwork.EnumPrinterConnections
On Error Resume Next
For i = 0 to clPrinters.Count - 1 Step 2
wshNetwork.RemovePrinterConnection clPrinters.Item(i+1), true
Next

'Now add a printer based on the OU.

Set objSysInfo = CreateObject("ADSystemInfo")
strComputerDN = objSysInfo.ComputerName

'If we are in the OU called "OU1" add a printer called "Printer1"
if instr(1,strComputerDN,"OU1",1)>0 then
wshNetwork.AddWindowsPrinterConnection "\\PrintServer\Printer1"
'Make it the default printer
wshNetWork.SetDefaultPrinter "\\PrintServer\Printer1"

'If we are in the OU called "OU2" add a printer called "Printer2"
Else if instr(1,strComputerDN,"OU2",1)>0 then
wshNetwork.AddWindowsPrinterConnection "\\PrintServer\Printer2"
'Make it the default printer
wshNetWork.SetDefaultPrinter "\\PrintServer\Printer2"

'Keep adding sections for each OU and printer

End if


'********** End Script **********

You will need to test this and check it for any syntax errors. I don't have
ADSI installed or a domain handy ATM to test it with but the basics are
there.

The only shortcoming with this is if you have any parent/child OU's. If you
have your OU's set like this the script will only pick up the first OU in
the If....End If structure.

Let me know if you want any more info.

--
Andy
 
Reply With Quote
 
nevje
Guest
Posts: n/a
 
      19th May 2004
i remember scouring the net for something similar ... ive ended up using
kixscripts for my solution but take a look at the following command in a
command prompt:-

rundll32 printui.dll,PrintUIEntry /?

you can add a printer that is per machine using this ... search for the
syntax if required but i remember it worked fine, but was just a while
ago now and cant remember the specifics
 
Reply With Quote
 
BOFH1234
Guest
Posts: n/a
 
      1st Jul 2004
I work for a university and this is a really large problem for us. My cheap
(free) solution is to use the login script to get the computer name and set
the printer based on that. If you move PCs frequently this will not be a
good solution. Here is a copy of my login script:

if '%COMPUTERNAME%' == '0421PC' rundll32 printui.dll,PrintUIEntry /y /n
"\\pserver1\G158"
if '%COMPUTERNAME%' == '0426PC' rundll32 printui.dll,PrintUIEntry /y /n
"\\pserver1\G158"
if '%COMPUTERNAME%' == '0429PC' rundll32 printui.dll,PrintUIEntry /y /n
"\\pserver1\G158"
if '%COMPUTERNAME%' == '0430PC' rundll32 printui.dll,PrintUIEntry /y /n
"\\pserver1\G158"

if '%computername%' == '1591PC' rundll32 printui.dll,PrintUIEntry /y /n
"\\pserver2\M120"
if '%computername%' == '1612PC' rundll32 printui.dll,PrintUIEntry /y /n
\\pserver2\M120"

if '%COMPUTERNAME%' == '2798PC' rundll32 printui.dll,PrintUIEntry /y /n
"\\pserver1\M109"
if '%COMPUTERNAME%' == '2799PC' rundll32 printui.dll,PrintUIEntry /y /n
\\pserver1\M109"

This is not elegant solution, but it works. Here is what I do to make it
work:

Install XP, hotfixes, software, join to domain, etc.
Create a new user on the domain with domain admin rights.
Login to the PC as the new user.
Set all of the settings you want (show standard and formatting toolbars on
two rows, always show full menus, etc). Get the PC exactly as you want it.
Install all of the printers you want your users to print to.
Logoff
Login as the local admin.
Go into the user profiles area and select the account you just created,
select copy. Find the default user directory and give everyone permission.
Click on OK.
Go to the default user directory, right click, select properties, security
tab, select everyone and uncheck the write permission. User only need read
access.
Use this as your image.

Now when a user logs on to the domain, all possible printers are there and
the login script makes the correct printer the default printer. I worte a
little group policy to hide the printer and faxes option on the start menu.

Now if only MS would allow administrators to set printers at the OU level,
my life and the lifes of many other administrators would be simplified.
Perhaps we might see this HIGHLY NEEDED functionality in Windows 2003 SP1?


"Aziraphale" <(E-Mail Removed)> wrote in message
news:975d01c433f9$908e88b0$(E-Mail Removed)...
> I have a very inelegant solution, so if someone has
> something better, please let me know.
>
> Basically, I run a machine startup script to copy a
> generically named printer install script to a directory on
> the client. Then I have a user logon script that calls
> the local copy of the printer script.
>
> As I said, inelegant, but it solves the problem for the
> time being. I would still prefer something cleaner.
>
> A.
>
> >-----Original Message-----
> >Thanks Ken, for the good suggestions.
> >
> >The printer is a network printer, not a local printer.

> We
> >don't use roaming profiles yet (a policy decision, not
> >mine). The problem with the default user profile

> solution
> >is that if the machines get moved to another room (and
> >thus the default user profile is changed), and a kid logs
> >on who already has a profile, then he/she will end up

> with
> >the wrong printer.
> >
> >I do find it a bit mind-blowing that there doesn't seem

> to
> >be an effective, elegant solution for what seems like an
> >obvious problem built into Windows 2000/XP/2003.
> >
> >Any other suggestions are welcome!
> >>-----Original Message-----
> >>If you're not using roaming profiles, you could make the
> >>printer in the room as part of the default user

> profile.
> >>Alternatively, if the printer is a local printer,
> >>shouldn't it automagically show up in the printers?
> >>
> >>Ken
> >>
> >>>-----Original Message-----
> >>>I've spent the last two days scouring the web for a
> >>>solution to this, and all I've found are scripts that
> >>work
> >>>per user, but not per machine. Perhaps it's a
> >>permissions
> >>>setting, but here goes.
> >>>
> >>>I work in a school. Each classroom has a printer.
> >>Users
> >>>(students) use multiple computers in multiple rooms
> >>>throughout the day. Computers are grouped into OUs
> >>based
> >>>on room. Each machine needs to print to the printer in
> >>>its room. The printers need to be installed by
> >>default.
> >>>I want to assign them per machine
> >>>
> >>>I know that Policy Maker can do this, but my boss won't
> >>>spring for it.
> >>>
> >>>I've swept this forum for script solutions, as well as
> >>>TechNet, but although all the scripts I found seem to
> >>work
> >>>when I'm logged in as a user, none of them work when

> run
> >>>as a startup script. They *run*, but they don't do
> >>>anything.
> >>>
> >>>I don't want to use a logon script that assigns

> printers
> >>>based on computer names, so please don't suggest that.
> >>>For reasons too complicated to explain here, the
> >>machines
> >>>will all share similar names with unique numbers (MS-
> >>CLASS-
> >>>###). I need to assign a printer on a per machine

> level.
> >>>
> >>>Since I'm currently running a Startup script, I'm
> >>>wondering if it's some kind of permissions issue?
> >>>(Startup scripts run as LocalSystem)
> >>>
> >>>What have I missed?
> >>>
> >>>Thanks!
> >>.
> >>

> >.
> >



 
Reply With Quote
 
patrickburwell
Guest
Posts: n/a
 
      7th Sep 2004

Ok, so I am going to try this one. Does anyone know how to set by th
computer assigned OU?
This is for a school and students need to have access to printers b
location of pc.
Also, I just let the last one in the list be the default printe
assigned from the user configuration login script folder. Any way I ca
have the default be left alone?
Patrick Burwell
CNCNJ.com

Here is my contribution:
I used the similar script only simplified and used the login from th
gpo for the user configuration.

Option Explicit
Dim oNetwork, sPrintPath
Set oNetwork = CreateObject("WScript.Network")
sPrintPath = "\\print server\printer sharename"
oNetwork.AddWindowsPrinterConnection sPrintPath
oNetwork.SetDefaultPrinter sPrintPath


Andrew Mitchell wrote:
> *"Aziraphale" <(E-Mail Removed)> said
>
> > I have a very inelegant solution, so if someone has
> > something better, please let me know.
> >
> > Basically, I run a machine startup script to copy a
> > generically named printer install script to a directory on
> > the client. Then I have a user logon script that calls
> > the local copy of the printer script.
> >
> > As I said, inelegant, but it solves the problem for the
> > time being. I would still prefer something cleaner.
> >

>
> You could call a vbscript routine from the login script to determin
> the OU
> then install the printer based on that OU.
> The ADSystemInfo object will give you the DN (Distinguished Name) o
> the
> computer, which is a string containing (among other details) the O
> of the
> machine.
>
>
>
> '********** Start Script **********
> 'First - Delete any printers installed during previous login
>
> set wshNetwork = CreateObject ("WScript.Network")
>
> 'Enumerate all existing network printers and remove them
> Set clPrinters = WshNetwork.EnumPrinterConnections
> On Error Resume Next
> For i = 0 to clPrinters.Count - 1 Step 2
> wshNetwork.RemovePrinterConnection clPrinters.Item(i+1), true
> Next
>
> 'Now add a printer based on the OU.
>
> Set objSysInfo = CreateObject("ADSystemInfo")
> strComputerDN = objSysInfo.ComputerName
>
> 'If we are in the OU called "OU1" add a printer called "Printer1"
> if instr(1,strComputerDN,"OU1",1)>0 then
> wshNetwork.AddWindowsPrinterConnection "\\PrintServer\Printer1"
> 'Make it the default printer
> wshNetWork.SetDefaultPrinter "\\PrintServer\Printer1"
>
> 'If we are in the OU called "OU2" add a printer called "Printer2"
> Else if instr(1,strComputerDN,"OU2",1)>0 then
> wshNetwork.AddWindowsPrinterConnection "\\PrintServer\Printer2"
> 'Make it the default printer
> wshNetWork.SetDefaultPrinter "\\PrintServer\Printer2"
>
> 'Keep adding sections for each OU and printer
>
> End if
>
>
> '********** End Script **********
>
> You will need to test this and check it for any syntax errors.
> don't have
> ADSI installed or a domain handy ATM to test it with but the basic
> are
> there.
>
> The only shortcoming with this is if you have any parent/child OU's
> If you
> have your OU's set like this the script will only pick up the firs
> OU in
> the If....End If structure.
>
> Let me know if you want any more info.
>
> --
> Andy



-
patrickburwel
-----------------------------------------------------------------------
Posted via http://www.mcse.m
-----------------------------------------------------------------------
View this thread: http://www.mcse.ms/message647920.htm

 
Reply With Quote
 
Andrew Mitchell
Guest
Posts: n/a
 
      12th Sep 2004
patrickburwell <(E-Mail Removed)> said

>
> Ok, so I am going to try this one. Does anyone know how to set by the
> computer assigned OU?


The script I posted earlier (that you quoted below) will do this.

> This is for a school and students need to have access to printers by
> location of pc.
> Also, I just let the last one in the list be the default printer
> assigned from the user configuration login script folder. Any way I can
> have the default be left alone?


Just comment out or remove the lines containing:
wshNetWork.SetDefaultPrinter


Andy.




> Patrick Burwell
> CNCNJ.com
>
> Here is my contribution:
> I used the similar script only simplified and used the login from the
> gpo for the user configuration.
>
> Option Explicit
> Dim oNetwork, sPrintPath
> Set oNetwork = CreateObject("WScript.Network")
> sPrintPath = "\\print server\printer sharename"
> oNetwork.AddWindowsPrinterConnection sPrintPath
> oNetwork.SetDefaultPrinter sPrintPath
>
>
> Andrew Mitchell wrote:
>> *"Aziraphale" <(E-Mail Removed)> said
>>
>> > I have a very inelegant solution, so if someone has
>> > something better, please let me know.
>> >
>> > Basically, I run a machine startup script to copy a
>> > generically named printer install script to a directory on
>> > the client. Then I have a user logon script that calls
>> > the local copy of the printer script.
>> >
>> > As I said, inelegant, but it solves the problem for the
>> > time being. I would still prefer something cleaner.
>> >

>>
>> You could call a vbscript routine from the login script to determine
>> the OU
>> then install the printer based on that OU.
>> The ADSystemInfo object will give you the DN (Distinguished Name) of
>> the
>> computer, which is a string containing (among other details) the OU
>> of the
>> machine.
>>
>>
>>
>> '********** Start Script **********
>> 'First - Delete any printers installed during previous login
>>
>> set wshNetwork = CreateObject ("WScript.Network")
>>
>> 'Enumerate all existing network printers and remove them
>> Set clPrinters = WshNetwork.EnumPrinterConnections
>> On Error Resume Next
>> For i = 0 to clPrinters.Count - 1 Step 2
>> wshNetwork.RemovePrinterConnection clPrinters.Item(i+1), true
>> Next
>>
>> 'Now add a printer based on the OU.
>>
>> Set objSysInfo = CreateObject("ADSystemInfo")
>> strComputerDN = objSysInfo.ComputerName
>>
>> 'If we are in the OU called "OU1" add a printer called "Printer1"
>> if instr(1,strComputerDN,"OU1",1)>0 then
>> wshNetwork.AddWindowsPrinterConnection "\\PrintServer\Printer1"
>> 'Make it the default printer
>> wshNetWork.SetDefaultPrinter "\\PrintServer\Printer1"
>>
>> 'If we are in the OU called "OU2" add a printer called "Printer2"
>> Else if instr(1,strComputerDN,"OU2",1)>0 then
>> wshNetwork.AddWindowsPrinterConnection "\\PrintServer\Printer2"
>> 'Make it the default printer
>> wshNetWork.SetDefaultPrinter "\\PrintServer\Printer2"
>>
>> 'Keep adding sections for each OU and printer
>>
>> End if
>>
>>
>> '********** End Script **********
>>
>> You will need to test this and check it for any syntax errors. I
>> don't have
>> ADSI installed or a domain handy ATM to test it with but the basics
>> are
>> there.
>>
>> The only shortcoming with this is if you have any parent/child OU's.
>> If you
>> have your OU's set like this the script will only pick up the first
>> OU in
>> the If....End If structure.
>>
>> Let me know if you want any more info.
>>
>> --
>> Andy *

>
>
>
> --
> patrickburwell
> ------------------------------------------------------------------------
> Posted via http://www.mcse.ms
> ------------------------------------------------------------------------
> View this thread: http://www.mcse.ms/message647920.html
>
>


 
Reply With Quote
 
 
 
Reply

« user | SYSTEM ADMIN »
Thread Tools
Rate This Thread
Rate This Thread:

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Assigning Printers =?Utf-8?B?R2VvcmdlIFNjaG5laWRlcg==?= Microsoft Windows 2000 Group Policy 1 21st Nov 2007 10:31 AM
Assigning Printers WGD Windows XP Basics 1 3rd Jun 2007 04:09 PM
Assigning Printers In OU Chris Microsoft Windows 2000 Active Directory 1 21st Jul 2004 06:27 PM
Assigning Printers Andy Lamb Microsoft Windows 2000 Active Directory 2 30th Oct 2003 03:26 PM
Assigning Printers Graham Microsoft Windows 2000 Group Policy 2 27th Aug 2003 06:36 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:02 PM.