Assigning Printers w/ GPO per machine

aziraphale

Distinguished
May 6, 2004
785
0
18,980
Archived from groups: microsoft.public.win2000.group_policy (More info?)

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!
 

ken

Distinguished
Jan 15, 2004
1,241
0
19,280
Archived from groups: microsoft.public.win2000.group_policy (More info?)

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!
 

aziraphale

Distinguished
May 6, 2004
785
0
18,980
Archived from groups: microsoft.public.win2000.group_policy (More info?)

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!
>.
>
 

aziraphale

Distinguished
May 6, 2004
785
0
18,980
Archived from groups: microsoft.public.win2000.group_policy (More info?)

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!
>>.
>>
>.
>
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.group_policy (More info?)

"Aziraphale" <anonymous@discussions.microsoft.com> 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
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.group_policy (More info?)

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
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.group_policy (More info?)

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" <anonymous@discussions.microsoft.com> wrote in message
news:975d01c433f9$908e88b0$a401280a@phx.gbl...
> 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!
> >>.
> >>
> >.
> >
 

MusTang

Distinguished
Jul 20, 2004
8
0
18,510
Archived from groups: microsoft.public.win2000.group_policy (More info?)

How did you use the startup script to copy. I have tried but I cannot get it to work. Do you have and samples?

"Aziraphale" wrote:

> 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!
> >.
> >
>
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.group_policy (More info?)

Ok, so I am going to try this one. Does anyone know how to set by the
computer assigned OU?
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?
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" <anonymous@discussions.microsoft.com> 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
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.group_policy (More info?)

patrickburwell <patrickburwell.1c7xo0@mail.mcse.ms> 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" <anonymous@discussions.microsoft.com> 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
>
>