scripting - How to display AD group name next to AD user with PowerShell -
I am a new PowerShell user and am trying to figure out how to get a list of users from a group name group Desired output:
Username AD Group Department John SG-MS Office Jen SG-MSOffice Accounting Sam SG-MS Office Accounting Thomas SG-MS Office IT Current Output:
Code:
Get-ADGroupMember- Familiar SG-MS Office | Output:
Department Distinguished Name Manager Name ObjectClass Objectune
Store the name of the group from anywhere and you want to use Select-object to format the output, such as:
department is available in "default" -object, if not, then you would like Get-ADObject Some may include: $ groupname = "SG-MSOffice" Go -Adigroup member-Indentity $ groupname | Get ADObject -Properties Name, Department | @ - {n = "Eddy Group"; E = {$ groupname}}, section "username"; E = {$ _. Name}} -Object-property @ / div>
Comments
Post a Comment