Find accounts outside the IT department
Documentation: Microsoft Learn
Return every account that is not in the IT department.
An example to inspect
Preview the example. Sign in for the full lesson and activities.
Get-ADUser -Filter * | Where-Object Department -ne 'IT' | Select-Object Name, DepartmentThe task
A new security baseline applies to everyone except the IT team. List the accounts the baseline covers.
Target
Return every account that is not in the IT department.
What the result tells you
-ne keeps everything that does not match, which is the right shape when the exception is shorter than the rule.
Verify the result
Run the source by itself and inspect the sample objects. Add each filter separately, then check the final properties and order.
The browser uses a small fictional dataset. Real results depend on the host, module, account and target environment.
When is -ne the right operator?
Choose an answer, then check your reasoning.
Worked solution
Worked solution
Reveal one approach
Related reference
Read the command and platform requirementsTry it in the lab
Write your pipeline below and run it against the fictional sample data, then check your result against the expected answer.
Follow the objects
Run the command to inspect each stage.