|
Per Global variable. It is possible that someone try this code on his/her system ?
I made a little changes to the code ..
;========================================================= ; ; function Move_PC ; ; move $computer from default Container to $target_OU ; ; Input: $computer,$target_OU ("cn=xxxxx,cn=yyyyy,..) ; ;=========================================================
Function Move_PC ($computer,$target_OU)
Dim $LDAPRootDSE Dim $LDAPSourcePC Dim $LDAPTargetOU ,$LDAPTargetPC Dim $objSourcePC, $objTargetOU Dim $objMovePC Dim $Return_code
$LDAPRootDSE = GetObject("LDAP://rootDSE").Get("defaultNamingContext")
$Return_code = @ERROR ; If $Return_code <> 0 ; Gosub COM_Error($Return_code) ; EndIf
$LDAPSourcePC = "LDAP://cn=" + $computer + ",cn=Computers," + $LDAPRootDSE $LDAPTargetOU = "LDAP://" + $target_OU + "," + $LDAPRootDSE $LDAPTargetPC = "cn=" + $computer
$objSourcePC = GetObject($LDAPSourcePC)
$Return_code = @ERROR ; If $Return_code <> 0 ; Gosub COM_Error($Return_code) ; EndIf
$objMovePC = $objTargetOU.MoveHere($objSourcePC.ADsPath,$LDAPTargetPC)
$Return_code = @ERROR ; If $Return_code <> 0 ; Gosub COM_Error($Return_code) ; EndIf
$LDAPRootDSE = 0 $objSourcePC = 0 $objTargetOU = 0
EndFunction
|