Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Write-host "Teams Meeting Policy"
Get-CsOnlineUser -Filter {TeamsMeetingPolicy -eq 'GivenPolicyNameBlankForGlobal'} | Select UserPrincipalName
@garbertschow

This comment has been minimized.

Copy link

@garbertschow garbertschow commented May 27, 2021

Hey, I got the following issue when I wanna check for Users who are in Global Policies. What do you mean by:
GivenPolicyNameBlankForGlobal
Neither of those work for me:
Get-CsOnlineUser -Filter {TeamsAppPermissionPolicy -eq ""} | Select UserPrincipalName
Get-CsOnlineUser -Filter {TeamsAppPermissionPolicy -eq " "} | Select UserPrincipalName
Get-CsOnlineUser -Filter {TeamsAppPermissionPolicy -eq "Global"} | Select UserPrincipalName

Errorcode is: The policy "" is not a Userpolicy.

@pmatthews05

This comment has been minimized.

Copy link
Owner Author

@pmatthews05 pmatthews05 commented May 27, 2021

Hi @garberschow,
Can I check, are you still using the SkypeForBusiness module, or the Teams Module now. That blog post is a bit out of date now.

Get-CsOnlineUser doesn't seem to be in the new MS Teams Module. With the 10 minutes I have spare, I'm unable to find out what the replacement of this is.

Other thing, perhaps you can try, is use single quote instead of double?

@garbertschow

This comment has been minimized.

Copy link

@garbertschow garbertschow commented May 27, 2021

Hey I tried using single quotes too. I am using the Teams Module. Although I got some commands working Get-CsOnlineUser
EDIT: For example Get-CsOnlineUser -Filter {TeamsAppPermissionPolicy -eq "INSERTCUSTOMGROUPNAMEHERE"} | Select UserPrincipalName
works just fine

@pmatthews05

This comment has been minimized.

Copy link
Owner Author

@pmatthews05 pmatthews05 commented May 27, 2021

Unable to look at, at the moment. I was unable to find the command Get-CsOnlineUser when I tested at lunch time.

When I said 'GivenPolicyNameBlankForGlobal' I meant give a policy name, OR put blank for global, but as you have stated that didn't work.

Which version of Teams module are you using. I will attempt to have a go later on tonight, and report back. Any chance you could post your code for this bit?

@garbertschow

This comment has been minimized.

Copy link

@garbertschow garbertschow commented May 27, 2021

Version 2.3.1 MicrosoftTeams
The Code is just:
Get-CsOnlineUser -Filter {TeamsAppPermissionPolicy -eq ""} | Select UserPrincipalName
I also tried:
Get-CsOnlineUser -WarningAction SilentlyContinue | Where-Object { $_.TeamsAppPermissionPolicy -eq ""} | Select UserPrincipalName

And this line works as intended:
Get-CsOnlineUser -Filter {TeamsAppPermissionPolicy -eq "Global NoApps"} | Select UserPrincipalName

Thank you for your help!

@pmatthews05

This comment has been minimized.

Copy link
Owner Author

@pmatthews05 pmatthews05 commented May 27, 2021

Cheers, I will take a look later. You connect like below?

Install-Module MicrosoftTeams
$credential = Get-Credential
#Connect to Microsoft Teams
Connect-MicrosoftTeams -Credential $credential
Get-CsOnlineUser -Filter {TeamsAppPermissionPolicy -eq "Global NoApps"} | Select UserPrincipalName

One last thought, you haven't removed/deleted the original Global policy?

@pmatthews05

This comment has been minimized.

Copy link
Owner Author

@pmatthews05 pmatthews05 commented May 27, 2021

I think for the Teams Module they have updated this code. So you use $null instead of blank or Global.

Get-CsOnlineUser -Filter {TeamsAppPermissionPolicy -eq $null} | Select UserPrincipalName

Let me know if that works for you.

@garbertschow

This comment has been minimized.

Copy link

@garbertschow garbertschow commented May 27, 2021

Thank you so far. I will try tomorrow and report back. Have a nice day.

@garbertschow

This comment has been minimized.

Copy link

@garbertschow garbertschow commented May 28, 2021

$null works! Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment