Page 2 of 3 <123>
Topic Options
#159026 - 2006-03-15 07:09 PM Re: A More Automated addprinterconnection() Approach
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22335
Loc: OK
for step by step, a user that is member of one or more of these groups, do the following:
1) start regedit
2) browse to HKEY_CURRENT_USER\Software\KiXtart\TokenCache
3) write down the domain local group names you see in there
4) post the names here
5) drink a cup of coffee

btw,
if you do not see any of these, run kixtart once with the /f switch or delete the tokenCache key with regedit and run kixtart once.
then, check the key again.


Edited by Lonkero (2006-03-15 07:11 PM)

Top
#159027 - 2006-03-15 07:13 PM Re: A More Automated addprinterconnection() Approach
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Better still, instead of writing it down...
1. right-click the key and export it.
2. Feel free to edit the exported text and change a part of the SID and the doamin name for reasons of security.
3. Post the experted text here inside code tags.
4. Coffee, tea, beer, matters not.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#159028 - 2006-03-15 07:15 PM Re: A More Automated addprinterconnection() Approach
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Hint: If you flush with /f, you will need to invoke InGroup() at least once to repopulate it.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#159029 - 2006-03-15 07:20 PM Re: A More Automated addprinterconnection() Approach
hoopes Offline
Fresh Scripter

Registered: 2006-03-02
Posts: 33
So if I'm reading you right, I should just do an addprinterconnection($PRINTER) on every installed printer on the print server and if doesn't work then the user didn't have access. Is that right, and if so, how would kix obtain a list of all my printers?

;--I know this code is completely incorrect but hopefully it gets
;--the point across
for each $PRINTER in $MYPRINTERLIST[$PRINTER]
if addprinterconnection($PRINTER) = 0
? "$PRINTER added successfully."
else
? "$PRINTER not added. Error code = @ERROR"
endfor

Also how would I read the DLG into a list from the Kix TokenCache

Top
#159030 - 2006-03-15 07:22 PM Re: A More Automated addprinterconnection() Approach
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22335
Loc: OK
huh?
there are already 5 posts above showing you how to do it.
some of them are hand in hand walkthroughs...
_________________________
!

download KiXnet

Top
#159031 - 2006-03-15 07:31 PM Re: A More Automated addprinterconnection() Approach
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Quote:

So if I'm reading you right..



You read me wrong. Let me ask a few questions.

1. Is permission the the printer assigned to specific DLGs?
2. Is the user that prints to said printer showing said DLG in TokenCache?

3. If the answer to both of those is YES, then how can the printer mapping fail?

If the answer is YES, then all we need to do is to mine the printer groups from TokenCache to know what printers to map.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#159032 - 2006-03-15 07:34 PM Re: A More Automated addprinterconnection() Approach
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Quote:

Also how would I read the DLG into a list from the Kix TokenCache



Once you have demonstrated that they are in fact there, we will show you how.
Please stop skipping ahead and try to work with us.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#159033 - 2006-03-15 07:47 PM Re: A More Automated addprinterconnection() Approach
hoopes Offline
Fresh Scripter

Registered: 2006-03-02
Posts: 33
1. Most printers are assigned multiple DLGs, so one printer may have three different DLGs based upon type, department, etc. There's not just one DLG per printer

2. Yeah, the printer DLG's that the user needs are showing in TokenCache

3. How can the printer mapping occur if the script doesn't know which printers to map? The DLGs aren't named after the printer, so even if you dig the DLGs from TokenCache how does that tell me what printers are associated with the DLGs.

You'll have to excuse me ladies and gents, I'm a UNIX/Linux guy so all this crap is pretty new to me. Thanks in advance.

Hoopes

Top
#159034 - 2006-03-15 07:52 PM Re: A More Automated addprinterconnection() Approach
hoopes Offline
Fresh Scripter

Registered: 2006-03-02
Posts: 33
I already sent this to you guys but I'll send it again. This is my DLGs for TokenCache:

DOMAIN\dmlcl_grp_corp_MIS_bw_printers
DOMAIN\dmlcl_grp_corp_MIS_clr_printers
DOMAIN\dmlcl_grp_corp_ACCOUNTING_EVERYONE_printers

Top
#159035 - 2006-03-15 08:26 PM Re: A More Automated addprinterconnection() Approach
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
OK, given those three groups, what printers are ACL'd to each and are you prepared to maintain an INI file mapping the relationship of group to printer?

If you are not prepared to manage an INI file then things get way more complicated in your script as every user would have to trawl through every printer's ACEs.

