Jump to content

Recommended Posts

Posted

Hi

 

I am basically looking to clear all our distribution groups and re populate them with different students. Assuming the best way to do this would be with a CSV and Powershell script but my Powershell isn't massively great. Anyone able to point me in the right direction? it would be much appreciated. I already have a script and CSV to re populate but removing the old users is proving a challenge

 

Thanks

Craig

Posted

Got this sorted now thanks people, If anyone needs similar here is the script I have used

 

Import-Module Activedirectory$ErrorActionPreference = "SilentlyContinue"Import-Csv c:\remove\groups.csv | ForEach { $groupMembers = Get-ADGroupMember $_.Group #$groupMembers Remove-ADGroupMember $_.Group -Members $groupMembers -Confirm:$false}$ErrorActionPreference = "Continue"

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...