List of Users in Office 365

Posted on 2012-09-07
Last Modified: 2012-09-23
In office 365, How we can get a full list of users and their full information, specially their emails since most of them have more than one email?
Question by:ACS2012
    LVL 23

    Expert Comment

    by:Stelian Stan
    Run the following command:

    Get-MsolUser | select DisplayName,UserPrincipalName |export-csv –path C:\users.csv

    Author Comment

    then how I can connect using powershell??
    LVL 38

    Assisted Solution

    by:Vasil Michev (MVP)
    Easiest way is to download and run the Helper scripts: Extract it and run the GetMsolUserReport.ps1 script, you just need to provide your credentials.

    Make sure you have the Office 365 module installed first:

    Author Comment

    I tried it, I got the following error:

    PS C:\Office 365 Deployment Tools\Helper Scripts> GetMsolUserReport.ps1
    GetMsolUserReport.ps1 : The term 'GetMsolUserReport.ps1' is not recognized as
    the name of a cmdlet, function, script file, or operable program. Check the
    spelling of the name, or if a path was included, verify that the path is
    correct and try again.
    At line:1 char:1
    + GetMsolUserReport.ps1
    + ~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : ObjectNotFound: (GetMsolUserReport.ps1:String) [
       ], CommandNotFoundException
        + FullyQualifiedErrorId : CommandNotFoundException

    Suggestion [3,General]: The command GetMsolUserReport.ps1 was not found, but doe
    s exist in the current location. Windows PowerShell does not load commands from
    the current location by default. If you trust this command, instead type ".\GetM
    solUserReport.ps1". See "get-help about_Command_Precedence" for more details.
    PS C:\Office 365 Deployment Tools\Helper Scripts>
    LVL 38

    Expert Comment

    by:Vasil Michev (MVP)
    Run it like that:


    Or simply drag-drop the file into PowerShell window.

    Also make sure you have allowed scripts:

    Set-executionPolicy RemoteSigned
    LVL 23

    Assisted Solution

    by:Stelian Stan
    To run that you need to Connect Windows PowerShell to the Service:

    Author Comment

    C:\Office 365 Deployment Tools\Helper Scripts> $LiveCred = Get-Credential

    C:\Office 365 Deployment Tools\Helper Scripts> $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $LiveCred -Authentication Basic -AllowRedirection

    C:\Office 365 Deployment Tools\Helper Scripts> Import-PSSession $Session

    i run the above command, then i run:
    C:\Office 365 Deployment Tools\Helper Scripts> .\GetMsolUserReport.ps1

    i got the following error:
    PS C:\Office 365 Deployment Tools\Helper Scripts> .\GetMsolUserReport.ps1
    .\GetMsolUserReport.ps1 : File C:\Office 365 Deployment Tools\Helper
    Scripts\GetMsolUserReport.ps1 cannot be loaded because running scripts is
    disabled on this system. For more information, see about_Execution_Policies at
    At line:1 char:1
    + .\GetMsolUserReport.ps1
    + ~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : SecurityError: (:) [], PSSecurityException
        + FullyQualifiedErrorId : UnauthorizedAccess


    i read something about a 64bit and it's not working with it:
    LVL 23

    Accepted Solution

    I guess you need to change your execution policy, type:
             Set-ExecutionPolicy -ExecutionPolicy RemoteSigned

    ans set the execution policy in a particular scope:
            Set-ExecutionPolicy RemoteSigned -Scope CurrentUser


    Remove the execution policy:
            Set-ExecutionPolicy Undefined

    Featured Post

    Do email signature updates give you a headache?

    Do you feel like you are constantly making changes to email signatures? Are the images not formatting how you want them to? Want high-quality HTML signatures on all devices, including on mobiles and Macs? Then, let Exclaimer solve all your email signature problems today.

    Join & Write a Comment

    Suggested Solutions

    Set up iPhone and iPad email signatures to always send in high-quality HTML with this step-by step guide.
    Companies keep a much closer eye on costs today, so changing to new Technology – Microsoft Office 365 is the smartest move to take.
    In a previous video Micro Tutorial here at Experts Exchange (, I explained how to get a free, one-month trial of Office …
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    754 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

    24 Experts available now in Live!

    Get 1:1 Help Now