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