Solved

URGENT Powershell Script

Posted on 2016-09-27
6
78 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 19

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 19

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 19

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
Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 

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 19

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

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
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 …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

861 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