Making a Security Group using Distribution group members in Powershell

Making a Security Group using Distribution group members in Powershell

First lets get the list of users samaccountnames from Distribution list

$List=Get-ADGroupmember DistributionlistName

Now create a empty Security group from Active Directory Users and Computers

Now lets add each of above user into a security group which is created from ADUC(Active Directory Users and Computers).

ForEach ($User in $List){Add-ADGroupMember -Identity SecurityGroupName -Member $User.samaccountname}

We can also use add members to distribution group powershell by this method of Add-ADGroupmember

We can also use powershell to add members to distribution group powershell or a Security group.

We can also use powershell to create distribution group from csv or a Security group using simple method

Create a empty distribution group or Security group in ADUC(Active Directory Users and Computers).

#List with Sam account names
$List = Import-CSV .\Users.csv

#Loop through user in the CSV
ForEach ($User in $List){Add-ADGroupMember -Identity GroupName -Member $User.username}

Below powershell command to list out all the users in the Group

Get-ADGroupMember Groupname | Select name

Vamshi B

Recent Posts

How to install Firefox browser using Powershell

How to install of FireFox browser using PowerShell Sometimes you would like to install Firefox…

2 years ago

How to install chrome with Powershell?

Quick way to install chrome on windows with Powershell? Launch the Powershell and run below…

2 years ago

How to Fix PowerShell Script Not Digitally Signed Error?

How to Fix PowerShell Script Not Digitally Signed Error? When a script with a .ps1…

2 years ago

Powershell Cheat Sheet for beginners

Powershell Cheat Sheet for beginners PowerShell has become something of an ace in the hole…

2 years ago

Can you use Linux commands in Powershell?

Today we discuss one of a few questions a lot of sysadmins and IT Admins…

2 years ago

Backing Up an SQL Database with PowerShell

Backing Up an SQL Database with PowerShell Before making any changes in the production environment,…

2 years ago

This website uses cookies.