[THIN] Re: logon vbs to auto set printer based on OU membership and PC location

  • From: "Braebaum, Neil" <Neil.Braebaum@xxxxxxxxxxxxxxxxx>
  • To: <thin@xxxxxxxxxxxxx>,"MSWinNT 2000 Newsgroup" <nt2000@xxxxxxxxxxxx>
  • Date: Thu, 24 Jul 2003 09:32:11 +0100

Comments inline... (also copied to the scripting list)

        -----Original Message-----
        From: Ron Jameson [mailto:ronj@xxxxxxxxxxxxxx] 
        Sent: 23 July 2003 23:32
        To: MSWinNT 2000 Newsgroup; Thin Net Newsgroup
        Subject: [THIN] logon vbs to auto set printer based on OU
membership and PC location
        
        
        I have a bit complex logon.bat file for a 20user W2k TermServ
login that hands the users a desktop/start menu, copies some custom
normal.bat for word, drive mappings, checks membership via "Ifmember"
and applies more programs if they are the member etc.
         

Using vbscript / ADSI (and WSH as the engine), ifmember type
functionality is a touch more complex than it is either using the
resource kit IFMEMBER.EXE, or something like ingroup function in Kix.
Nevertheless, it can be done - merely that it's more complex.

        I need to add now automatic printer setups for the users based
on their OU location and thought it is good time to move this to a .vbs
script to do all of this.  I want to delete the printer when done and
reconnect at every login to the server shared printer. 
         

So are you saying that you are going to group your users and printers
together in an OU structure?
 
The system that I implemented has a different rationale. I make the
connection between the device (ie in this instance I'm referring to a
PC) and the printer(s). I group the printqueues in an OU hierarchy that
represents the physical locations within building(s). And the location
field on the PC / computer object in AD, points to the OU where the
printers for that PC's / computer's location should reside. What I then
do, is when login occurs, the login script obtains the PC's location
field, then opens the OU that this refers to, evaluates all the printers
in that OU, then maps them. 

        Question - is there a way to replace ifmember in a .vbs script..

         

As you've mentioned both groups and OUs - are you referring to both
constructs? There's no obvious easy way, you have to evaluate the
construct your referring, and then check for membership. It becomes a
touch more tricky, if you are considering inherited group membership (ie
a group that's a member, or contains other groups).
 

        in a way to pull the OU info in AD and apply it in the fashion
to say if the user is in this OU, you get these printers.  Now I have
another issues to add - if the user is in an OU and logs on a different
PC, I would also want to know/have the option to say if the PC is here,
you can print to these printers in addition to what the user normally
prints to.
         

Well you'd probably benefit from fully solidifying the logic / rationale
/ algorithm you want to use, then ensuring your AD structure design fits
this, then code your script to deal with it. As always, though, the
first step is the most important - getting the logic / decision-making
right.
 

        In the multiple location office, I want the user to be able to
print to a printer nearby if they login at office 1 but also be able to
see their normally home printer in office 2.  This gives them the option
to print locally or print where they normally belong.
         

Then you need to design what logic will support that - *then* consider
how you are going to script it.

        Whew....any hints if .vbs is going to handle this?  I had a
script from a tech years ago where he created a manual text file showing
locations of PC's and passed the info to a .vbs code to know what
printer to add.  It still works today...but I would rather tie the info
from AD.
         

 
Indeed - this was my design rationale when implementing the printer
stuff when I was migrating to W2K and AD - rather than a big long login
script, with lots of "magic" - ie lists of groups, then printer mappings
that were appropriate - I wanted AD to be the repository for that
information - as it should be - the same could be said for drive
mappings and the like.
 
Neil

***********************************************
This e-mail and its attachments are confidential
and are intended for the above named recipient
only. If this has come to you in error, please 
notify the sender immediately and delete this 
e-mail from your system.
You must take no action based on this, nor must 
you copy or disclose it or any part of its contents 
to any person or organisation.
Statements and opinions contained in this email may 
not necessarily represent those of Littlewoods.
Please note that e-mail communications may be monitored.
The registered office of Littlewoods Limited and its
subsidiaries is 100 Old Hall Street, Liverpool, L70 1AB.
Registered number of Littlewoods Limited is 262152.
************************************************

Other related posts: