\n Hi, and welcome to the PowerShell forum! \n\n\nDon’t apologize for being a “noob” or “newbie” or “n00b.” There’s just no need – nobody will think you’re stupid, and the forums are all about asking questions. Just ask! \n\n\nUse a descriptive subject. Don’t say “Need help” or “PowerShell Help”, actually summarize what the problem is. It helps the rest of us keep track of which problem is which. \n\n\nDon’t post massive scripts. We’re all volunteers and we don’t have time to read all that, nor will we copy…\n <\/blockquote>\n<\/aside>\n\n <\/p>","upvoteCount":1,"datePublished":"2019-05-06T14:17:04.000Z","url":"https://community.spiceworks.com/t/exports-users/710556/2","author":{"@type":"Person","name":"Neally","url":"https://community.spiceworks.com/u/Neally"}},{"@type":"Answer","text":"
As Neally said, use the code box. It makes your command readable.<\/p>\n
As to your question you can swap SAMAccountName for UserPrincipalName<\/p>","upvoteCount":0,"datePublished":"2019-05-06T14:22:56.000Z","url":"https://community.spiceworks.com/t/exports-users/710556/4","author":{"@type":"Person","name":"justin1250","url":"https://community.spiceworks.com/u/justin1250"}},{"@type":"Answer","text":"
you can<\/p>\n
Get-ADuser -filter * -Properties SAMAccountName, EmployeeID, DisplayName, Description, Enabled, userprincipalname\nLastLogonDate | Select SAMAccountName, EmployeeID, DisplayName, Description, Enabled, LastLogonDate,@{n='Userlogonname';e={$_.userprincipalname.split('@')[0]}}| \nexport-csv C:\\output.csv -NoTypeInformation\n<\/code><\/pre>","upvoteCount":2,"datePublished":"2019-05-06T15:19:45.000Z","url":"https://community.spiceworks.com/t/exports-users/710556/5","author":{"@type":"Person","name":"jitensh","url":"https://community.spiceworks.com/u/jitensh"}}]}}
Neally
(Neally)
May 6, 2019, 2:17pm
2
If you post code, please use the ‘Insert Code’ button. Please and thank you!
Hi, and welcome to the PowerShell forum!
Don’t apologize for being a “noob” or “newbie” or “n00b.” There’s just no need – nobody will think you’re stupid, and the forums are all about asking questions. Just ask!
Use a descriptive subject. Don’t say “Need help” or “PowerShell Help”, actually summarize what the problem is. It helps the rest of us keep track of which problem is which.
Don’t post massive scripts. We’re all volunteers and we don’t have time to read all that, nor will we copy…
1 Spice up