Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 8583

GetADUser - change column names in output file

$
0
0

I'm close....

My script below outputs the information correctly, however, I need the columns in the output file to be different.  IE - UserID for sAMAccountName, Email for EmailAddress,etc. 

Also, I need the where statement so I can run this just for new users, however, I don't want the whenCreated column to appear in my output.  Is that possible?

Finally, is there a way for the output to not show this:  #TYPE Selected.Microsoft.ActiveDirectory.Management.ADUser  ??

Get-ADUser -Filter {EmailAddress -like "*"} -SearchBase "dc=masked,dc=masked" -Properties whenCreated, Enabled, sAMAccountName, Givenname, Surname, EmailAddress, physicalDeliveryOfficeName, TelephoneNumber, IPPhone, Department, Title | select whenCreated, sAMAccountName as logon, GivenName, Surname, EmailAddress, physicalDeliveryOfficeName, TelephoneNumber, IPPhone, Department, Title | Where-Object { $_.whencreated -gt (get-date).adddays(-60) } |Export-CSV "C:\path\output.csv"

Thank you!  I am loving powershell!!

 


Viewing all articles
Browse latest Browse all 8583

Trending Articles