Friday, March 23, 2018

Group Membership Report – PowerShell Script

Another “Group Membership Report” script.  You can see some of the previous versions here - http://portal.sivarajan.com/2010/08/list-group-members-in-active.html.

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.

Script:
#
#Group Membership Report – PowerShell Script
#Santhosh Sivarajan (santhosh@sivarajan.com)
#
Clear
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
             }
         Else
             {
               
                $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
            }
    }

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

40 comments:

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:
https://speedypaper.app/

Thank you for this post. This is very interesting information for me. Just contact www.writingpapersucks.com 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 https://statistics.homeworkfor.me/.


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. https://estimate.solar

The dating.com 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.

https://www.dietarycafe.com/

https://www.dietarycafe.com/keto-body-tone-avis-fr/
http://wealthcode.over-blog.com/


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 https://timestech.in/ for more inquiery mail us at info@timestech.in ,91-122-3550122

Looking for Academic Assignment service? Get Quality Assignment Help Online by Best Assignment Writing Experts at an affordable price. My Assignment Helpis the best assignment service provider offered online by a team of experts tutors of Australia , UK and USA. Our support team is available round the clock to help you.

Get the best Accounting Homework Help from our accounting experts. Our professionals aim to provide best possible Online Homework Help for school level, College level and university level students. Urgenthomework is one of the best online assignment service portal that provides quality Accounting Homework Help and Accounting Assignment Help. Also, do check our marketing homework help. you're at the right place if you need Marketing Homework Help, Marketing Assignment Help and this is where you will find the answers to all your queries related to marketing.

Online information technology assignments help companies are very keen when it comes to Information Technology Writing Services for IT students in order for them to score straight A’s in their information technology research papers.

Online political science essay writing help services are very common nowadays since there are very many students seeking Political Science Writing Services and political science research paper writing services.

that’s a nice article, thank you for a great article. It helped me a lot. Keep it up Must Visit: Dell Printer helpdesk bellen.

That’s a nice article, thank you for a great article. It helped me a lot. Keep it up Must Visit: Dell helpdesk bellen.

Thanks for sharing it is important for me. I also searched for that from here. Visit our site Brother Printer contacteren.

Really Nice Post Admin, Very helpful looking for more posts, Now I have to share some information about How To Fix “Brother Printer Troubleshooting Guide” problem. If you are going through this problem you can simply contact Brother Printer belgie.

I am really enjoying your site.It’s simple, yet effective, thank you for this article.Now I have to share some information about How To Fix “mcafee Antivirus” problem. If you have any problem rearding Mcafee so click on this site:mcafee antivirus nummer belgie

I like your blog.You have done Excellent work. I appreciate.Here I want to inform all of you if you are looking for to resolve your Norton Antivirus problems,so you are in right place.we always available for your support.So whenever you need any help so just click on this link- norton Antivirus ondersteuningsnummer

I’m really impressed with your writing skills and also with the layout on your blog it's Very interesting to read.Now Here i would llike to share some information about HP Printer If you are facing any problem relate to your HP Printer's we wil resolve your queries at sam time.For any help please visit on our website:hp printer contact belgie

Excellent post. I certainly appreciate this website.Keep writing.well here if you want to Overcome the issues of Avast antivirus.Pick the Best Assistance over our site to resolve your queries.Visit us :avast antivirus ondersteuning


hi, your post is very helpful for me. Finally, I found exactly what i want. If need information regarding printers then you can visit our site Xerox Printer ondersteuning for help.

hi, Your post is very helpful for me, If you want to know more about antivirus then you can visit our site Canon Printer contacteren
\ for help.


hi, Your post is very helpful for me,finally i got exactly what I want. If you want to know more about antivirus then you can visit our site Bitdefender belgie help.


hi, Your post is very helpful for me, finally i found exactly what i want , If you want to know more about antivirus then you can visit our site Kaspersky antivirus nummer for help.


McAfee.com/activate link is the most useful link, the link will help you if you're planning to get the McAfee products on your devices. By using the 25 digit activation code you can redeem your retail card through this page. In the event you have already used the McAfee activation code, then you can download the program directly from the page. Or if you don't have the code you'll have to buy it. And in the next section, she'll talk about it. You instructed to log in to your McAfee account after entering your activation code. By typing in the required credentials you can easily login. After all, go into your cart and download the subscription you bought from there.In this you can protect your system and your personal and professional information.

Confronted with the problem of Windstream Email Login? Or can't you get your passwords back? Well, as we use services related to technology, we understand that this can fail to work normally at any time. And Windstream is no exception to that. Therefore, if you face any difficulty using Windstream services, you can read this our blog as the blog is written to give you the full information about it.

That’s a nice article, thank you for a great article. It helped me a lot. Keep it up Must Visit Lexmark Printer nummer belgie

Post a Comment

Popular Posts

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More