Comments on: Use PowerShell to Create a Report About the Teams Policies Assigned to User Accounts https://practical365.com/report-teams-policy-assignments/ Practical Office 365 News, Tips, and Tutorials Fri, 15 Dec 2023 15:37:51 +0000 hourly 1 https://wordpress.org/?v=6.6.1 By: Tony Pounder https://practical365.com/report-teams-policy-assignments/#comment-283769 Fri, 15 Dec 2023 15:37:51 +0000 https://practical365.com/?p=54011#comment-283769 Thanks for the post and the script Tony. The script forms the perfect starting point for what I need next week.

]]>
By: <div class="apbct-real-user-wrapper"> <div class="apbct-real-user-author-name">Tony Redmond</div> <div class="apbct-real-user-badge" onmouseover=" let popup = document.getElementById('apbct_trp_comment_id_274353'); popup.style.display = 'inline-flex'; "> <div class="apbct-real-user-popup" id="apbct_trp_comment_id_274353"> <div class="apbct-real-user-title"> <p class="apbct-real-user-popup-header">The Real Person!</p> <p class="apbct-real-user-popup-text">Author <b>Tony Redmond</b> acts as a real person and passed all tests against spambots. Anti-Spam by CleanTalk.</p> </div> </div> </div> </div> https://practical365.com/report-teams-policy-assignments/#comment-274353 Mon, 11 Sep 2023 09:01:44 +0000 https://practical365.com/?p=54011#comment-274353 In reply to Vish.

Try: Get-CsOnlineuser | where-Object {$Null -eq $_.TeamsAppPermissionPolicy} | Format-Table DisplayName

]]>
By: Vish https://practical365.com/report-teams-policy-assignments/#comment-274345 Mon, 11 Sep 2023 07:16:43 +0000 https://practical365.com/?p=54011#comment-274345 Hi Tony,

I would like to only extract list of users who has been assigned to the “Global’ app permission policy
Get-CsOnlineUser -Filter {TeamsAppPermissionPolicy -eq ”} | Export-CSV

Not sure how to mentioned to extract “Global”, I have tried with $null, blank and global.. no success

Any help plz

]]>
By: <div class="apbct-real-user-wrapper"> <div class="apbct-real-user-author-name">Tony Redmond</div> <div class="apbct-real-user-badge" onmouseover=" let popup = document.getElementById('apbct_trp_comment_id_256323'); popup.style.display = 'inline-flex'; "> <div class="apbct-real-user-popup" id="apbct_trp_comment_id_256323"> <div class="apbct-real-user-title"> <p class="apbct-real-user-popup-header">The Real Person!</p> <p class="apbct-real-user-popup-text">Author <b>Tony Redmond</b> acts as a real person and passed all tests against spambots. Anti-Spam by CleanTalk.</p> </div> </div> </div> </div> https://practical365.com/report-teams-policy-assignments/#comment-256323 Sun, 12 Mar 2023 17:36:57 +0000 https://practical365.com/?p=54011#comment-256323 In reply to Gilbert.

Of course you’ll need to retrieve the policy information for each user with Get-CsOnlineUser. I meant that you wouldn’t use the cmdlet to fetch the set of users for processing.

Because your CSV file only contains three properties with different names to those returned by Get-CsOnlineUser, the command to fetch details for each user will be something like Get-CsOnlineUser -Identity $User.UPN instead of what’s in the script now.

]]>
By: Gilbert https://practical365.com/report-teams-policy-assignments/#comment-256320 Sun, 12 Mar 2023 16:18:28 +0000 https://practical365.com/?p=54011#comment-256320 Thanks Tony for the prompt response, I only have 3 user fields in the csv that I’m using SIP, UPN and Email, so I still need to get their policy values with get-csonline user. If I run as is I cant retrieve the users policies

