powershell to pull All AD accounts

Posted on 2014-08-30
Last Modified: 2014-09-01
Can you please let me know how to get All Enabled user accounts with their names, surnames, usernames? you can change below code

Search-ADAccount -AccountInactive -TimeSpan 30.00:00:00 -UsersOnly | where {$_.Enabled -eq $true -and $_.Name -notlike "SystemMailbox*" -and $_.Name -notlike "SVC_*"} | Get-ADuser -pr LastLogonTimestamp | Select Name,GivenName,Surname,samaccountname,@{N='LastLogon'; E={[DateTime]::FromFileTime($_.LastLogonTimestamp)}},Enabled | Export-csv C:\temp\test1.csv -nti

report needs to exclude anything with "svc_" system mailbox"
Question by:kuzum
    1 Comment
    LVL 40

    Accepted Solution

    Get-ADuser -f * | where {$_.Enabled -eq $true -and $_.Name -notlike "SystemMailbox*" -and $_.Name -notlike "SVC_*"} | Select Name,GivenName,Surname,samaccountname,Enabled | Export-csv C:\temp\test1.csv -nti

    Open in new window


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    This article shows how a content item can be identified directly or through translation of a navigation type. It then shows how this information can be used to create a menu for further navigation.
    Create and license users in Office 365 in bulk based on a CSV file. A step-by-step guide with PowerShell script examples.
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

    737 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now