Page 1 of 1 1
Topic Options
#206749 - 2013-02-22 12:39 PM INGROUP - Win7 - W2k8 Domain [solved]
badmin Offline
Fresh Scripter

Registered: 2008-04-16
Posts: 7
Hi there,
I've seen some threads about INGROUP not working but all relay to W2k Domains.
I have a pretty new 2k8 R2 Domain with Windows 7 clients (SP1 installed)
When I started I remember that it worked well.
There's a small function "Mapdrives()":
 Code:
USE H: /DELETE /Persistent
	USE G: /DELETE /Persistent
	USE I: /DELETE /Persistent
	USE J: /DELETE /Persistent
	
	Use H: "\\srv01\User Homes\%username%" /PERSISTENT
	
	Use I: "\\srv01\share2" /PERSISTENT
	
	Use J: "\\srv01\share3" /PERSISTENT

	IF INGROUP("Geschäftsführung")

		Use G: "\\srv01\Geschäftsführung" /PERSISTENT
	ENDIF
Now I added a function called "Mapprinters()":
 Code:

Function MapPrinter()

	Shell "\\srv01\NETLOGON\con2prt.exe /f"

	
	$ = AddPrinterConnection("\\srv01\PRT01 SHARP MX-2300N PCL6")
	$ = AddPrinterConnection("\\srv01\PRT02 HP LaserJet P3015")
	
	Select
	
		Case InGroup ("prt01")
	
			$ = SetDefaultPrinter("\\srv01\PRT01 SHARP MX-2300N PCL6")
	
		Case InGroup ("prt02")
	
			$ = SetDefaultPrinter("\\srv01\PRT02 HP LaserJet P3015")
	
	
		Case 1 ;default - wenn keine andere option zutrifft
	
			$ = SetDefaultPrinter("\\srv01\PRT01 SHARP MX-2300N PCL6")
	
	EndSelect

EndFunction
When the user logs on, all printers are connected but prt01 remains as standard even when the user is member of group prt02

The script is called via kix.bat in Sysvol:
%LOGONSERVER%\NETLOGON\kix32.exe /f -i %LOGONSERVER%\NETLOGON\drives_printers.kix

There are no entries in the eventlog of the client.
Do you have any ideas?

Thanks,
Harry


Edited by badmin (2013-02-25 12:00 PM)
Edit Reason: marked as solved

Top
#206750 - 2013-02-22 12:55 PM Re: INGROUP - Win7 - W2k8 Domain [Re: badmin]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
Harry,

Welcome to KORG. When posting your code, put "code tags" around it to preserve the formatting. Edit your original post to see how it's done.

Most likely, the user is a member of PRT01 group. In a Case statement, the first condition to satisfy the test will be performed. If users are potentially members of multiple groups, you will need to define a priority scheme of some kind, save the printers (possibly in an array) and then set the default based on the highest priority.

Our login script handles this through different mechanisms, such as
- a table of per-user or per-computer DefaultPrinter settings
- a local DEFAULTPRINTER environment variable, again by user or machine
- PRIORITY values in the resource table
- SetDefault parameter for each resource

While processing, a "DefaultEligible" flag is set, and then logic is applied to find the best selection for the default printer based on all printers that have the DefaultEligible flag set.

You can review the user guide for the script on our web site (see my sig) to get some ideas for your script, or download our script to try. It's free to use in environments with 4 or fewer domain controllers.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#206751 - 2013-02-22 12:58 PM Re: INGROUP - Win7 - W2k8 Domain [Re: Glenn Barnas]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
One other note..

Your SHELL command references a specific server\NetLogon.. this is not a good idea as things will break if that DC is not available or when it's upgraded/replaced. Always use the domain name there - "\\%USERDOMAIN%\NetLogon". This format will work whether you have 1 or 100 domain controllers, no matter which one the user connects to. You might only have one DC today, but you can't tell what tomorrow brings!

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#206754 - 2013-02-22 02:57 PM Re: INGROUP - Win7 - W2k8 Domain [Re: Glenn Barnas]
badmin Offline
Fresh Scripter

Registered: 2008-04-16
Posts: 7
 Originally Posted By: Glenn Barnas
Harry,

Welcome to KORG. When posting your code, put "code tags" around it to preserve the formatting. Edit your original post to see how it's done.

Most likely, the user is a member of PRT01 group. In a Case statement, the first condition to satisfy the test will be performed. If users are potentially members of multiple groups, you will need to define a priority scheme of some kind, save the printers (possibly in an array) and then set the default based on the highest priority.

Our login script handles this through different mechanisms, such as
- a table of per-user or per-computer DefaultPrinter settings
- a local DEFAULTPRINTER environment variable, again by user or machine
- PRIORITY values in the resource table
- SetDefault parameter for each resource

While processing, a "DefaultEligible" flag is set, and then logic is applied to find the best selection for the default printer based on all printers that have the DefaultEligible flag set.

You can review the user guide for the script on our web site (see my sig) to get some ideas for your script, or download our script to try. It's free to use in environments with 4 or fewer domain controllers.

Glenn


Hi Glenn,

thanks for you fast answer and sorry for the quotes. I'll do better next time. \:\)

Your example of multiple groups is right, but we only use it in a very simple way.
Users tell us which printer they'd like to have as default and I put/move their account in the according group.

