AddExtender("wwsop34i.DLL") AddExtender("WWADS44I.DLL") ;Varibles to set************ AffyADSIPath="LDAP://yourDC/DC=yourdomain,DC=com" Adsi_Target="LDAP://yourDC/OU=users,DC=yourdomain,DC=com" ListOfItems="c:\UsersToMove.txt" OutPutFile="c:\Employee_ID_outPut.txt" ************* adSys = ObjectOpen("ADSystemInfo") userName = adSys.UserName Domain = adSys.DomainDNSName PDCRoleOwner = adSys.PDCRoleOwner ObjectClose(adSys) tot=StrLen (PDCRoleOwner) start=StrScan (PDCRoleOwner, ",", 1,@FWDSCAN) length= tot - start cut=StrFixLeft(PDCRoleOwner, "", length) start2=StrScan (cut, ",", 1,@FWDSCAN) findStr=strSub (cut, 1, start2) tot2=StrLen (findStr) length2= tot2 - 1 fix=StrFix (findStr, "", length2) fixtot= StrLen (fix) length3=fixtot - 3 dir=StrFixLeft(fix, "", length3) date=datetime() boxt="Move_Employee_AD_Location" List_Item=Fileopen(ListOfItems,"read") OutPutFile=Fileopen(OutPutFile,"append") num=0 ListNum=0 while 1 ListRead=fileread(List_Item) if ListRead=="*EOF*" then break ListNum=ListNum+1 endwhile astatusbar(0,boxt,"Number of items to search= %ListNum%",ListNum,num) ListOfItems=Fileopen(ListOfItems,"read") while @true user=Fileread(ListOfItems) if user=="*EOF*" then break gosub UpdateUser num=num+1 remains=listnum-num astatusbar(1,boxt,"Updating -> %user% %@CRLF%Systems remaining= %remains%",ListNum,num) endwhile astatusbar(2,"","","",0) exit :UpdateUser AffyUserName = "sAMAccountName=%User%" sUserPath = dsFindPath(AffyADSIPath, AffyUserName) if sUserPath == "" filewrite(OutPutFile,"%user% does not exist in Active Directory") else if dsIsObject(sUserPath) dsMoveObj(sUserPath, Adsi_Target,"") filewrite(OutPutFile,"%sUserPath% moved to the ToInvestigate OU.") else Message(OutPutFile,"%sUserPath% is NOT in the Active Directory.") EndIf EndIf return