Friday, March 23, 2018

Group Membership Report – PowerShell Script

Another “Group Membership Report” script.  You can see some of the previous versions here -

This script provides the group membership details based on user name.  You can include all user names in an input file (Users.csv) in the following format:

Script uses Get-ADUser cmdlet to validate the user first then get the user membership using the “memberof” properties.  Output/report will be in the GMReport_$Cdate.csv file.  Error message will be captured in Error_$Cdate.csv file.

#Group Membership Report – PowerShell Script
#Santhosh Sivarajan (
Import-Module ActiveDirectory
$userN = ""
$GroupDetails = ""
$Group = ""
$GroupsDN = ""
$uValidation = ""
$Cdate = (Get-Date).tostring("dd-MM-yyyy-hh-mm-ss")

    $Report = New-Item -type file -force "C:\Temp\GMReport_$Cdate.csv"
    Import-CSV "C:\Temp\Users.csv" | % {
    $userN = $_.userName
    $sourceDomain = $_.Domain
    $uValidation = Get-ADUser -filter {sAMAccountName -eq $userN} -Server $sourceDomain
        If($uValidation -eq $Null)
              Write-Host "User $userN Doesn't Exist in $sourceDomain Domain"
              $errorFile = New-Item -type file -force "C:\Temp\Error_$Cdate.csv"
              "User $userN Doesn't Exist in $sourceDomain Domain"| Out-File $errorFile -encoding ASCII -append
                $userN | Out-File $SGBeforeUpdateFile -encoding ASCII -append
                $GroupDetails = get-aduser -Server $sourceDomain -identity $userN -Properties memberof
                $GroupsDN = $GroupDetails.memberof
                $GroupsDN | Out-File $SGBeforeUpdateFile -encoding ASCII -append

You can also download the script from the following locations:
  1. OneDrive
  2. TechNet Gallery 


Quel est notre produit? - La meilleure marque de luxe au monde regarde des kopie horloges de la plus haute qualité! Si vous voulez avoir ces Kopie Horloges IWC de luxe, vous voulez porter ces montres sur votre poignet, mais arrêtez-vous en raison de leur prix élevé. Alors s'il vous plaît arrêtez vos pas, c'est votre endroit le plus correct..

You should check this site and get the fabulous college application writing guide. I assume you need this.

A very good article. Thanks to the author.I was very helped by the essay for dummies .

Thank you for this article. She is very close to my topic. College Paper Help.

Very useful information!
Check up this app, it's useful too:

Thank you for this post. This is very interesting information for me. Just contact if you looking for the best essay service.

Helpful article. I found interesting information for me. TopEssayServices reviews

I ordered a replica watch here. When I received the watch,Best UK Swiss watches it surprised me very much. This watch is perfect and the quality is exactly the same as the real watch. A dazzling masonry. Fake rolex Watches I introduced this website to my friends, and my friends liked it very much.

De beste luxe tijd ter wereld Goedkope luxe tijd! Wil je deze kopie horloges verkoop als je deze luxe kopie hublot dames en heren horloges wilt? Dit is gebeurd maar gestopt bij? Omdat hun dure prijs uw stappen stopt, is dit de meest correcte plaats voor u. Allereerst moeten we dit bevestigen

Many thanks for this post, this is what I need, I will definitely try. I write articles if it's interesting to visit my site

Hermes handbags Luxury Genuine Leather Bags. If you have ever drooled over the gorgeous and exquisite Handbags available in any outlet, you would love to own one. The existing counterfeit Louis Vuitton Bags available in this website include classy and sophisticated Monogram Canvas leather handbags which come in colours like white, black, brown and blue. You can also choose from Rolex Watches of Kelly bags which come with more luxurious colours and designs.

Great blog!!! Could you give me more tips about your blog? What would you say about it? You ideas are more important for me...thanks for sharing it. The solar panels are best option for saving money.

The reviews has helped a lot of singles get into a relationship. And that's just amazing.

Dietary Cafe est le meilleur site de santé et de remise en forme pour reconstruire votre poids corporel ainsi que votre condition physique.

Class College Education training Beauty teaching university academy lesson  teacher master student  spa manager  skin care learn eyelash extensions tattoo spray

Hi there. I need to find how to write my memo paper . Many tasks can be found ready-made. Articles or essays on a server where writers are professionals. Many tasks are easier to accomplish.

I have visited your website.Thanks for sharing this beautiful website with us.Keep blogging. Go with my site insta stalker to know more information about instagram.

TimesTech provides Latest electronics news, Semiconductor News, Technology News, Get connected to global community of tech news, Electronics Projects, Electronics Circuit here at for more inquiery mail us at ,91-122-3550122

Post a Comment

Popular Posts


Twitter Delicious Facebook Digg Stumbleupon Favorites More