Delete Active Directory groups with a .csv

Hi,

Could someone help me, I have to delete a lot of groups in the Active Directory. I have a CSV file with the groups to delete, but I can’t find how to delete these groups with the CSV file as one could do for user creations or deletion.

Thanks for answer :slight_smile:

Heterz,
Welcome to the forum. :wave:t4:

This forum is for scripting questions rather than script requests. We do not write customized and ready to use scripts or solutions on request.

We expect you to make an own attempt at first to get your task done or to solve your problem. If you have done so already please document here what exactly you have done and show your code. Then we probably might be able to help you step further.

Hello,

I manage to use Powershell and connect it to AD,
I can’t find on any forum or site, a command or if it’s possible to delete groups via a CSV.

https://lmgtfy.app/?q=powershell+delete+groups+via+a+CSV

Thanks for your answer.

But again i don’t find something to help.
I see “create user with CSV” but impossible to find a topic with my problem…

If you really cannot find something helpful for you you will have to do it yourself. To get you started you may start reading the following help topics:

Please always read the help for cmdlets you’re about to use completely including the examples to learn how to use them.

And BTW: There are more than enough examples out there.
When I use “powershell delete groups via a CSV” to search for with google the first hit is this:

https://social.technet.microsoft.com/Forums/en-US/4fb6fc8d-f68f-4d8b-9ad2-4c3bf5bcf35b/delete-ad-group?forum=winserverDS

and there are many more.

3 Likes

Looks like it’s a forum?
A forum is made to help each other when you can’t find a solution.
So if I ask for help it means that I can’t find a solution…

I may have a different definition of help than you do. :wink: What did you expect?

If you know the solution you gave it, if you don’t know, you can help as you did before. But to say to manage on your own… that’s not correct.

It’s not a free script or solution shop here. We offer help to be able to help yourself with self written code.

So if you have code you wrote yourself and just got stuck with you should share this code here along with an explanation what’s not working or maybe along with some error messages you might have got and we would be pleased to try to help you further.

You will be using Remove-ADGroup cmdlet. You could import csv using Import-Csv cmdlet.

example to get process with the names from a csv

Import-Csv -FilePath c:\temp\list.csv | Foreach-Object -Process {
    Get-Process -Name $_.Name
}