Forum Discussion
license export in Office365
Hi Experts
please help me with the below two syntaxes
1. i have one office 365 user user1@mydomain.com ,i want to know what license is assigned to this office365 user from Exchange Online powershell module.
2. i have 100 users in csv file, i want to import this csv file and know what are the licenses assigned to these users.
Below is csv file format.
Name
user1@mydomain.com
user2@mydomain.com
5 Replies
- Get started with this examples:
I might have to review them when I get home though
Get-MsolUser -UserPrincipalName User1@mydomain.com | ft DisplayName,Licenses
$csv = Import-Csv c:\your.csv
| ForEach ($user in $csv) {Get-MsoluserLicense} | ft displayname,Licenses | export-csv C:\logfile.csv- Rising FlightBrass Contributor
Hi when i use the below syntax i am getting output
Get-MsolUser -UserPrincipalName user1@mydomain.com | Format-List DisplayName,Licenses
DisplayName : User1
Licenses : EMS, ENTERPRISEPACK}
==========================================
I tried the below two syntaxes i am getting error$CSV = Import-CSV C:\userlist.csv
$CSV | ForEach-Object {
$UPN =$_.upn
Get-MsolUser -UserPrincipalName "$UPN" | Format-List DisplayName,Licenses}
==============================================
$Users= Import-CSV C:\userlist.csv
Foreach($User in $Users){(Get-MsolUser -UserPrincipalName $User.Name).Licenses.DisplayName|Ft} | Export-CSV "C:\output.csv" -NoTypeInformation
=================================
my csv file is in the format
Name
user1@mydomain.om
user2@mydomain.com- There is bracket error in the last one! I’ll check a little later