Handy Cmdlts in Microsoft Teams

Often we come across of scenario where we need small onliner cmdlts to get information quickly. Below are few such onliner.

Get the details of  all MS Teams users and value stamped to these user properties.

PS C:\> get-csonlineuser | select-object UserPrincipalName,UsageLocation,TeamsUpgradeEffectiveMode,TeamsUpgradePolicy,TeamsCallingPolicy,OnlineVoiceRoutingPolicy,HostingProvider,DialPlan,LineUri,AssignedPlan | Export-Csv -NoTypeInformation -Path C:\scripts\output.csv

Import users from CSV file and get their report. Export results into CSV file. Just make sure the inupt file contains header as Displayname.

PS C:\> import-csv c:\scripts\Input.csv | foreach{get-csonlineuser $_.Displayname} | UserPrincipalName,UsageLocation,TeamsUpgradeEffectiveMode,TeamsUpgradePolicy,TeamsCallingPolicy,OnlineVoiceRoutingPolicy,HostingProvider,DialPlan,LineUri,AssignedPlan | Export-Csv -NoTypeInformation -Path C:\scripts\output.csv

Get the phone number and its corresponding type

PS C:\> import-csv c:\scripts\Input.csv | foreach{Get-CsPhoneNumberAssignment -TelephoneNumber $_.phonenumbertype} | Select-Object Telephonenumber,PstnAssignmentStatus,Numbertype

List of users based on Usage Location filter as US :

Get-CsOnlineUser -Filter {UsageLocation -eq "US"} | Select-Object DisplayName,UsageLocation,UserPrincipalName,LineUri | Export-Csv -NoTypeInformation -Path C:\scripts\output.csv

Get user list based on specified filter (where OR filter condition)

PS C:\> Get-CsOnlineUser | Where{$_.userprincipalname -like "*mar*"} |ft Alias
PS C:\> Get-CsOnlineUser -Filter {Tenantdialplan -like "test*"} | ft userprincipalname
This entry was posted in Powershell. Bookmark the permalink.

Leave a Reply

Your email address will not be published.