Forum Discussion
Finding all F3 users from list with PowerShell
Hellocharlie4872 !
I've tried the same script and other variations of my own and I got it to work correct.
Is it possible for you to share the Source file ( users.txt ) so I can see what fields you have and if something there might be wrong?
Also, maybe convert the txt to csv format and see if that works better?
Try and work with variables instead of using so many pipes as well.
I managed to do this with a few users with the following script ( I used another SKU tho )
Connect-Msolservices
$Users = Import-csv -Path "C:\Path\Users.csv
$SKU = "O365_BUSINESS_ESSENTIALS"
Foreach ($User in $Users) {
Get-Msoluser -UserPrincipalName $User.UserPrincipalName | Where-Object {($_.Licenses).accountSkuId -notcontains $SKU} | Export-csv "C:\Path\Export.csv"
Let me know how it goes
Kind Regards
Oliwer Sjöberg