How to write vbscrip to connect AD

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
QuangNgo
Posts: 60
Joined: Thu Mar 31, 2011 8:31 am

How to write vbscrip to connect AD

Post by QuangNgo » Mon May 16, 2011 4:55 pm

Hi guys

I'm working on project that need to connect to Active Directory to check whether user is existed or not ?
I used to use Vb.Net and C#.net to AD , but in livecode just run vbscript to connect AD , so is it Vb.net and VBscript is similar.
Could I use Vb.net to connect to AD ? if so , what should I do ?
Hope you guys give me some solution to fix that problem
Thanks a lot
Quang

QuangNgo
Posts: 60
Joined: Thu Mar 31, 2011 8:31 am

Re: How to write vbscrip to connect AD

Post by QuangNgo » Fri May 20, 2011 10:49 am

Hi guys

I had a vbscript to check whether user exist or not on AD,and now it work well when I run vbscript file.
But in livecode how to pass parameter to this vbscript. On my way is :
put cd field "Authentication" of cd "Test" of stack "Untitled 1" into tVB
put field "Users" into tFullUserID
put field "Passs" into tPassword
replace "strUsername" with "'"&tFullUserID&"'" in tVB-- strUsername is in vbscript
replace "strPassword" with "'"&tPassword&"'" in tVB-- same

and in that vbscript I return value after authentication with AD
but It just return "Execute error"
hope you guy give me ideas to pass parameter into vbscript

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How to write vbscrip to connect AD

Post by Klaus » Fri May 20, 2011 12:14 pm

Hi Quang,

did you check the resulting complete VB scripts?
Put it into a field and I am sure you will SEE where the problems are! :D

Quick hint:
User parenthesis to construct your strings:
...
replace "strUsername" with ("'"&tFullUserID&"'") in tVB
replace "strPassword" with ("'"&tPassword&"'") in tVB
...

To avoid possible problems (e.g. with "wrong" Quotes) you should put the quotes
directly in the field with the "template" VB script. Know what I mean?

In your example I would put this into the template VB script:
...
... 'strUsername' ...
... 'strPassword' ...
...

Then you will only need to replace the "naked" strings:
...
replace "strUsername" with tFullUserID in tVB
replace "strPassword" with tPassword in tVB
## The single QUOTES will remain untouched!
...


Best

Klaus

QuangNgo
Posts: 60
Joined: Thu Mar 31, 2011 8:31 am

Re: How to write vbscrip to connect AD

Post by QuangNgo » Mon May 23, 2011 4:12 pm

Thanks Klaus
Sorry to reply late , but I'm very happy with your explain and my job's done :D
You and SparkOut gave to me 2 option and Those are very useful
Thanks a lot for both you guys

Quang :D

Post Reply