Removing AD Computer Objects

Welcome Forums General PowerShell Q&A Removing AD Computer Objects

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
4 years, 3 months ago.

  • Author
    Posts
  • #17330

    Participant
    Points: 0
    Rank: Member

    Hi,

    I have a list of AD Computer Objects that i need to remove. Does anyone have a script to hand that will read through the list (txt) and remove them ?

  • #17331

    Participant
    Points: 160
    Helping Hand
    Rank: Participant

    To keep it simple, it's a one-liner:

    Get-Content C:\MyComputers.txt | foreach{Get-ADComputer -Identity $_ | Remove-ADComputer -WhatIf}

    After you validate the command is identify the correct object to remove, you can remove the -WhatIf to actually perform a move.

  • #17332

    Participant
    Points: 0
    Rank: Member

    Fantastic – Cheers Rob!

The topic ‘Removing AD Computer Objects’ is closed to new replies.