Solved

need assistance with a Quest AD CMDlet script - need to add additional attributes in the search

Posted on 2013-07-01
8
485 Views
Last Modified: 2013-07-01
when i run the following command, it does not pickup attributes like: "distinguishedName / employeeID/ pwdLastSet .. etc"

how can i modify the script to pickup and report on these values:

Get-Qaduser -SizeLimit 0 -SearchRoot $OU | 
select 

mail,sAMAccountName,displayName,telephoneNumber,mobile,l,givenName,sn,distinguishedName,employeeID,description,manager,pwdLastSet,whenCreated,accountExpires,badPasswordCount,badPasswordTime

Open in new window

0
Comment
Question by:siber1
  • 4
  • 4
8 Comments
 
LVL 40

Accepted Solution

by:
Subsun earned 500 total points
ID: 39290856
Try..
Get-Qaduser -SizeLimit 0 -SearchRoot $OU -all | 
select mail,sAMAccountName,displayName,telephoneNumber,mobile,l,givenName,sn,distinguishedName,employeeID,description,manager,pwdLastSet,whenCreated,accountExpires,badPasswordCount,badPasswordTime

Open in new window

0
 

Author Closing Comment

by:siber1
ID: 39290863
thanks Subsun, i forgot about the -all switch.

appreciate it.
0
 
LVL 40

Expert Comment

by:Subsun
ID: 39290879
FYI, Parameter -all may cause lot of memory utilization if you have large number of users in the SearchRoot. In that case you can use -IncludedProperties and add only required properties..
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 

Author Comment

by:siber1
ID: 39290890
thx Subsun. where specifically would i add the -IncludedProperties value in that script?
0
 

Author Comment

by:siber1
ID: 39290925
Subsun, would this be correct for using the -IncludedProperties value:

# Instruction to add Quest Powershell Snap-in
Add-PSSnapin quest.ActiveRoles.admanagement
$OU="mydomain.com/Corp Accounts/Users"
$Logfile="C:\temp\result.csv"
Get-Qaduser -SizeLimit 0 -SearchRoot $OU -IncludedProperties mail,sAMAccountName,displayName,telephoneNumber,mobile,l,givenName,sn,distinguishedName,employeeID,description,manager,pwdLastSet,whenCreated,accountExpires,badPasswordCount,badPasswordTime | 
select mail,sAMAccountName,displayName,telephoneNumber,mobile,l,givenName,sn,distinguishedName,employeeID,description,manager,pwdLastSet,whenCreated,accountExpires,badPasswordCount,badPasswordTime | ? {$_.l -eq "UK"}|
Export-Csv $Logfile -NoTypeInformation

Open in new window

0
 
LVL 40

Expert Comment

by:Subsun
ID: 39290938
Get-QADUser -DontUseDefaultIncludedProperties -IncludedProperties mail,sAMAccountName,displayName,telephoneNumber,mobile,l,givenName,sn,distinguishedName,employeeID,description,manager,pwdLastSet,whenCreated,accountExpires,badPasswordCount,badPasswordTime -SizeLimit 0 -SearchRoot $OU | 
select mail,sAMAccountName,displayName,telephoneNumber,mobile,l,givenName,sn,distinguishedName,employeeID,description,manager,pwdLastSet,whenCreated,accountExpires,badPasswordCount,badPasswordTime

Open in new window

Ref :
http://ss64.com/ps/get-qaduser.html

http://dmitrysotnikov.wordpress.com/2007/07/24/optimize-powershell-performance-and-memory-consumption/
0
 

Author Comment

by:siber1
ID: 39291046
thx Subsun, that worked perfectly.
0
 
LVL 40

Expert Comment

by:Subsun
ID: 39291059
You're welcome!.. :-)
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

This article explains the steps required to use the default Photos screensaver to display branding/corporate images
Active Directory security has been a hot topic of late, and for good reason. With 90% of the world’s organization using this system to manage access to all parts of their IT infrastructure, knowing how to protect against threats and keep vulnerabil…
how to add IIS SMTP to handle application/Scanner relays into office 365.
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…

733 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