Delete bulk AD account from text file

Hi,
Can someone help me with a script? I need a script to delete bulk AD contacts from text file. In text file the script has to read line by line. On each line there is a proxyaddress, the script has to find these proxyaddresses in AD and after delete it.
regards,

Jef
 
jefmelkenbeekAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RudramCommented:
* If you could use a csv file instead of a text file and then you might want to check the ADManager Plus tool from ManageEngine for this task:

http://manageengine.adventnet.com/products/ad-manager/index.html

Good Luck (^_^)
0
jefmelkenbeekAuthor Commented:
hello,
this is not what I'm looking for. I have already seen many bulk tools, but i have my own order of attributes in my csv or text file.
0
jefmelkenbeekAuthor Commented:
I was looking for another answer.
Is it possible to refund the points back?
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

RudramCommented:
* Sorry for the delay in getting back:

* Heres a script that could do the task:
Option Explicit
Dim oFSO, sFile, oFile, sText, obj
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set obj = GetObject("LDAP://CN=Users,dc=eu,dc=com")
sFile = "C:\Documents and Settings\Administrator.APDC01\Desktop\inputfile.txt"
If oFSO.FileExists(sFile) Then
Set oFile = oFSO.OpenTextFile(sFile, 1)
 Do While Not oFile.AtEndOfStream
  sText = oFile.ReadLine
   If Trim(sText) <> "" Then
    Msgbox sText
    obj.Delete "user", "cn="&sText
   End If
 Loop
oFile.Close
Else
WScript.Echo "The file was not there."
End If

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RudramCommented:
* Now in the above script;

* In line number 4: Replace the OU and domain structure as per your organization

* In line number 5: Replace the input file name and path for the same with your input file.

* In Line number 12, the attribute that has been taken into consideration is the Cannonical Name (CN) of the user property. Here you can replace it with any of the attributes that you want or is there in the input text file for the users; i.e. it may be the "mail" attribute (for email address) or the DN attribute for the distinguished name etc.

* And finally to see what all attributes for a user object is supported you can use a low level editing tool like ADSIEdit.msc and then using it drill down to the user obect as depicted in the ADUC console (you would find it in the domain partition part of the Adsiedit console) and the right click on that user and say properties and there check the box which says attributes with values and you can find all the attributes there.

Hope this helps (^_^)
0
jefmelkenbeekAuthor Commented:
Hello Rudram,

thanks a lot for your reponse.I will test it tomorrow:) and will let you know the result.
regards
0
jefmelkenbeekAuthor Commented:
Thanks for your code :).
it did the trick
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.