[array]$Users = import-csv ./masterlist_summary1.csv
$Report = [System.Collections.Generic.List[Object]]::new()
# Process each user to fetch their policy assignments
ForEach ($user in $Users) {
$TenantDefaultString = “Tenant Default”
$TenantDialPlan = $TenantDefaultString

]]>
By: <div class="apbct-real-user-wrapper"> <div class="apbct-real-user-author-name">Tony Redmond</div> <div class="apbct-real-user-badge" onmouseover=" let popup = document.getElementById('apbct_trp_comment_id_256313'); popup.style.display = 'inline-flex'; "> <div class="apbct-real-user-popup" id="apbct_trp_comment_id_256313"> <div class="apbct-real-user-title"> <p class="apbct-real-user-popup-header">The Real Person!</p> <p class="apbct-real-user-popup-text">Author <b>Tony Redmond</b> acts as a real person and passed all tests against spambots. Anti-Spam by CleanTalk.</p> </div> </div> </div> </div> https://practical365.com/report-teams-policy-assignments/#comment-256313 Sun, 12 Mar 2023 14:47:19 +0000 https://practical365.com/?p=54011#comment-256313 In reply to Gilbert.

There are two lines in the script that fetch users and prepare them for processing:

[array]$Users = Get-CsOnlineUser -ResultSize 5000
# Filter the set to get Teams users – this will filter out all but cloud-only Teams users. If you don’t want to use the filter, comment it out.
$Users = $Users | Where-Object {$_.InterpretedUserType -eq “PureOnlineTeamsOnlyUser” -or $_.InterpretedUserType -eq “PureOnlineTeamsOnlyUserFailedPublishingToAAD”} | Sort-Object DisplayName
If (!($Users)) {Write-Host “No users found – exiting”; break }

Replace these lines with:
[array]$Users = Import-CSV filename…

You don’t need to run Get-CsOnlineUser if you’re providing user details another way.

]]>
By: Gilbert https://practical365.com/report-teams-policy-assignments/#comment-256309 Sun, 12 Mar 2023 14:30:57 +0000 https://practical365.com/?p=54011#comment-256309 Thanks for the reply. Unfortunately I’m not very good at powershell but I can understand how your script is creating the array from up to 5000 users in the tenant.
What I’m confused by is your script has 1 array that is used to get-csonlineuser, retrieves the results for up to 5000 users and then can optionally filter on the array. If I change that $users array to be “[array]$Users = Import-CSV ./Users.csv” then it removes the get-csonlineuser. My question is how do I create an array with my csv AND run get-csonlineuser at the same line of code? I’m not sure how that looks. Really appreciate your help.

]]>
By: <div class="apbct-real-user-wrapper"> <div class="apbct-real-user-author-name">Tony Redmond</div> <div class="apbct-real-user-badge" onmouseover=" let popup = document.getElementById('apbct_trp_comment_id_255784'); popup.style.display = 'inline-flex'; "> <div class="apbct-real-user-popup" id="apbct_trp_comment_id_255784"> <div class="apbct-real-user-title"> <p class="apbct-real-user-popup-header">The Real Person!</p> <p class="apbct-real-user-popup-text">Author <b>Tony Redmond</b> acts as a real person and passed all tests against spambots. Anti-Spam by CleanTalk.</p> </div> </div> </div> </div> https://practical365.com/report-teams-policy-assignments/#comment-255784 Sun, 05 Mar 2023 14:50:45 +0000 https://practical365.com/?p=54011#comment-255784 In reply to Gilbert.

The script uses these lines of code to find the set of users to process:

[array]$Users = Get-CsOnlineUser -ResultSize 5000
# Filter the set to get Teams users – this will filter out all but cloud-only Teams users. If you don’t want to use the filter, comment it out.
$Users = $Users | Where-Object {$_.InterpretedUserType -eq “PureOnlineTeamsOnlyUser” -or $_.InterpretedUserType -eq “PureOnlineTeamsOnlyUserFailedPublishingToAAD”} | Sort-Object DisplayName

Instead, to build the set of users to process from a CSV, you’d use a command like:

[array]$Users = Import-CSV Users.csv

]]>
By: Gilbert https://practical365.com/report-teams-policy-assignments/#comment-255764 Sun, 05 Mar 2023 06:30:55 +0000 https://practical365.com/?p=54011#comment-255764 Sorry meant to say how can I run the script against users in A CSV. We are migrating users in batches so I only want to report on that rather than running the script against the whole organisation and doing matches in Excel against the migration group.

]]>
By: Gilbert https://practical365.com/report-teams-policy-assignments/#comment-255763 Sun, 05 Mar 2023 06:28:28 +0000 https://practical365.com/?p=54011#comment-255763 Great script. Can I ask how can I run the script only against users in the CSV (a group of users not the whole organisation)

]]>