Kelly_Admin
(Fresh Scripter)
2007-08-27 04:24 PM
help - Adding Printer the easy way

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


Witto
(MM club member)
2007-08-27 04:57 PM
Re: help - Adding Printer the easy way

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


Kelly_Admin
(Fresh Scripter)
2007-08-28 02:24 PM
Re: help - Adding Printer the easy way

Thx for the quick and easy answer!

That exactly the way I needed and could understand it!

:-D


dahauss
(Fresh Scripter)
2007-08-28 05:02 PM
Re: help - Adding Printer the easy way

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..


Witto
(MM club member)
2007-08-28 05:40 PM
Re: help - Adding Printer the easy way

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
- ...


Huddy
(Fresh Scripter)
2007-08-29 10:09 PM
Re: help - Adding Printer the easy way

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


Mart
(KiX Supporter)
2007-08-29 10:24 PM
Re: help - Adding Printer the easy way

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


Huddy
(Fresh Scripter)
2007-08-29 11:12 PM
Re: help - Adding Printer the easy way

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


Les
(KiX Master)
2007-08-29 11:24 PM
Re: help - Adding Printer the easy way

I'm guessing you need to flush the group token cache.

Huddy
(Fresh Scripter)
2007-08-30 03:47 PM
Re: help - Adding Printer the easy way

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.


Mart
(KiX Supporter)
2007-08-30 04:00 PM
Re: help - Adding Printer the easy way

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?

Les
(KiX Master)
2007-08-30 04:09 PM
Re: help - Adding Printer the easy way

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.


baroni
(Lurker)
2007-08-30 04:22 PM
Re: help - Adding Printer the easy way

and how can i check if the printer already exist?!
bc i dont want to over add the printer.


Les
(KiX Master)
2007-08-30 04:28 PM
Re: help - Adding Printer the easy way

You can look in the registry or use one of the available UDFs.

Huddy
(Fresh Scripter)
2007-08-30 04:59 PM
Re: help - Adding Printer the easy way

Mart

yes it


Huddy
(Fresh Scripter)
2007-08-30 05:43 PM
Re: help - Adding Printer the easy way

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.


Wiggz
(Lurker)
2007-11-05 09:47 AM
Re: help - Adding Printer the easy way

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?


Mart
(KiX Supporter)
2007-11-05 10:18 AM
Re: help - Adding Printer the easy way

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.


Wiggz
(Lurker)
2007-11-05 11:16 AM
Re: help - Adding Printer the easy way

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