What is the best way to create ActiveDirectory Users

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

What is the best way to create ActiveDirectory Users

Postby stefbrt » Thu Aug 11, 2016 2:46 pm

Hi All

I want to create ActiveDirectory Users out of Servoy.
What ist the best way to this?
Is there an easy solution? I have the it2be_ldapclient Plugin but can't find a way to create an AD-User.

Regards,
Stefan
Stefan Brecht
7r ag, Switzerland
SAN Developer
http://www.seven-r.ch
User avatar
stefbrt
 
Posts: 152
Joined: Wed May 06, 2009 9:32 am
Location: Switzerland

Re: What is the best way to create ActiveDirectory Users

Postby HEKUCH » Tue Aug 16, 2016 8:14 am

Hi Stefan,
I have never do this. One possibility would be to to create a vb-script (oder Powershell-Script) an then execute this script from Servoy.
Here a smal example vb-script:

Option Explicit
Dim strUser
Dim objRootLDAP, objContainer, objNewUser
strUser = "DomGuy2"

' Bind to Active Directory, Users container.
Set objRootLDAP = GetObject("LDAP://rootDSE")
Set objContainer = GetObject("LDAP://cn=Users," & _
objRootLDAP.Get("defaultNamingContext"))

' Build the actual User.
Set objNewUser = objContainer.Create("User", "cn=" & strUser)
objNewUser.Put "sAMAccountName", strUser
objNewUser.SetInfo

WScript.Quit
Hendrick Kurland

DataBit GmbH
CH-9217 Neukirch an der Thur
HEKUCH
 
Posts: 13
Joined: Thu May 05, 2011 8:02 am

Re: What is the best way to create ActiveDirectory Users

Postby stefbrt » Tue Aug 16, 2016 8:54 am

Hi Hendrick

How would I execute the PowerShell Script in Servoy? With "application.executeProgram()"?

Regards,
Stefan
Stefan Brecht
7r ag, Switzerland
SAN Developer
http://www.seven-r.ch
User avatar
stefbrt
 
Posts: 152
Joined: Wed May 06, 2009 9:32 am
Location: Switzerland

Re: What is the best way to create ActiveDirectory Users

Postby HEKUCH » Wed Aug 17, 2016 9:49 am

Hi Stefan,
Unfortunately, I have no example with PowerShell. But with VB-script this works:

Code: Select all
var loFile_vbs = plugins.file.createTempFile('~test','.vbs')
plugins.file.writeTXTFile(loFile_vbs,'WScript.Echo "Hello, World von VB-Script"') ;
application.executeProgram("rundll32.exe", ["url.dll,FileProtocolHandler", loFile_vbs.getPath()]);
Hendrick Kurland

DataBit GmbH
CH-9217 Neukirch an der Thur
HEKUCH
 
Posts: 13
Joined: Thu May 05, 2011 8:02 am


Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 13 guests

cron