Using your or my way - the ingroup command is the same and it doesn't work.
I only find postings according to Windows 2k Domains.

Thanks again for the info on my %shell% command. I'll change that soon \:\)

Harry

Top
#206757 - 2013-02-22 04:37 PM Re: INGROUP - Win7 - W2k8 Domain [Re: badmin]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
Perhaps none of the groups are being detected, and it's simply setting the default according to the Case 1 which also happens to be the same as PRT01. I would recommend changing the Case 1 line to the other printer just as a test to see if you get different results.

 Code:
Case 1 ;default - wenn keine andere option zutrifft
	
			$ = SetDefaultPrinter("\\srv01\PRT02 HP LaserJet P3015")

Top
#206759 - 2013-02-22 06:33 PM Re: INGROUP - Win7 - W2k8 Domain [Re: ShaneEP]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
And add some logging to the decision process!

No worries about the quote tags.. most new users aren't aware they exist until someone mentions them.

To Shane's point - I agree. I didn't notice that the default case was the same.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#206760 - 2013-02-23 12:47 AM Re: INGROUP - Win7 - W2k8 Domain [Re: Glenn Barnas]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I would start by running kixtart with the /f switch.
and adding some logging to the script will serve the purpose that at least you know you are running the latest version of the script.
_________________________
!

download KiXnet

Top
#206764 - 2013-02-23 10:46 AM Re: INGROUP - Win7 - W2k8 Domain [Re: Lonkero]
badmin Offline
Fresh Scripter

Registered: 2008-04-16
Posts: 7
Ok, changing the default to another than the first connected sounds like a good debugging idea.
How can I add general debugging to the script?

I'm using /f already.

Top
#206765 - 2013-02-23 10:47 AM Re: INGROUP - Win7 - W2k8 Domain [Re: badmin]
badmin Offline
Fresh Scripter

Registered: 2008-04-16
Posts: 7
Oh I forgot to mention that my DC's are 2012 machines. Maybe there's an issue with that?
Top
#206766 - 2013-02-23 02:25 PM Re: INGROUP - Win7 - W2k8 Domain [Re: badmin]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
I have a customer on Server 2012, and win 7 machines. I have not had any issues with their logon script or groups.
Top
#206775 - 2013-02-24 04:06 PM Re: INGROUP - Win7 - W2k8 Domain [Re: badmin]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
 Originally Posted By: badmin
How can I add general debugging to the script?


See this post for a review of a UDF called fMsg(), which was developed to support normal and multiple levels of debug logging.

The latest fMsg UDF can be downloaded from the Kix UDF library on my web site.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#206790 - 2013-02-25 11:21 AM Re: INGROUP - Win7 - W2k8 Domain [Re: Glenn Barnas]
badmin Offline
Fresh Scripter

Registered: 2008-04-16
Posts: 7
Today I started with "messagebox-debugging" ;\)
Put a messagebox to the ingroup selection and see if it pops up.

-> Ingroup works fine!
there's a problem with
 Code:
$ = SetDefaultPrinter("\\servername\XGMS-MUC1-PRT05 HP LaserJet P3011P3015 PCL6")


Edited by badmin (2013-02-25 11:21 AM)

Top
#206791 - 2013-02-25 11:58 AM Re: INGROUP - Win7 - W2k8 Domain [Re: badmin]
badmin Offline
Fresh Scripter

Registered: 2008-04-16
Posts: 7
Ok, think it's done.
There's a litte "/" that makes the difference between the "share-name" and the "printername"
SetDefaultPrinter uses the printername, addprinterconnection uses the share-name

Top
#206792 - 2013-02-25 01:27 PM Re: INGROUP - Win7 - W2k8 Domain [Re: badmin]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
If you are interested, there is a PrinterConnection UDF that simplifies adding, deleting, checking for existance of, and setting default, to allow you to always use the share name...

PrinterConnection
http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=203840#Post203840

How to use UDFs -
http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=81943#Post81943

The rest of the UDFs are here -
http://www.kixtart.org/forums/ubbthreads.php?ubb=postlist&Board=7&page=1

Top
#206793 - 2013-02-25 01:55 PM Re: INGROUP - Win7 - W2k8 Domain [Re: badmin]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
 Originally Posted By: badmin
Ok, think it's done.
There's a litte "/" that makes the difference between the "share-name" and the "printername"
SetDefaultPrinter uses the printername, addprinterconnection uses the share-name


And that is exactly why having both of them set to the same value is best practice in my opinion ;\)
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#206794 - 2013-02-25 02:27 PM Re: INGROUP - Win7 - W2k8 Domain [Re: Mart]
badmin Offline
Fresh Scripter

Registered: 2008-04-16
Posts: 7
 Originally Posted By: Mart
 Originally Posted By: badmin
Ok, think it's done.
There's a litte "/" that makes the difference between the "share-name" and the "printername"
SetDefaultPrinter uses the printername, addprinterconnection uses the share-name


And that is exactly why having both of them set to the same value is best practice in my opinion ;\)


Absolutely! I didn't want them to be different! That's why it took me so long to figure it out


Edited by badmin (2013-02-25 02:28 PM)

Top
Page 1 of 1 1


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

Who's Online
1 registered (Allen) and 1172 anonymous users online.
Newest Members
StuTheCoder, M_Moore, BeeEm, min_seow, Audio
17884 Registered Users

Generated in 0.076 seconds in which 0.032 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