Jump to content

Recommended Posts

Posted (edited)

The problem seems to be that the command in line 80 returns an error:

[80] $oAD_Connection = ObjCreate("ADODB.Connection") ; Create COM object to AD
[81] $oAD_Connection.ConnectionString = "Provider=ADsDSOObject"

  • Do you run your script on a PC or on the Active Directory Server?
  • Is your PC a member of the domain?
  • Maybe you need a userid and password to access the AD?
Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

The problem seems to be that the command in line 80 returns an error:

[80] $oAD_Connection = ObjCreate("ADODB.Connection") ; Create COM object to AD
[81] $oAD_Connection.ConnectionString = "Provider=ADsDSOObject"

  • Do you run your script on a PC or on the Active Directory Server?
  • Is your PC a member of the domain?
  • Maybe you need a userid and password to access the AD?

I run this script since a PC Ce Pc is member of my domain

I run this script as administrator domain.

I test tomorrow this guiding script since the waiter Active Directory Server.

On the other hand this script works but I manage to make what I want :

#include <GUIConstants.au3>
#include <Misc.au3>
#include <INet.au3>
#include <array.au3>
Const $ADS_NAME_INITTYPE_GC = 3
Const $ADS_NAME_TYPE_NT4 = 3
Const $ADS_NAME_TYPE_1779 = 1
Const $UF_DISABLED = 0x0002;

Dim $unlock
Dim $mgrvalue
Dim $mgrsplit
Dim $manager
Dim $mgr
Dim $title
Dim $pwdexpires


Global $Date, $time
$oMyError = ObjEvent("AutoIt.Error", "ComError")
$objRootDSE = ObjGet("LDAP://RootDSE")
$username = "lthobois"


Global $strHostServer = $objRootDSE.Get("dnsHostName") ; Retrieve the name of the connected DC
If @error Then
    MsgBox(0, $username, "l'utilisateur n'existe pas ou le domaine n'est pas joignable" & @LogonDomain)
