fry2k Posted May 10, 2007 Share Posted May 10, 2007 Hello, I want create a new user in the Active directory with Autoit. I try that sicnce weeks. I have found many scripts from many users - but not one can create a user for the active directory. i know how to connect and how to change some attributes. But i cant find the solution to create a user with autoit. Thx for any solution!!! Link to comment Share on other sites More sharing options...
Developers Jos Posted May 10, 2007 Developers Share Posted May 10, 2007 Hello, I want create a new user in the Active directory with Autoit. I try that sicnce weeks. I have found many scripts from many users - but not one can create a user for the active directory.i know how to connect and how to change some attributes. But i cant find the solution to create a user with autoit.Thx for any solution!!!Maybe post what you have and doesn't work ? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
fry2k Posted May 10, 2007 Author Share Posted May 10, 2007 for example, i have found this: $userou = "testou" $user = "testuser" $fname = "firstname" $lname = "lastname" $description = "beschreibung" Call ("CreateUser") Func CreateUser($userou, $user, $fname, $lname, $description = "User") ;If ObjectExists($user) Then Return 0 Dim $objConnection, $objRootDSE $objConnection = ObjCreate("ADODB.Connection") ; Create COM object to AD $objConnection.Provider = "ADsDSOObject" $objConnection.Open ("Active Directory Provider") ; Open connection to AD $objRootDSE = ObjGet("LDAP://RootDSE") $ObjOU = ObjGet("LDAP://" & $userou) $cnname = "CN=" & $lname & "\, " & $fname $ObjUser = $ObjOU.Create ("User", $cnname) $ObjUser.Put ("sAMAccountName", $user) $ObjUser.Put ("description", $description) $ObjUser.SetInfo Return 1 EndFunc ;==>CreateUser No error and no working, maybe no Password? Link to comment Share on other sites More sharing options...
fry2k Posted May 11, 2007 Author Share Posted May 11, 2007 No idea? Link to comment Share on other sites More sharing options...
fry2k Posted May 11, 2007 Author Share Posted May 11, 2007 This i have tried too. #include <Array.au3> ; Define AD Constants Global Const $ADS_GROUP_TYPE_GLOBAL_GROUP = 0x2 Global Const $ADS_GROUP_TYPE_DOMAIN_LOCAL_GROUP = 0x4 Global Const $ADS_GROUP_TYPE_UNIVERSAL_GROUP = 0x8 Global Const $ADS_GROUP_TYPE_SECURITY_ENABLED = 0x80000000 Global $ADS_GROUP_TYPE_GLOBAL_SECURITY = BitOR($ADS_GROUP_TYPE_GLOBAL_GROUP, $ADS_GROUP_TYPE_SECURITY_ENABLED) ; CreateUser $userou = "users=OU, OINK=DC, LOCAL=DC" ; Form is "sampleou=ou, sampleparent=ou, sampledomain1=dc, sampledomain2=dc, sampledomain3=dc" $user = "Username" ;Username, form is SamAccountName without leading 'CN=' $fname = "First Name" $lname = "Last Name" $description = "optional - Description" Call ("CreateUser") Func CreateUser($userou, $user, $fname, $lname, $description = "User") If ObjectExists($user) Then Return 0 Dim $objConnection, $objRootDSE $objConnection = ObjCreate("ADODB.Connection") ; Create COM object to AD $objConnection.Provider = "ADsDSOObject" $objConnection.Open ("Active Directory Provider") ; Open connection to AD $objRootDSE = ObjGet("LDAP://RootDSE") $ObjOU = ObjGet("LDAP://" & $userou) $cnname = "CN=" & $lname & "\, " & $fname $ObjUser = $ObjOU.Create ("User", $cnname) $ObjUser.Put ("sAMAccountName", $user) $ObjUser.Put ("description", $description) $ObjUser.SetInfo Return 1 EndFunc ;==>CreateUser no error and no function ;( Link to comment Share on other sites More sharing options...
ptrex Posted May 11, 2007 Share Posted May 11, 2007 @fry2k Can this help you out. Dim $objDomain, $objUser $objDomain = ObjGet("LDAP://cn=Users,dc=mycorp,dc=com") $objUser = $objDomain.Create("user","cn=vlaunders") $objUser.Put ("sAMAccountName", "vlaunders") $objUser.Put ("userPrincipalName", "vlaunders@mycorp.com") Don't forget to change the LDAP data to your settings. regards ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
fry2k Posted May 14, 2007 Author Share Posted May 14, 2007 thx, i was trying this. but no error und no function ;( Dim $objDomain, $objUser $objDomain = ObjGet("LDAP://cn=Users,dc=OINK,dc=LOCAL") $objUser = $objDomain.Create("user","cn=vlaunders") $objUser.Put ("sAMAccountName", "vlaunders") $objUser.Put ("userPrincipalName", "vlaunders@OINK.LOCAL") has nobody an idea how to create? i mean how to change i know, but i cant find out how to create ;( PLZ Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now