Solved

URGENT Powershell Script

Posted on 2016-09-27
6
66 Views
Last Modified: 2016-09-28
Hello,

I have 3 powerShell script need.

1) A PS script to extract in a csv or excell or html file all Groups and nested Groups within an Active directory domain with :
   - The names of the Groups
   - The DN of the Groups
   - The Description of the Groups

2) A PS script to extract members of  Groups and nested Groups in an Active directory domain.

3) A PS script to extract all users in a domain excluding service account.

Help please I need it for tomorow ...
Thank You !
0
Comment
Question by:AMATERASOU
  • 4
  • 2
6 Comments
 
LVL 18

Accepted Solution

by:
Raheman M. Abdul earned 500 total points
ID: 41818520
#1:
get-adgroup -filter * -properties * | select Name,DistinguishedName, description| Export-CSV -Path c:\temp\ADGroups.csv -NoTypeInformation
0
 
LVL 18

Expert Comment

by:Raheman M. Abdul
ID: 41818523
#2
get-adgroup -filter * -properties * | get-adgroupmember  -recursive | export-csv c:\temp\ADGroupMembers.csv -nti
0
 
LVL 18

Expert Comment

by:Raheman M. Abdul
ID: 41818554
are the service accounts mixed with AD user accounts in the same OU or do you have them in a separate OU?
Is there an extention attribute indicating that they are service accounts or something different in naming convention?
we can exclude them after piping like this:
get-aduser -filter * -properties * | ? { ....... }
0
 

Author Comment

by:AMATERASOU
ID: 41818568
Hello the service account are in a dedicated OU. but in some domain they are mixed.
For the :

#1:
get-adgroup -filter * -properties * | select Name,DistinguishedName, description| Export-CSV -Path c:\temp\ADGroups.csv -NoTypeInformation

Would it also display nested groups ?
What about if their are groups from other forest B nested in Forest A
Would it work ?

Thank you Abdul !
0
 
LVL 18

Expert Comment

by:Raheman M. Abdul
ID: 41818705
get-aduser -filter * properties * -server anotherforestDCNamehere
for different forest.
0
 

Author Closing Comment

by:AMATERASOU
ID: 41819645
GREAT!!
Many Thanks!!!
0

Join & Write a Comment

I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
Set OWA language and time zone in Exchange for individuals, all users or per database.
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now