Powershell Script to Retrieve AD User, Group, Group Members Info

Ronald Seow 206 Reputation points
2020-08-14T03:15:13.083+00:00

Good morning and Hi to all!

I am a newbie to Powershell scripting and have a task on hand but unable to get the results I needed and hope I can get some help here.

There are many Groups in AD, but I need to focus only on 2 distinct Groups namely TeamA and TeamB. I would like to query AD for the group the current logon user belongs to, showing only the SAMAccountNane of the Group.

Further to this, I would be required to check whether the current logon user SAMAccountName is in the same Group as that of another SAMAccountName.

Really appreciate any guidance as to how I can achieve the above.

Thank you and best regards.
Ronald

Active Directory
Active Directory
A set of directory-based technologies included in Windows Server.
6,671 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,561 questions
0 comments No comments
{count} votes

Accepted answer
  1. Andreas Baumgarten 111.5K Reputation points MVP
    2020-08-14T08:23:56.067+00:00

    Maybe this script is a good starting point:

    17590-adusersandgroups.txt

    Regards

    Andreas Baumgarten

    (Please don't forget to Accept as answer if the reply is helpful)

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.