Ive built my script on the basis of your suggestion Glenn.

My sourcefile contains a field like the AD-field samaccounname. Is there a way I can do a check in ad against the value that now is in the variable $aOut[3]?

I get an error when I try something like

 Code:
  ;Get data from AD
;Open ADSystemInfo object
$objSysInfo = CreateObject("ADSystemInfo")
;Get the username from AD.
$strUser 	= $objSysInfo.$aOut[3]
;Get the users deatils using LDAP.
$objUser	= GetObject("LDAP://" + $strUser)
;Get the users SAMAccountName
$strSam 		= $objUser.sAMAccountName



I only want the lines with samaccountnames that isn't already in AD to be written to my new files.
_________________________
I was placed on earth to do a job. Right now I have so much to do, I will never die..