Get Multiple Users SamAccount from a Security Group of Active Directory using Powershell
Hi..Today will discuss about small powershell command with that we will get multiple user's Samaccount (Accountname/Logonname/Useraccount), other attributes. Open your powershell ( windows 2008 server, R2 etc..) Start -> RUN -> type powershell then type below command to Load the module. Import-Module ActiveDirectory or you can directly open the from Start -> Administrative Tools -> then click on the Active Directory Module for Windows PowerShell this is will load the Module and Powershell command propmt will open. Now type below command to get the SamAccount of a Sercurity group Get-ADGroupmember -Identity "Distinguished Name of the Group" | export-csv -path c:\users\XXXX\desktop\filename.csv -notypeinfo Example:: domain name is bbntechinfo.com Group name is : DBA Users Ou name is : Health So Distinuguished name of the group is : "CN=DBA Users,OU=Health,DC=bbntechinfo,DC=com" if you want to see the Distinuguished name of group ...