Mar 24 2022 12:42 PM - edited Mar 24 2022 12:43 PM
Need to prevent Teams from auto-launching on my Azure AD joined PCs.
Mar 31 2022 11:55 PM
Have a read of this article:
Deploy Microsoft Teams with Microsoft 365 Apps - Deploy Office | Microsoft Docs
If your clients are native Azure-joined then you'd be looking to use an MDM like InTune to deliver any policy settings.
If your clients are hybrid-joined, you can leverage Active Directory group policy.
Cheers,
Lain
Apr 05 2022 07:45 AM
Apr 06 2022 03:22 AM
Yeah, fair enough.
Did you read the "tip" in the green box?
If you are deploying the policy setting after Teams has already been used by the user, it won't work just by deploying the setting on its own. You need to include the script linked inside that green "tip" box.
That script needs to be run per user, not just once per machine.
Pretty clunky solution in my opinion, but this is how things are these days.
Cheers,
Lain
Apr 06 2022 10:40 AM
Apr 06 2022 03:57 PM
Apr 07 2022 10:57 AM
Apr 07 2022 06:04 PM
Probably the first thing I'd check all the listed requirements in the blue box entitled "Important" as both the policy and the script only work against specific versions and channels of Office.
Deploy Microsoft Teams with Microsoft 365 Apps - Deploy Office | Microsoft Docs
With respect to the failures, I'm not an InTune person meaning I'm not sure if there's some sort of logging available via it, but since the PowerShell script is very basic and runs under the logged on user's identity, if InTune provides you with the user name and computer name it failed, it'd be easy enough to watch/shadow that person and run the script manually from a PowerShell session on their desktop.
There's multiple reasons it could be failing but three that come to mind are:
The PowerShell script itself is incredibly basic and given the amount of path testing it does, isn't likely to be throwing any exceptions from not finding a file or registry path, hence the above suggestions.
Very briefly, here's how to check each one.
PowerShell execution policy
As a general guideline, the PowerShell execution policy should be set to "RemoteSigned".
How to check the effective setting for the logged on user
Admin required? | No |
Command | Get-ExecutionPolicy |
How to check the machine configuration
Admin required? | No |
Command | Get-ExecutionPolicy -List |
How to change the machine configuration (no value changing it for only the user)
Admin required? | Yes |
Command | Set-ExecutionPolicy -Scope LocalMachine -ExecutionPolicy RemoteSigned -Force |
AppLocker
In Event Viewer:
If AppLocker is causing issues then you will also find that running the command manually from the desktop as the affected user will also fail, and they will probably get a pop-up saying that policy prevents them from running that command (unless it's been configured to silently fail via policy.)
PowerShell constrained mode
You have to run the following check from the logged in session of the impacted user.
How to check if constrained mode is in effect
Admin required? | No |
Command | $ExecutionContext.SessionState.LanguageMode |
If checking this variable returns FullLanguage then you have nothing to worry about. If you get ConstrainedLanguage then there may be an issue as the script does call some .NET classes explicitly.
You can read more about constrained mode here but what it doesn't tell you is that AppLocker can also play a role in constrained mode detection. I won't bore you with the specifics here - not yet anyway. Maybe if you see ConstrainedLanguage returned we can go down that path.
about Language Modes - PowerShell | Microsoft Docs
For all three cases, the most useful thing you can do to start with is shadow the user and run the script manually on their desktop session. Only if it fails to run would you then check each of the three settings above. And as I say, there's other reasons it could be failing, too. These are just three that came to mind quickly.
Cheers,
Lain
Dec 14 2022 08:18 AM