Else
    ; DNS domain name.
    $objTrans = ObjCreate("NameTranslate")
    $objTrans.Init($ADS_NAME_INITTYPE_GC, "")
    $objTrans.Set($ADS_NAME_TYPE_1779, @LogonDomain)
    $objTrans.Set($ADS_NAME_TYPE_NT4, @LogonDomain & "\" & $username)
    $strUserDN = $objTrans.Get($ADS_NAME_TYPE_1779)
    $UserObj = ObjGet("LDAP://" & $strUserDN)
    If @error Then
        MsgBox(0, 'username2', 'Username does not exist or not able to communicate with ' & @LogonDomain)
    Else
        Call("Displayinfo")
    EndIf
EndIf

Func ComError()
    If IsObj($oMyError) Then
        $HexNumber = Hex($oMyError.number, 8)
        SetError($HexNumber)
    Else
        SetError(1)
    EndIf
    Return 0
EndFunc   ;==>ComError


Func Displayinfo()
    MsgBox(0, "Login ", $UserObj.SAMAccountName)
    MsgBox(0, "Nom ", $UserObj.sn)
    MsgBox(0, "Prénom ", $UserObj.givenName)
    MsgBox(0, "Email ", $UserObj.mail)
    MsgBox(0, "Tél ", $UserObj.TelephoneNumber)
    MsgBox(0, "Description  ", $UserObj.description)
    $UserObj.PUT("description", "pour test")
    $UserObj.SetInfo
    MsgBox(0, "Description  ", $UserObj.description)
endfunc
Posted

There are two possible ways to solve this problem:

  • Download the most current version of adfunctions.au3 from here. Then your script sould work fine.
  • Download my translation of the above UDF from here. Then your script should work fine as well.
Please tell me which version you would like to test.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

  • 2 months later...
Posted (edited)

Hi, I just downloaded the UDF from http://www.autoitscript.com/forum/index.php?app=downloads&showfile=66 and think it has a bug. I run _ADAddUserToGroup($group, $user) which returns -1 when it succeeds, but the documentation says it should return 1. I think the problem stems from

Func _ADIsMemberOf($group, $user)
    $ObjGroup = _ADObjGet("LDAP://" & $strHostServer & "/" & $group)
    If Not IsObj($ObjGroup) Then Return -1
    $ismember = $ObjGroup.IsMember("LDAP://" & $strHostServer & "/" & $user)
    $ObjGroup = 0
    Return -$ismember
EndFunc   ;==>_ADIsMemberOf
Why does this return -$ismember instead of $ismember?

Edit: Never mind, figured it out by using UDF found at http://www.autoitscript.com/forum/index.php?showtopic=106163.

Edited by Prab
Posted

Just for the records:

AutoIt <= 3.3.2.0 had a Bug (#1068): 'Binary to Int' returned wrong result. This was solved by returning a negative result by the AD function. When the bug was fixed in Autoit the fix in the UDF suddenly returned a wrong result.

AD.au3 (see my signature for download) is the "successor" of adfunctions.au3. Some code is inserted to make it run correctly for all AutoIt versions.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

Something like this?

Or do you think it should be included in the Active irectory UDF?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

  • 1 month later...
Posted

I'm trying to add in a function that moves a user account to a different OU. I'm not sure what I'm doing wrong. I don't get any errors. It just doesn't do anything. There is more code than this but this is the relevant section.

Func Disableuser()
$newou =  "ou=Disabled Users,dc=domain,dc=com"
$FQDNUser = _ADSamAccountNameToFQDN($UsernameValue)

_ADMoveObject($FQDNUSER, $newou)
EndFunc

Func _ADMoveObject($oldfqdn, $newou)
    $objNewOU = _ADObjGet("LDAP://" & $strHostServer & "/" & $newou)
    $objNewOU.MoveHere("LDAP://" & $strHostServer & "/" & $oldfqdn, "vbNullString")
EndFunc

If I do a msgbox on $FQDUSER I get CN=Me\, Term,OU=Something,dc=domain,dc=com

Posted

Please have a look at my AD UDF. It's the successor of ADFunctions.au3 and should return an error message if there is a problem. You have to use _AD_Open() to open the connection to AD and _AD_Close() to close the connection.

Please see my signature for download and for a link to the General Help and Support Thread.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted (edited)

Thanks for the response, I will take a look at the UDF that you are creating. I'm trying to modify ADFunctions.au3 to add the _ADMoveObject that I am trying to create. That is why there is no ADOpen or close commands.

Edit: Water - I just downloaded the UDF that you created you have mod a ton of progress on it since the last time I looked at it. I will include your AD.Au3 and try the _AD_MoveObject that you have created. Keep up the good work!

Edited by MattZ
  • 2 weeks later...
Posted

Is there a method to create an organizational unit?

_AD_CreateOU?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

Thanks. I just realized that I was using the older adfunctions.au3, so I just updated to your script. Excellent work and thanks for the help.

  • 4 years later...
Posted

Hi,

I'm struggling with moving computers from a temporary OU to the final OU.
What i want is, move the the computers to the new OU in the same SubOU.
 
For example:
"CN=0500017-02,OU=IMUX,OU=W7x32,OU=Computers,OU=Temp,DC=sd0500017,DC=carpark"
 
Must moved to
"CN=0500017-02,OU=IMUX,OU=W7x32,OU=Computers,OU=0500017,DC=sd0500017,DC=carpark"
 
I don't know every computername, so the program need to figure out by it self wich computer moves to where.
(Scanning the OU Computers and Sub OU's)
 
I can't delete the new OU Computers and Replace it with the temporary OU, because there are different GPO's active.
 
I have tried to do this with bash command's but then i have to know every pc name and each location to move the pc to the new location.
 
Can someone help me in the right direction?

 

AD.png

My apologies for my bad english.

Thanks in advance

Posted

Use _AD_GetObjectsInOU to retrieve a list of computers and pass "OU=Computers,OU=Temp,DC=sd0500017,DC=carpark" as the OU where to start.

Then use _AD_ObjectMove to move the computer to the target OU.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

Use _AD_GetObjectsInOU to retrieve a list of computers and pass "OU=Computers,OU=Temp,DC=sd0500017,DC=carpark" as the OU where to start.

Then use _AD_ObjectMove to move the computer to the target OU.

 

I have tried to find more information, but i can't find any example.

Now i have create a .bat file it's nasty but it works.

The only thing now is, if there in the future are changes in the structure my batch script is not working anymore.

I would like a script, that is future proof but i can't find good documentation/examples of de ad.au3 scripts.

I also new with auto

@echo off
 
:: Linux ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 
:Computers-Linux
dsquery computer -limit 1 OU=Linux,OU=Computers,OU=Temp,DC=SD0500017,DC=Carpark | dsmove -newparent OU=Linux,OU=Computers,OU=0500017,DC=sd0500017,DC=carpark
if errorlevel 0 goto Computers-Linux
 
:: W2k12R2 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 
:Computers-W2k12R2-DAZ
dsquery computer -limit 1 OU=DAZ,OU=W2k12R2,OU=Computers,OU=Temp,DC=SD0500017,DC=Carpark | dsmove -newparent OU=DAZ,OU=W2k12R2,OU=Computers,OU=0500017,DC=sd0500017,DC=carpark
if errorlevel 0 goto Computers-W2k12R2-DAZ
 
:Computers-W2k12R2-IMUX
dsquery computer -limit 1 OU=IMUX,OU=W2k12R2,OU=Computers,OU=Temp,DC=SD0500017,DC=Carpark | dsmove -newparent OU=IMUX,OU=W2k12R2,OU=Computers,OU=0500017,DC=sd0500017,DC=carpark
if errorlevel 0 goto Computers-W2k12R2-IMUX
 
:Computers-W2k12R2-KA
dsquery computer -limit 1 OU=KA,OU=W2k12R2,OU=Computers,OU=Temp,DC=SD0500017,DC=Carpark | dsmove -newparent OU=KA,OU=W2k12R2,OU=Computers,OU=0500017,DC=sd0500017,DC=carpark
if errorlevel 0 goto Computers-W2k12R2-KA
 
:Computers-W2k12R2-KC
dsquery computer -limit 1 OU=KC,OU=W2k12R2,OU=Computers,OU=Temp,DC=SD0500017,DC=Carpark | dsmove -newparent OU=KC,OU=W2k12R2,OU=Computers,OU=0500017,DC=sd0500017,DC=carpark
if errorlevel 0 goto Computers-W2k12R2-KC
 
:Computers-W2k12R2-SQL
dsquery computer -limit 1 OU=SQL,OU=W2k12R2,OU=Computers,OU=Temp,DC=SD0500017,DC=Carpark | dsmove -newparent OU=SQL,OU=W2k12R2,OU=Computers,OU=0500017,DC=sd0500017,DC=carpark
if errorlevel 0 goto Computers-W2k12R2-SQL
 
:Computers-W2k12R2-WS
dsquery computer -limit 1 OU=WS,OU=W2k12R2,OU=Computers,OU=Temp,DC=SD0500017,DC=Carpark | dsmove -newparent OU=WS,OU=W2k12R2,OU=Computers,OU=0500017,DC=sd0500017,DC=carpark
if errorlevel 0 goto Computers-W2k12R2-WS
 
:: W2k8R2 :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 
:Computers-W2k8R2-DAZ
dsquery computer -limit 1 OU=DAZ,OU=W2k8R2,OU=Computers,OU=Temp,DC=SD0500017,DC=Carpark | dsmove -newparent OU=DAZ,OU=W2k8R2,OU=Computers,OU=0500017,DC=sd0500017,DC=carpark
if errorlevel 0 goto Computers-W2k8R2-DAZ
 
:Computers-W2k8R2-IMUX
dsquery computer -limit 1 OU=IMUX,OU=W2k8R2,OU=Computers,OU=Temp,DC=SD0500017,DC=Carpark | dsmove -newparent OU=IMUX,OU=W2k8R2,OU=Computers,OU=0500017,DC=sd0500017,DC=carpark
if errorlevel 0 goto Computers-W2k8R2-IMUX
 
:Computers-W2k8R2-KA
dsquery computer -limit 1 OU=KA,OU=W2k8R2,OU=Computers,OU=Temp,DC=SD0500017,DC=Carpark | dsmove -newparent OU=KA,OU=W2k8R2,OU=Computers,OU=0500017,DC=sd0500017,DC=carpark
if errorlevel 0 goto Computers-W2k8R2-KA
 
:Computers-W2k8R2-KC
dsquery computer -limit 1 OU=KC,OU=W2k8R2,OU=Computers,OU=Temp,DC=SD0500017,DC=Carpark | dsmove -newparent OU=KC,OU=W2k8R2,OU=Computers,OU=0500017,DC=sd0500017,DC=carpark
if errorlevel 0 goto Computers-W2k8R2-KC
 
:Computers-W2k8R2-SQL
dsquery computer -limit 1 OU=SQL,OU=W2k8R2,OU=Computers,OU=Temp,DC=SD0500017,DC=Carpark | dsmove -newparent OU=SQL,OU=W2k8R2,OU=Computers,OU=0500017,DC=sd0500017,DC=carpark
if errorlevel 0 goto Computers-W2k8R2-SQL
 
:Computers-W2k8R2-WS
dsquery computer -limit 1 OU=WS,OU=W2k8R2,OU=Computers,OU=Temp,DC=SD0500017,DC=Carpark | dsmove -newparent OU=WS,OU=W2k8R2,OU=Computers,OU=0500017,DC=sd0500017,DC=carpark
if errorlevel 0 goto Computers-W2k8R2-WS
 
:: W7ex64 :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 
:Computers-W7ex64-LUPO
dsquery computer -limit 1 OU=LUPO,OU=W7ex64,OU=Computers,OU=Temp,DC=SD0500017,DC=Carpark | dsmove -newparent OU=LUPO,OU=W7ex64,OU=Computers,OU=0500017,DC=sd0500017,DC=carpark
if errorlevel 0 goto Computers-W7ex64-LUPO
 
:Computers-W7ex64-RAMSES
dsquery computer -limit 1 OU=RAMSES,OU=W7ex64,OU=Computers,OU=Temp,DC=SD0500017,DC=Carpark | dsmove -newparent OU=RAMSES,OU=W7ex64,OU=Computers,OU=0500017,DC=sd0500017,DC=carpark
if errorlevel 0 goto Computers-W7ex64-RAMSES
 
:: W7ex32 :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 
:Computers-W7ex32-LUPO
dsquery computer -limit 1 OU=LUPO,OU=W7ex32,OU=Computers,OU=Temp,DC=SD0500017,DC=Carpark | dsmove -newparent OU=LUPO,OU=W7ex32,OU=Computers,OU=0500017,DC=sd0500017,DC=carpark
if errorlevel 0 goto Computers-W7ex32-LUPO
 
:Computers-W7ex32-RAMSES
dsquery computer -limit 1 OU=RAMSES,OU=W7ex32,OU=Computers,OU=Temp,DC=SD0500017,DC=Carpark | dsmove -newparent OU=RAMSES,OU=W7ex32,OU=Computers,OU=0500017,DC=sd0500017,DC=carpark
if errorlevel 0 goto Computers-W7ex32-RAMSES
 
:: W7x32 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 
:Computers-W7x32-IMUX
dsquery computer -limit 1 OU=IMUX,OU=W7x32,OU=Computers,OU=Temp,DC=SD0500017,DC=Carpark | dsmove -newparent OU=IMUX,OU=W7x32,OU=Computers,OU=0500017,DC=sd0500017,DC=carpark
if errorlevel 0 goto Computers-W7x32-IMUX
 
:Computers-W7x32-KA
dsquery computer -limit 1 OU=KA,OU=W7x32,OU=Computers,OU=Temp,DC=SD0500017,DC=Carpark | dsmove -newparent OU=KA,OU=W7x32,OU=Computers,OU=0500017,DC=sd0500017,DC=carpark
if errorlevel 0 goto Computers-W7x32-KA
 
:Computers-W7x32-KC
dsquery computer -limit 1 OU=KC,OU=W7x32,OU=Computers,OU=Temp,DC=SD0500017,DC=Carpark | dsmove -newparent OU=KC,OU=W7x32,OU=Computers,OU=0500017,DC=sd0500017,DC=carpark
if errorlevel 0 goto Computers-W7x32-KC
 
:Computers-W7x32-WS
dsquery computer -limit 1 OU=WS,OU=W7x32,OU=Computers,OU=Temp,DC=SD0500017,DC=Carpark | dsmove -newparent OU=WS,OU=W7x32,OU=Computers,OU=0500017,DC=sd0500017,DC=carpark
if errorlevel 0 goto Computers-W7x32-WS
 
:: W7x64 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 
:Computers-W7x64-IMUX
dsquery computer -limit 1 OU=IMUX,OU=W7x64,OU=Computers,OU=Temp,DC=SD0500017,DC=Carpark | dsmove -newparent OU=IMUX,OU=W7x64,OU=Computers,OU=0500017,DC=sd0500017,DC=carpark
if errorlevel 0 goto Computers-W7x64-IMUX
 
:Computers-W7x64-KA
dsquery computer -limit 1 OU=KA,OU=W7x64,OU=Computers,OU=Temp,DC=SD0500017,DC=Carpark | dsmove -newparent OU=KA,OU=W7x64,OU=Computers,OU=0500017,DC=sd0500017,DC=carpark
if errorlevel 0 goto Computers-W7x64-KA
 
:Computers-W7x64-KC
dsquery computer -limit 1 OU=KC,OU=W7x64,OU=Computers,OU=Temp,DC=SD0500017,DC=Carpark | dsmove -newparent OU=KC,OU=W7x64,OU=Computers,OU=0500017,DC=sd0500017,DC=carpark
if errorlevel 0 goto Computers-W7x64-KC
 
:Computers-W7x64-WS
dsquery computer -limit 1 OU=WS,OU=W7x64,OU=Computers,OU=Temp,DC=SD0500017,DC=Carpark | dsmove -newparent OU=WS,OU=W7x64,OU=Computers,OU=0500017,DC=sd0500017,DC=carpark
if errorlevel 0 goto Computers-W7x64-WS
Posted

When you download the AD UDF there is an example script for every function (e.g. _AD_GetObjectsInOU.au3)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

When you download the AD UDF there is an example script for every function (e.g. _AD_GetObjectsInOU.au3)

 

Thanks, i have it working now.

Can you help me te convert this to the AD.AU3 script?

The Command Prompt line is working, the _AD_MoveObject is not working :-(

I have tried different combinations, but I do not get it working.

  Command Prompt: dsmove OU=Computers,OU=carpark,OU=Parking,DC=sd0500017,DC=carpark -newparent OU=TEMP,DC=sd0500016,DC=carpark

i tried this

        Local $targetOU = "OU=TEMP,DC=sd0500017,DC=carpark"
        Local $object = "OU=Computers,OU=carpark,OU=Parking,DC=sd0500017,DC=carpark"

        Global $iValue = _AD_MoveObject($targetOU, $object)

But i get Return code -2147352567 from Active Directory

The moving Organizational Unit has sub Organizational Unit's

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...