Sign in to follow this  
Followers 0
arcker

vbs to autoit for AD

6 posts in this topic

hello evry1; i'm in trouble with objects ! i've read the help file but it's not enough for my problem.

So, i want to use autoit to create an UO under active directory. I've the code for the vbscript, but i want to

translate it, so, here is the code in vbs :

txtOUracine = "LDAP://OU=" & txtConteneur & ",DC=Vaio,DC=dom"
Set objOU = GetObject(txtOUracine)

if err.Number<>0 Then
  WScript.Echo "Error : UO base non found" 
else
txtMonOU="OU=" & txtNomOU
  Set objMonOU = objOU.Create("organizationalUnit", txtMonOU)

and here my translate

$txtOUracine = "LDAP://OU=" & $txtConteneur & ",DC=Vaio,DC=dom"
$objOU = Objget($txtOUracine)

if @error<>0 Then
  msgbox(0, "Erreur : UO base non found" )
else
   $txtMonOU="OU=" & $txtNomOU
 $objMonOU = objcreate("$objOU.organizationalUnit", $txtMonOU <=the problem !

so, i'm good ?

thx again

have a good day


-- 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



$txtOUracine = "LDAP://OU=" & $txtConteneur & ",DC=Vaio,DC=dom"
$objOU = Objget($txtOUracine)

if @error<>0 Then
  msgbox(0, "Erreur : UO base non found" )
else
   $txtMonOU="OU=" & $txtNomOU
 $objMonOU = objcreate("$objOU.organizationalUnit", $txtMonOU <=the problem !

You'll probably need to check isObj($objOU) instead of @error -- this behaviour is different than vbs:

$txtOUracine = "LDAP://OU=" & $txtConteneur & ",DC=Vaio,DC=dom"
$objOU = Objget($txtOUracine)

if not isObj($objOU) Then
  msgbox(0, "Erreur : UO base non found" )
else
   $txtMonOU="OU=" & $txtNomOU
 $objMonOU = objcreate("$objOU.organizationalUnit", $txtMonOU <=the problem !

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

thx for the error solution ! but for the last line of the code, is it correct ?

because to confirm the add, in vbs there is :

objMonOU.SetInfo

how translate it in autoit ?


-- 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

#4 ·  Posted (edited)

objMonOU.SetInfo

how translate it in autoit ?

I'm not aware if AutoIT does this natively, but I'm using Admod/Adfind from www.joeware.com to modify existing objects. Unfortunately it cannot add new objects. Edited by jefhal

...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format

Share this post


Link to post
Share on other sites

Ohhh... OK.

I must say that you camouflaged your question in the code block of the base post quite expertly B)

Assuming that the code works in vbs, the last line should not be translated into ObjCreate in AutoIt. Instead, it appears that the objOU has a method of "Create", so it would be translated to

$objMonOU = $objOU.Create("organizationalUnit", $txtMonOU)

I'm not sure I understand the question about objMonOU.SetInfo -- it should simply translate as $objMonOU.SetInfo or you could do

$result = $objMonOU.SetInfo

Did I understand your questions?

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

yes you have understand and thanx for the answer

browsing the forum i've found a post that say there is test of com objects in the zip of beta version, but i can't find them

it would be useful

thx for the solution, because i didn't now that autoit is able to do "*.setinfo" and other

i can't test my script for now, but it seems there is no error, so when i'll test it, i'll inform you

thx again dale, you're amazing !


-- 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