Suppressing Confirm Parameter When Deleting Multiple Computer Accounts in Active Directory RRS feed

  • Question

  • I wrote the below script and it does work. However I have to confirm for each deletion.

    After -Recursive I do not have an option to use -Confirm = $false.

    How do I get rid of the -Confirm Pop up for each deletion.

    $Computers = Import-Csv -path C:\Machines.csv

    Foreach ($Computer in $ Computers) { Get-ADComputer -Identity $Computer.ComputerName | Remove-ADObject -Recursive }

    Regards Deven Suji

    • Edited by Devensuji Thursday, July 13, 2017 11:56 AM Typo
    Thursday, July 13, 2017 11:49 AM


  • Suji,

    On my test environment with 2008R2 + PSv3 works just fine:

    Remove-ADObject 'someobject' -Recursive -Confirm:$false

    Pay attention to my PS line above, you need to set "-Confirm:$false" not as


    hope this put you in the right track,



    Thursday, July 13, 2017 12:44 PM