How to Fix Set-TeamsSecurityPreview Cmdlet Not Recognized in PowerShell
Question details
The user needs to resolve a CommandNotFoundException when attempting to run the Set-TeamsSecurityPreview cmdlet.

- 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.
Ensure you are running PowerShell as an Administrator and have the necessary Global Admin or Teams Admin credentials for your Microsoft 365 tenant.
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.
Run the command Get-Module -ListAvailable in PowerShell to verify your currently installed Teams module versions.
Run Get-Command Set-TeamsSecurityPreview to see if the cmdlet is recognized within the loaded module.
If the cmdlet is missing, install the preview module by running Install-Module MicrosoftTeams -AllowPrerelease -Force.
Run Connect-MicrosoftTeams to establish a fresh connection with the new module loaded, then attempt your command again.

Escalate to Microsoft 365 Business Support
If the module is correct but the cmdlet remains unrecognized, the issue may stem from backend licensing or deprecated preview features.
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. Download the installer: Visit the official WPS Office website and download the free installer for your operating system.
- 2. Install the software: Run the downloaded file and follow the quick on-screen setup instructions.
- 3. Open existing files: Launch WPS Office and open your existing Microsoft Office documents directly without any format conversion.

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.




