0
votes

Let's say I have an AD that looks like the following:

Chicago
-Chicago Users
-Chicago PC's
--Office 
---Front
---Back
Boston
-Boston Users
--No Internet
-Boston PC's

I want to run a search that would return all groups that have the word "internet" in them. Googling around I found "Get-ADGroup" so I open up my Powershell Active Directory module and put in this command string:

get-adgroup -filter {name -like "*Internet*"}

And that returns nothing. That seems odd. I search for the following things here's the results I get:

  • name -like "Back". Result: nothing
  • name -like "Front". Result: the right group gets returned
  • name -like "Office". Result: nothing
  • name -like "Boston". Result: the right groups get returned

What's going on here? Is there better way/command to search for what I'm looking for?

Any help is appreciated.

1
Are you looking for a group or an OU? They are two different things. - Bill_Stewart

1 Answers

0
votes

All thanks to @Bill_Stewart , I was trying to look for an OU and not a group. Future peoples, use

 Get-ADOrganizationalGroup -filter {name -like "*internet*"}