Hi @Ramki ,
Scenario : i a bunch of Lineuri Numbers, in txt or CSV
i would like to get the Userprincipal Name, and Policy assinged to it.
Let's say the file includes the Lineuri numbers is formatted as follows and is located at "C:\test\1.csv":
You can try copying the script below into Notepad, saved it as a .ps1 file and then run it from PowerShell. Then you would be able to get the UserPrincipalName and policies based on LineUri values and the result would be exported into a CSV file(c:\test\result.csv) :
$LineURIs = Import-Csv C:\test\1.csv
$Data = @()
foreach($LineURI in $LineURIs){
$Data+=Get-CsOnlineUser | where{$_.LineURI -eq $LineURI.LineUri} | select LineUri,UserPrincipalName,*Policy*
}
$Data | Export-Csv c:\test\result.csv -NoTypeInformation
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.