Jaap_Lelie
(Fresh Scripter)
2011-07-07 05:22 PM
How to manipulate attribute "userParameters" with Kix...

Hi all,
For a project, I need to manipulate 100+ user objects, and modify the userParameters attribute. More precisely, I need to configure the Terminal Services Profile Path. With an old(er) LDAP browser I can't read the value of this attribute (encoded). With a newer version of that same LDAP browser (www.softerra.com) I am able to read the contents of the attribute (multivalue).

My Q: Is it possible to manipulate this attribute using Kix? If so: any pointers?

All feedback greatly appreciated!
Best regards, Jaap.


ShaneEP
(MM club member)
2011-07-07 06:08 PM
Re: How to manipulate attribute "userParameters" with Kix...

You can give the ADProperty() a shot...

http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Board=7&Number=202261

Example (untested...I dont have AD where I am)...
 Code:
ADProperty("LDAP://CN=me,DC=myCompany,DC=org","TerminalServicesProfilePath","\\server\share\")

Function ADProperty($LDAPPath, $property, optional $value)
dim $object
 $object=getobject($LDAPPath)
 if not len($value)
  $ADProperty=$object.get($property)
 else
  $object.putEx(2,$property,split($value))
  $object.setinfo
 endif
EndFunction


Jaap_Lelie
(Fresh Scripter)
2011-07-07 10:35 PM
Re: How to manipulate attribute "userParameters" with Kix...

Many thanks, Shane! Will give it a whirl first thing tomorrow at the office ;-)

Best regards,
Jaap.


Jaap_Lelie
(Fresh Scripter)
2011-07-11 04:36 PM
Re: How to manipulate attribute "userParameters" with Kix...

Hi Shane,
Though the ADProperty function may work well on non-encoded variables, it's sadly a "no-go" on the userParameters variable. When running this on an object that doesn't have the userParameter variable yet, I get a bunch of numbers as if it's encoded. Strangely though, my LDAP browser can read the userParameters variable of another (predefined) object just fine... :-$

I'm starting to wonder if it's at all possible to enter a value in this encoded variable thru kix. Glad to take hints though! :-)

Best regards,
Jaap Lelie.


Mart
(KiX Supporter)
2011-07-11 04:57 PM
Re: How to manipulate attribute "userParameters" with Kix...

Hi Jaap,

Not sure but this might help. There seem to be two API's that can be called (at least from VB) and are able to read and modify the data for TS settings in AD. I’m almost as blind as a bat in VB world so I’m not much help there but it might be possible to do the same thing in kix.

http://support.microsoft.com/kb/292631


ShaneEP
(MM club member)
2011-07-11 06:33 PM
Re: How to manipulate attribute "userParameters" with Kix...

Maybe check out this page...

http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/2e2a5e62-a1df-4fc7-bf4e-db9bc85098cb/

Seems to be some good info there concerning the same situation.


LonkeroAdministrator
(KiX Master Guru)
2011-07-11 11:44 PM
Re: How to manipulate attribute "userParameters" with Kix...

wohoo. my udf was almost useful :P

ShaneEP
(MM club member)
2011-07-11 11:53 PM
Re: How to manipulate attribute "userParameters" with Kix...

Haha I tried, I tried.

Jaap_Lelie
(Fresh Scripter)
2011-07-12 06:53 AM
Re: How to manipulate attribute "userParameters" with Kix...

LOL! :-) Will try each and every suggestion. Thanks guys!!

Jaap_Lelie
(Fresh Scripter)
2011-07-12 08:16 AM
Re: How to manipulate attribute "userParameters" with Kix...

Well, being a VBS virgin myself, I took the code that was supplied in one of the above suggestions, and managed to come up with a Command prompt commandline that actually reads a CSV file. I then parse that info into the VBS script as var1 and var2... and it works.

It looks like an abomination code-wise, but at least it works for now... and with that new-found knowledge I will be able to jack up my VBS knowledge bit by bit.

I agree that in the end this has nothing to do with KiXtart (although I -could- adapt the script to be called from within Kix), apologies for that. However it started out with a kix question... ;-)

Thanks to all who contributed! Much appreciated.
Have phun,
Jaap.


AllenAdministrator
(KiX Supporter)
2011-07-12 02:39 PM
Re: How to manipulate attribute "userParameters" with Kix...

Please share your whatever code you used.

ShaneEP
(MM club member)
2011-07-12 06:29 PM
Re: How to manipulate attribute "userParameters" with Kix...

yes, please post the vbs you got working...I'm sure we could convert it to kix for any future onlookers.