logo
search
Others

How to Fix Set-TeamsSecurityPreview Cmdlet Not Recognized in PowerShell

Tauseeq MagsiTauseeq Magsi Oct 13, 2026 868 views

Question details

The user needs to resolve a CommandNotFoundException when attempting to run the Set-TeamsSecurityPreview cmdlet.

Fixing Set-TeamsSecurityPreview Cmdlet Not Recognized Error in PowerShell
Product
Microsoft Teams PowerShell
Device & OS
not provided
Scenario
Attempting to enable Teams Security Preview features using PowerShell commands in a Microsoft 365 environment.
Observed behavior
PowerShell throws a CommandNotFoundException, indicating the Set-TeamsSecurityPreview cmdlet is not recognized despite module and permission checks.
Before you start

Ensure you are running PowerShell as an Administrator and have the necessary Global Admin or Teams Admin credentials for your Microsoft 365 tenant.

Solution 1Recommended

Verify and Install the Required Preview Module

Check if the cmdlet is available in your current module and install the necessary prerelease version if it is missing.

The Set-TeamsSecurityPreview cmdlet is often tied to preview features that are not included in the standard general availability (GA) releases of the Teams PowerShell module. You must ensure the prerelease module is actively installed and loaded into your session.

1
Check installed modules

Run the command Get-Module -ListAvailable in PowerShell to verify your currently installed Teams module versions.

2
Verify cmdlet availability

Run Get-Command Set-TeamsSecurityPreview to see if the cmdlet is recognized within the loaded module.

3
Install the prerelease module

If the cmdlet is missing, install the preview module by running Install-Module MicrosoftTeams -AllowPrerelease -Force.

4
Reconnect to Microsoft 365

Run Connect-MicrosoftTeams to establish a fresh connection with the new module loaded, then attempt your command again.

Verify and Install the Required Preview Module
AllowPrerelease Parameter: Using the -AllowPrerelease flag requires the PowerShellGet module to be up to date. If it fails, update PowerShellGet first.
Free Microsoft Office alternative

Simplify Your Document Workflow with WPS Office

While managing Microsoft 365 Enterprise environments can involve complex PowerShell troubleshooting, managing your daily documents should be easy. WPS Office provides a free, lightweight, and user-friendly alternative to Microsoft Office, ensuring seamless migration without the heavy administrative overhead.

  1. 1. Download the installer: Visit the official WPS Office website and download the free installer for your operating system.
  2. 2. Install the software: Run the downloaded file and follow the quick on-screen setup instructions.
  3. 3. Open existing files: Launch WPS Office and open your existing Microsoft Office documents directly without any format conversion.
Fully compatible with Microsoft Office formats like .docx, .xlsx, and .pptxFree and lightweight suite for all your Word, Excel, PowerPoint, and PDF needsFamiliar user interface requiring zero learning curve for easy migrationNo complex enterprise licensing or PowerShell management required for basic usage
microsoft office alternative - wps office

Frequently Asked Questions

Why does PowerShell say my Teams cmdlet is not recognized?

This error typically occurs if the required Microsoft Teams PowerShell module is not installed, hasn't been imported into your current session, or if you are using an older version that lacks the specific cmdlet.

Do I need a special license to use Set-TeamsSecurityPreview?

Yes, advanced security preview features in Microsoft 365 often require an Enterprise E5 license or specific security add-ons to function and be recognized by the tenant.

How do I install preview modules for Microsoft Teams?

You can install preview versions by appending the -AllowPrerelease parameter to the Install-Module cmdlet in PowerShell, which fetches versions not yet available in general release.