Page 1 of 1 1
Topic Options
#179756 - 2007-08-27 04:24 PM help - Adding Printer the easy way
Kelly_Admin Offline
Fresh Scripter

Registered: 2007-08-24
Posts: 12
Hello everyone,

I just want to add printers depending on the users group.
Users in Group Berlin should get printer1 on serverA:

\\serverA\printer1

How do I code this?

I am absolutely new to Kixtart!

Thanks in advice
Davorin

Top
#179757 - 2007-08-27 04:57 PM Re: help - Adding Printer the easy way [Re: Kelly_Admin]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Use the AddPrinterConnection() Function
Use also the InGroup() Function
Per Example
 Code:
Break On
If InGroup("PrinterFirstFloorNorth")
	AddPrinterConnection("\\PrinterServer\PrinterShareName")
	SetDefaultPrinter("PrinterName")
EndIf

For the syntax, see kix2010.doc of the kixtart 4.53 package
If Else EndIf = Page 41
InGroup() = Page 80
AddPrinterConnection() = Page 55
SetDefaultPrinter() = page 100

Top
#179851 - 2007-08-28 02:24 PM Re: help - Adding Printer the easy way [Re: Witto]
Kelly_Admin Offline
Fresh Scripter

Registered: 2007-08-24
Posts: 12
Thx for the quick and easy answer!

That exactly the way I needed and could understand it!

:-D

Top
#179872 - 2007-08-28 05:02 PM Re: help - Adding Printer the easy way [Re: Kelly_Admin]
dahauss Offline
Fresh Scripter

Registered: 2005-09-02
Posts: 9
Suppose I want to make it so that the printers are added if they login to a specific computer in a computer lab but in another room.

Thanks..

Top
#179877 - 2007-08-28 05:40 PM Re: help - Adding Printer the easy way [Re: dahauss]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
I think you will have to find good arguments to know which printers you want to map, per example
- by computername, or part of it
- by username
- by security group a user is in
- maybe also by Organisational Unit (OU) a user is in (see UDF section)
- by network a user or computer is in
- ...

Top
#179952 - 2007-08-29 10:09 PM Re: help - Adding Printer the easy way [Re: Witto]
Huddy Offline
Fresh Scripter

Registered: 2007-08-29
Posts: 5
I am trying to map a printer based on AD group membership. Here is my problem I am running a W2K3 domain with XP clients. When trying map based on this membership it will not add printer. If I change my member ship to Domain Users it works fine. Now you are probably thinking...Ok he doesn't either hare permission to the printer of the user he is testing with is not a member of this group. I can map the printer manually so permissions are not an issue. I have double and triple checked my member ship.

What can I be missing? I have even go to the extent of checking my AD permissions thinking that this user does not have read permission on this group object

;********************Mapping Printers*******************

If InGroup ("GBLR_PBLRPR1755")
; "HP OfficeJet ProL7550"
ADDPRINTERCONNECTION ("\\PBLRFP01\PBLRPR1755")
? "Added Printer Connection"
SetDefaultPrinter ("\\PBLRFP01\PBLRPR1755")
endif

Top
#179953 - 2007-08-29 10:24 PM Re: help - Adding Printer the easy way [Re: Huddy]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
What shows on your screen if you run this script?

 Code:
If InGroup ("GBLR_PBLRPR1755")
	; "HP OfficeJet ProL7550" 
	$rc = AddPrinterConnection ("\\PBLRFP01\PBLRPR1755")
	?@ERROR
	?@SERROR
	$rc = SetDefaultPrinter ("\\PBLRFP01\PBLRPR1755")
	?@ERROR
	?@SERROR
	Sleep 10
Else
	?"This user is not a member of GBLR_PBLRPR1755"
	Sleep 10
EndIf
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#179954 - 2007-08-29 11:12 PM Re: help - Adding Printer the easy way [Re: Mart]
Huddy Offline
Fresh Scripter

