PSM - Cannot run any powershell\hardening scripts - "Only Core Types are supported in this language mode" error
199
Created On 11/10/26 10:56 AM - Last Modified 11/10/26 16:08 PM
Symptom
Cannot run any PowerShell\hardening scripts - "Only Core Types are supported in this language mode" error in PowerShell window.
Environment
10.5;10.6;10.7;10.8;10.9;10.10;11.1;11.2;11.4;11.5;11.6;12.0;12.1 Privileged Access Manager (PAM, self-hosted) PSM
PSM Scripts
Cause
- This is due to a PowerShell security policy that severely restricts running PowerShell scripts even when the Execution Policy is permissive.
- The language mode determines the language elements that are permitted in the PowerShell session.
- If you run this scriptlet it will show you the LanguageMode:
$ExecutionContext.SessionState.LanguageMode
ConstrainedLanguage
- The ConstrainedLanguage mode permits all cmdlets and all PowerShell language elements, but it limits permitted types.
Note: PowerShell comes with several language mode which can be adjusted:
- Full Language
- Restricted Language
- No Language
- Constrained Language
Users can locate additional information using the following command:
Get-Help about_Language_Modes
Resolution
Change the Language Mode to "FullLanguage".
- Right-click the Computer icon and choose Properties, or in Windows Control Panel, choose System.
- Choose Advanced system settings.
- On the Advanced tab, click Environment Variables.
- Click New to create a new environment variable.
- You need to set a Windows environment variable named “__PSLockdownPolicy” at 8.
- After creating or modifying the environment variable, click Apply and then OK to have the change take effect.
On the PSM\component server, you can check if your setting is applied with the PowerShell scriptlet :
$ExecutionContext.SessionState.LanguageMode
FullLanguage