Get all disabled users in specific OU's in Active Directory using Quest Powershell

I have begun running a script to pull all users that are disabled within multiple OU's can you let me know where i'm going wrong please?

Get-QADUser -Searchbase "OU=Enterprise Objects, DC=, DC=" - disabled
JT3865Asked:
Who is Participating?
 
Will SzymkowskiSenior Solution ArchitectCommented:
As stated you can do this with native powershell cmdlets. See below command..
import-module activedirectory
Get-ADUser -Filter * -SearchBase "OU=Test,DC=domain,DC=com" -Properties Name, sAMAccountName, Enabled | ? {$_Enabled -eq $false} | select Name, sAMAccountName, Enabled | Export-csv "c:\disabledusers.csv" -NoTypeInformation

Open in new window


Will.
0
 
Jonathan BriteSystem AdminCommented:
why not just use the Search-ADAccount cmdlet from the Active Directory module:

"Search-ADAccount -AccountDisabled"
0
 
Jonathan BriteSystem AdminCommented:
here is a quick guide to help you install the Active Directory module for PowerShell.

http://www.tomsitpro.com/articles/powershell-active-directory-cmdlets,2-801.html
0
 
JT3865Author Commented:
Thanks Will!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.