Registered: 2007-08-29
Posts: 5
Mart
Thanks for you quick reply

I get This.....
This user is not a member of GBLR_PBLRPR1755

The group GBLR_PBLRPR1755 is brand new I created it yesterday. The Domain Users group of course is a built in group. So I selected a different group other than Domain Users something this user was currently a member of (GSD_Installs) it mapped the printer fine.

It looks to me that I may have an AD issue where the logged on user does not have the ability to query the group membership of GBLR_PBLRPR1755

Top
#179955 - 2007-08-29 11:24 PM Re: help - Adding Printer the easy way [Re: Huddy]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I'm guessing you need to flush the group token cache.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#179990 - 2007-08-30 03:47 PM Re: help - Adding Printer the easy way [Re: Les]
Huddy Offline
Fresh Scripter

Registered: 2007-08-29
Posts: 5
Les
I exected my script with the /f to flush the cache and it still came back

This user is not a member of GBLR_PBLRPR1755

Kix32.exe test.kix /f

Any other ideas.

Top
#179991 - 2007-08-30 04:00 PM Re: help - Adding Printer the easy way [Re: Huddy]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
Is the user logged on to the same domain as where the group is located? What happens if you add \\yourdomainname\ to the group name?
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#179992 - 2007-08-30 04:09 PM Re: help - Adding Printer the easy way [Re: dahauss]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Are you sure it's a security group?

 Originally Posted By: dahauss
Suppose I want to make it so that the printers are added if they login to a specific computer in a computer lab but in another room.
For that, there is the ComputerInGroup() UDF.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#179993 - 2007-08-30 04:22 PM Re: help - Adding Printer the easy way [Re: Les]
baroni Offline
Lurker

Registered: 2007-08-30
Posts: 1
and how can i check if the printer already exist?!
bc i dont want to over add the printer.

Top
#179994 - 2007-08-30 04:28 PM Re: help - Adding Printer the easy way [Re: baroni]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
You can look in the registry or use one of the available UDFs.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#179996 - 2007-08-30 04:59 PM Re: help - Adding Printer the easy way [Re: Les]
Huddy Offline
Fresh Scripter

Registered: 2007-08-29
Posts: 5
Mart

yes it

Top
#179998 - 2007-08-30 05:43 PM Re: help - Adding Printer the easy way [Re: Huddy]
Huddy Offline
Fresh Scripter

Registered: 2007-08-29
Posts: 5
Sorry Mart I aciidently hit submit

Yes it is a securtiy

I truely beleive I have an AD issue. It appears to be happening to all newly created groups. One thing that I have left out is that we recently added a DC in our Bangalore India site. This DC is W2K3 R2 where our our other DC are straight W2K3.

another thing that I am going to try is the 4.6 Beta version currently I am using the 4.53.

Top
#182248 - 2007-11-05 09:47 AM Re: help - Adding Printer the easy way [Re: Huddy]
Wiggz Offline
Lurker

Registered: 2007-08-31
Posts: 2
Any updates on this. I have put 4.53 on and then the first time we have a new starter, none of his Printers are mapped.

I'm wondering whether this is an AD issue or a 4.53 issue. Does anyone else have any positive results using this function with the AD / 4.53?

Top
#182250 - 2007-11-05 10:18 AM Re: help - Adding Printer the easy way [Re: Wiggz]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
Adding printer is working fine with 4.53. Can you show some code?
Sure there are issues when you run the script right after the user is created and the domain is not fully replicated yet but that is normal behavior.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#182253 - 2007-11-05 11:16 AM Re: help - Adding Printer the easy way [Re: Mart]
Wiggz Offline
Lurker

Registered: 2007-08-31
Posts: 2
I'm wondering whether this is something to do with the speed of our AD then. Our global catalog is 'local' so replication speed shouldn't be an issue.

If anyone else has had these issues it'd be worth knowing

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
0 registered and 259 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.071 seconds in which 0.026 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