• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 99
  • Last Modified:

URGENT Powershell Script

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
AMATERASOU
Asked:
AMATERASOU
  • 4
  • 2
1 Solution
 
Raheman M. AbdulSenior Infrastructure Support Analyst & Systems DeveloperCommented:
#1:
get-adgroup -filter * -properties * | select Name,DistinguishedName, description| Export-CSV -Path c:\temp\ADGroups.csv -NoTypeInformation
0
 
Raheman M. AbdulSenior Infrastructure Support Analyst & Systems DeveloperCommented:
#2
get-adgroup -filter * -properties * | get-adgroupmember  -recursive | export-csv c:\temp\ADGroupMembers.csv -nti
0
 
Raheman M. AbdulSenior Infrastructure Support Analyst & Systems DeveloperCommented:
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
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

 
AMATERASOUAuthor Commented:
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
 
Raheman M. AbdulSenior Infrastructure Support Analyst & Systems DeveloperCommented:
get-aduser -filter * properties * -server anotherforestDCNamehere
for different forest.
0
 
AMATERASOUAuthor Commented:
GREAT!!
Many Thanks!!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now