Solved

How run this script just for one OU?

Posted on 2012-03-09
1
455 Views
Last Modified: 2012-03-13
I use this script for my AD user reviews and would like to run it on users in just one OU and the OU's listed under that.  So how do I do this and list that OU in the output?  Here is the script.

using Activeroles AD management shell (x64)

Get-QADUser -IncludedProperties userAccountControl, WhoCreatedBy -SizeLimit 0 | Select-Object SamAccountName, LastName, FirstName, HomeDrive, HomeDirectory, PasswordLastChanged, PasswordNeverExpires, PasswordLastSet, PasswordExpires, AccountExpires, AccountIsLockedOut, LastLogon, WhenCreated, WhoCreatedBy, @{n='UserAccountStatus';e={ $_.UserAccountControl }}, @{n='Groups';e={ $_ | Get-QADMemberOf | Select-Object -ExpandProperty Name }} | Export-Csv "20120125a.csv" -NoTypeInformation
0
Comment
Question by:stowyo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 27

Accepted Solution

by:
KenMcF earned 500 total points
ID: 37702679
Change your Get-QADUser to add this

-searchroot "OU=USER_ACCOUNTS,DC=DOAMIN,DC=LOCAL"
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will help you understand what HashTables are and how to use them in PowerShell.
Windows 10 came with  a lot of built in applications, Some organisations leave them there, some will control them using GPO's. This Article is useful for those who do not want to have any applications in their image (example:me).
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question