Ron Shorts
asked on
Powershell for loop script for O365 licenses
Hi Experts,
I'm trying to create a powershell script, with a for loop to pull a list of users from a list and get it into a .csv file for a list of users to export Office 365 licenses.
The script I have is only outputting the last user in the list I have.
Can anyone help with this?
I'm trying to create a powershell script, with a for loop to pull a list of users from a list and get it into a .csv file for a list of users to export Office 365 licenses.
The script I have is only outputting the last user in the list I have.
Can anyone help with this?
$list = import-csv .\list.csv
foreach ($User in $List)
{
Get-MSOLUser -UserPrincipalName $User.userprincipalname | where {$_.isLicensed -eq $true} |select DisplayName,userprincipalname,islicensed,{$_.Licenses.AccountSkuId}| Export-CSV .\O365UserList.csv –NoTypeInformation
}
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER