Memo_defaultVBS:
' This code moves Object from one container to another.
' ------ SCRIPT CONFIGURATION ------
strSource = "#Source" ' e.g. cn=rallen,cn=users,
dc=rallencorp,
dc=
com
strTarget = "#Target" ' e.g. ou=Sales,
dc=rallencorp,
dc=
com
' ------ END CONFIGURATION ---------
Set objSource = GetObject(strSource)
Set objTarget = GetObject(strTarget)
objTarget.MoveHere objSource.ADsPath, objSource.Name
procedure MoveObjectADS:
var
Source, Target: string;
Value, filename :string;
i : integer;
begin
Memo_VBS.Clear;
Memo_VBS.Text := Memo_defaultVBS.Text;
Source:=SearchComputer(lvComputerRoom.Selected.Caption+'$');
Target:= StringReplace(Source, PCWORKEROUPATH, PCMASTEROUPATH,[rfReplaceAll]);
Target:= StringReplace(Target, 'CN='+lvComputerRoom.Selected.Caption+',', '',[rfReplaceAll]);
filename := 'objMove.vbs';
if FileExists(filename) then DeleteFile(filename);
for i := 0 to Memo_VBS.Lines.Count - 1 do Memo_VBS.lines[i]:=StringReplace(Memo_VBS.lines[i],'#Source',Source,[rfReplaceAll]);
for i := 0 to Memo_VBS.Lines.Count - 1 do Memo_VBS.lines[i]:=StringReplace(Memo_VBS.lines[i],'#Target',Target,[rfReplaceAll]);
Memo_VBS.Lines.SaveToFile(ExtractFilePath(ParamStr(0)) + filename);
ShellExecAndWait('WScript.exe',PChar(filename),'');
Application.ProcessMessages;
end;