Page 1 of 1 1
Topic Options
#211661 - 2016-06-21 05:35 PM Selecting Default Printer
dec_ituk Offline
Just in Town

Registered: 2016-06-17
Posts: 4
Loc: London
Hi All,

I am trying to set my default printer on my login script. I am using kix version 4.66.

I have an attribute in Active Directory saved in the 'notes' (Info) section for each user. In the notes I have "DEFAULT_PRN=%printername%"

I want the script to pick up the 'DEFAULT_PRN' attribute from 'INFO' and set it as the default printer.

Basically i need a function which locates to the 'info' attribute in AD and picks up what the 'DEFAULT_PRN' attribute is equal too.

Any help is greatly appreciated.

Thank you \:\)

Top
#211663 - 2016-06-21 11:31 PM Re: Selecting Default Printer [Re: dec_ituk]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
Loc: USA
Start with this function...

GetADUserProperties() -
http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=194576#Post194576

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

Something like:

 Code:
$User=getaduserproperties() 
? $user.info

;paste function here

Top
#211669 - 2016-06-22 12:39 PM Re: Selecting Default Printer [Re: Allen]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
Allen's example will provide the entire Notes field. You'll need to parse that as well to locate the line containing the printer definition. Something like
 Code:
If InStr($User.info, 'DEFAULT_PRN")
  $Tmp = Split($User.info, 'DEFAULT_PRN=')[1]    ; return all text following "DEFAULT_PRN"
  ; depending on the data structure, you may need to continue parsing to 
  ; remove any data that follows. I'd delimit the end of the printer as an example..
  $DEFAULTP = Split($Tmp, ';')[0]  ; take everything prior to the ";" as the printer name
Else
  $DEFAULTP=$SYSDEFAULTP
EndIf
Just FYI, my login script supports per-user default printers defined in the configuration file - no coding needed. It also has a local %DEFAULT% environment var to assign a LOCAL printer (not mapped by the script) as the default. See my web site for details and the full user manual.

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

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

Generated in 0.051 seconds in which 0.023 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