Sign in to follow this  
Followers 0
arcker

vbs to autoit for AD

3 posts in this topic

heelo evryone, i would like to convert this script in vbs to autoit, but my conversion doesn't work, can you tell me why ?

here the script in vbs :

LDAP_Domaine = "DC=" & NOM_DOMAINE & ",DC=" & SUFFIXE_DOMAINE
  cheminOU="LDAP://OU=" & OU_Fille & ",OU=" & OU_Eleves & "," & LDAP_Domaine
  set objOU = getobject(cheminOU)
  If Err.Number<>0 Then
    msgERREUR = "ERREUR : Unité Organisationnelle introuvable"
  Else
    '-> créer un nouvel objet utilisateur
    set objUSR = objOU.create("user", "cn=" & plogin)
    '-> renseigner les popriétés du nouvel utilisateur
    objUSR.Put "samAccountName", plogin 'compte avant 2000
    objUSR.Put "givenname", cstr(pprenom)
    objUSR.Put "sn", cstr(pnom)
    objUSR.Put "Description", "utilisateur créé automatiquement"

and here my translate (simplified)

;$Domain=InputBox(0,"Domaine","entrer le domaine")
    $Domain="LABO06.btsig"
    Local $ObjDomain = ObjGet("WinNT://" & $Domain)
    $nv = InputBox("Nouveau","Nom du nouvel utilisateur")
    
For $Object In $ObjDomain
    
    $objUSR = $Object.Create("user", "cn=" & "essai")
     
    $objUSR.Put ("samAccountName", "essai") 
    $objUSR.Put ("givenname", "essaigivenname")
    $objUSR.Put ("sn", "essaisn")
    $objUSR.Put ("Description", "utilisateur créé automatiquement")
    $objUSR.SetInfo

Next

if you find ... thx

of course you need to have active directory to test

Amicalement

Arcker


-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

Projects :

[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]

Share this post


Link to post
Share on other sites



1. What errors are you getting?

2. I've used the LDAP:// stuff before, but not WinNT://. I'd guess that the object you're retrieving using WinNT:// us not the same as the object retrieved using LDAP:// and may not support the same methods. If you are, in fact, using Active Directory, then stick with the LDAP://OU=blah,DC=domain,DC=com format.

I always try to stick as close to the MSDN examples as possible until I know it works. Then I modify it to fit my needs. Take the snippet you found, convert it inline in it's own script and test it. When it works, embed it into your larger script.


My UDFs: ExitCodes

Share this post


Link to post
Share on other sites

hi C0deworm, can you post it one of your script that uses AD ?

i think it would be useful how autoit works especially for objects

my error is at the line :

$objUSR = $Object.Create("user", "cn=" & "essai")

doesn't work

i've tried many things, but doesn't work here

thanx man

c u


-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

Projects :

[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0