Quantcast
Channel: Azure Management Portal forum
Viewing all articles
Browse latest Browse all 4189

Get-MsolUser filtered variable

$
0
0

Wonder if anyone can help...

> I have a txt file containing a list of user principal names. 

> I need to return all users if they have a licence and their UPN isn't listed in the TXT file. 

 

#User Import#
$Users = Get-Content C:\Users\NAME\UserImport.txt

#Get All Licensed Users & Filtered
foreach ($Users in $MSOLUsers){
$User = Get-MsolUser -UserPrincipalName $MSOLUser
$users = Get-MsolUser -All | Where-Object {$_.isLicensed -eq $true -and $_.UserPrincipalName -notlike "*$Users*"}
$users.Count
}

 

Any help appreciated! 


Callum


Viewing all articles
Browse latest Browse all 4189

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>