Avatar of Jay Thomas
Jay ThomasFlag for United Kingdom of Great Britain and Northern Ireland

asked on 

PS script to enumerate 25 OUs, look for 2 groups and pull membersl

Hi all.
I look at this question and know that to you PS experts it's an eay one - but not all of us pick up scripting that easy (I did offer to pay for training via a EE-gig lst year, but nothing really came of it ;0)

So, i have 25 OUs under the UK parent OU. Flat straucture here - all 25 OUs under UK. These OUs have many groups assigned to them. You know the thing, it's got a bit out of contol. What i need is a script that can loop through all 25 OUs looking for 2 groups called 'UKSouth' and UKNorth' and from here do 2 actions. Output the group names to a spreadsheet for each OU where they are found and also record the list of users in those groups. Is this something easily achieveble?
Appreciate your looking thank you.
Powershell

Avatar of undefined
Last Comment
Jay Thomas
Avatar of Jose Gabriel Ortega Castro
Jose Gabriel Ortega Castro
Flag of Venezuela, Bolivarian Republic of image

Hi what version is your Windows server (Active Directory)?
Avatar of Jay Thomas
Jay Thomas
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

Hi, sorry, should have mentioned, it's 2008 R2
I'd need also the Domain name and the Distinguished name of your "UK" OU.
Avatar of Jay Thomas
Jay Thomas
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

Hi, so it's external facing domain. Could we call it contoso.com and a DN of "ou=uk,dc=contoso,dc=com
I could change there after? Hope this doesn't show a miss trust ???
Nope, it doesn't really matter I'd do the logic to find that out in the script. Give me a bit. We gotta go step by step.
Avatar of Jay Thomas
Jay Thomas
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

Thank you very much
ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
SOLUTION
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of Jay Thomas
Jay Thomas
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

Thank you very much chaps. I'll try these tomorrowand eport back. Thank you again.
Avatar of Jay Thomas
Jay Thomas
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

Thank you for your efforts. Sorry for the late feedback, just not had time to test both scripts. Thank you.
Powershell
Powershell

Windows PowerShell is a task automation and configuration management framework from Microsoft, consisting of a command-line shell and associated scripting language built on the .NET Framework. PowerShell provides full access to the Component Object Model (COM) and Windows Management Instrumentation (WMI), enabling administrators to perform administrative tasks on both local and remote Windows systems as well as WS-Management and Common Information Model (CIM) enabling management of remote Linux systems and network devices.

27K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo