Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

URGENT Powershell Script

Posted on 2016-09-27
6
Medium Priority
?
91 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 2000 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
Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

 

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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Auditing domain password hashes is a commonly overlooked but critical requirement to ensuring secure passwords practices are followed. Methods exist to extract hashes directly for a live domain however this article describes a process to extract u…
How to deal with a specific error when using the Enable-RemoteMailbox cmdlet to create a mailbox in the cloud-based service, for an existing user in an on-premises Active Directory.
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

670 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