Forum Discussion

pardeep soba's avatar
pardeep soba
Copper Contributor
Jul 04, 2017
Solved

i need to export users in powershell with centricaplc.onmicrosoft.com domain and are licenced

i need to export users in powershell with centricaplc.onmicrosoft.com domain and are licenced

 

i tried this command doesnt work

 

Get-MsolUser -All | Where-Object {$_.Domain -eq "centricaplc.onmicrosoft.com"} | Export-CSV c:\support\cloud.csv

 

i tried doing this via the admin portal but that does not work!

  • You can try this script

     

    Get-MsolUser -All |Where-Object {$_.UserPrincipalName -like "*centricaplc.onmicrosoft.com" -and $_.isLicensed -eq $true } |Export-csv c:\support\cloud.csv -NoTypeInformation

4 Replies

  • SanthoshB1's avatar
    SanthoshB1
    Bronze Contributor

    You can try this script

     

    Get-MsolUser -All |Where-Object {$_.UserPrincipalName -like "*centricaplc.onmicrosoft.com" -and $_.isLicensed -eq $true } |Export-csv c:\support\cloud.csv -NoTypeInformation
  • You are comparing against a "domain" property, which does not exist. Try something like this instead:

     

    Get-MsolUser -All | ? {$_.UserPrincipalName.Split("@")[1] -eq "centricaplc.onmicrosoft.com"}

     

     

Resources