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