How many printers/groups/users are we talking about? You could write an admin script that builds/maintains the INI file so that the users would not have to do so much heavy lifting.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#159036 - 2006-03-15 08:56 PM Re: A More Automated addprinterconnection() Approach
hoopes Offline
Fresh Scripter

Registered: 2006-03-02
Posts: 33
I have 11 printers ACL'd to those three groups. I would prefer not to maintain an .ini file to map the relationship fo group to printer if anyway possible. That's the only downfall to this whole thing; we would have to traverse through every printer but the upside is we dont have to maintain additional lists, .ini's, or edit scripts.

We have about 50 printers, 35 printer DLGs, and 250 users

Hope that helps.

Hoopes

Top
#159037 - 2006-03-15 09:17 PM Re: A More Automated addprinterconnection() Approach
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Sounds like you are tying your own hands with self-imposed constraints. In that case you may as well just parse through all the printer shares and map the ones that can be mapped.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#159038 - 2006-03-15 10:15 PM Re: A More Automated addprinterconnection() Approach
hoopes Offline
Fresh Scripter

Registered: 2006-03-02
Posts: 33
What would be the most efficient way to parse through all the printer shares?
Top
#159039 - 2006-03-15 10:46 PM Re: A More Automated addprinterconnection() Approach
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11571
Loc: CA
Quote:

What would be the most efficient way to parse through all the printer shares?




An ini file perhaps stored in NETLOGON

Much easier though is to forget about your DLG and ACL the DGG like most Admins do. Cut and dried, over and done with in a few minutes.

Top
#159040 - 2006-03-15 11:07 PM Re: A More Automated addprinterconnection() Approach
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22335
Loc: OK
doc, not really most efficient...
looping the share is doable without any files.

a simple example... winnt provider.
it can list shares, right?

not sure does it list print shares though.
don't have a single printer share to test on
Code:

$PrintServer = "priServer"

$adsiprovider = GetObject("WinNT://" + $PrintServer + "/LanmanServer")

For Each $Share In $adsiprovider
$Share.name " " $Share.path ?
Next

_________________________
!

download KiXnet

Top
#159041 - 2006-03-15 11:37 PM Re: A More Automated addprinterconnection() Approach
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22335
Loc: OK
oh, just remembered this udf:
http://www.kixtart.org/ubbthreads/showflat.php?Cat=0&Number=83465

it's wmi but I know it works without testing it
_________________________
!

download KiXnet

Top
#159042 - 2006-03-15 11:59 PM Re: A More Automated addprinterconnection() Approach
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
If they are published to AD, then ADO can pull them otherwise WMI can get them directly from the printserver. Perms could get in the way for WMI.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#159043 - 2006-03-16 12:03 AM Re: A More Automated addprinterconnection() Approach
hoopes Offline
Fresh Scripter

Registered: 2006-03-02
Posts: 33
Les, How does ADO pull them?
Top
#159044 - 2006-03-16 12:06 AM Re: A More Automated addprinterconnection() Approach
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
A quick search on MSFT turned up this:
VBS Code:
Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.CommandText = "Select printerName, serverName from " _
& " 'LDAP://DC=fabrikam,DC=com' where objectClass='printQueue'"
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Timeout") = 30
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.Properties("Cache Results") = False
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
Wscript.Echo "Printer Name: " & objRecordSet.Fields("printerName").Value
Wscript.Echo "Server Name: " & objRecordSet.Fields("serverName").Value
objRecordSet.MoveNext
Loop


_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#159045 - 2006-03-16 12:48 AM Re: A More Automated addprinterconnection() Approach
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11571
Loc: CA
Quote:

doc, not really most efficient...
looping the share is doable without any files.





Not sure what you're talking about there Jooel. I can pretty much gurantee you that the hundreds of thousands of Admins around the World sure the heck are not running around going through all these hoops/loops/special coding/special ACL junk.

Using Global groups for this task is the EASIEST method period. Can it be done other ways, sure as we see here in this crazy thread, but find me one question on any test for Microsoft Networking that would even attempt to explain that you would do special coding to map a printer for the user..

I'm not a big fan of mapping a printer for a user automatically anyways. It's not rocket science.
Teach the user or have the help desk do it, it's not something that has to be done daily or even weekly.

Top
Page 2 of 3 <123>


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 59 anonymous users online.
Newest Members
diefnet, Arogya, gkustra, emnipetro, Hirze
17644 Registered Users

Generated in 0.04 seconds in which 0.011 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org