+ Post New Thread
Results 1 to 1 of 1
Scripts Thread, need some help to remove users from AD that are in a csv or text file in Coding and Web Development; I am trying to remove a bunch of users that I have extracted from AD and exported to a csv ...
  1. #1

    Join Date
    Aug 2013
    Posts
    1
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    need some help to remove users from AD that are in a csv or text file

    I am trying to remove a bunch of users that I have extracted from AD and exported to a csv is formated this way:
    SamAccountName
    user1
    user2
    user3
    I am trying to run the following in a ps script:
    Import-Csv .\delete1.csv | foreach-object {
    remove-aduser -identity $_.SamAccountName -confirm:$false }

    i then get the following error:
    Remove-ADUser : Cannot validate argument on parameter 'Identity'. The argument
    is null. Supply a non-null argument and try the command again.
    At C:\remove\deleteuser.ps1:2 char:24
    + remove-aduser -identity <<<< $_.SamAccountName -confirm:$false }
    + CategoryInfo : InvalidData: (:) [Remove-ADUser], ParameterBindi
    ngValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Activ
    eDirectory.Management.Commands.RemoveADUser

    Any ideas on what I am missing?
    Last edited by roblobster; 5th August 2013 at 08:17 PM.



SHARE:
+ Post New Thread

Similar Threads

  1. Script to remove users from one group and add to another
    By JMBates in forum Windows Server 2000/2003
    Replies: 5
    Last Post: 11th April 2012, 11:02 AM
  2. Replies: 5
    Last Post: 11th April 2012, 11:02 AM
  3. Hi. I need some help to replace head banner in joomla with flash movie
    By pinik in forum EduGeek Joomla 1.5 Package
    Replies: 0
    Last Post: 14th June 2010, 02:30 PM
  4. Problems With Domain - Need Some Help To Fix It
    By pritchardavid in forum Windows
    Replies: 13
    Last Post: 24th May 2010, 08:05 PM
  5. Option to Hide user from global address list in MS Exchange
    By Andie in forum Windows Server 2000/2003
    Replies: 9
    Last Post: 14th October 2009, 04:32 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •