Quantcast
Channel: PowerShell
Viewing all articles
Browse latest Browse all 15370

Specifying an OU using SearchBase

$
0
0

Hi, I am trying to write a simple script to loop through users in a specified OU but am getting an error "Directory object not found".

The specified OU definitely has user accounts inside. Here is my code:

Powershell
$users=Get-ADUser-Filter*-SearchBase"OU=TestOU,DC=clf,DC=internal"

I've tried substituting OU=TestOU for CN=TestOU as recommended amongst the many articles I read online to no avail. If I use Get-ADUser on it's own it will return all the users on the domain. My structure within ADUC is as so:

1-Users
2-Students
3-Controlled Assessment

4-TestOU

Any recommendations greatly appreciated, trying to learn :)


Viewing all articles
Browse latest Browse all 15370

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>