• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1555
  • Last Modified:

How to use Get-QADObject script to return just SamAccountName and AccountExpires

I'm trying to run a powershell script to return just the SamAccountname and the AccountExpires
for -type user.  I run Get-QADObject -SizeLimit(0) -Type user | Export-csv c:\AD_Users.csv and this returns all the AD attributes.  Would I use the IncludeProperties parameter?
2 Solutions
Joe KlimisCommented:
try the following

Get-QADObject -SizeLimit(0) -Type user | select SamAccountName,AccountExpires |Export-csv c:\AD_Users.csv
Chris DentPowerShell DeveloperCommented:

If you're doing it for users all you need is:

Get-QADUser | Select SamAccountName, AccountExpires | Export-csv c:\AD_Users.csv

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.

Join & Write a Comment

Featured Post

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell┬« is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now