Solved

URGENT Powershell Script

Posted on 2016-09-27
6
86 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 

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

Comparison of Amazon Drive, Google Drive, OneDrive

What is Best for Backup: Amazon Drive, Google Drive or MS OneDrive? In this free whitepaper we look at their performance, pricing, and platform availability to help you decide which cloud drive is right for your situation. Download and read the results of our testing for free!

Question has a verified solution.

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

This article shows the method of using the Resultant Set of Policy Tool to locate Group Policy that applies a particular setting.
A company’s centralized system that manages user data, security, and distributed resources is often a focus of criminal attention. Active Directory (AD) is no exception. In truth, it’s even more likely to be targeted due to the number of companies …
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

724 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