Cannot dot-source this command because it was defined in a different language mode

Problem:

PowerShell console runs in Constrained Language mode when using software restriction policies and AppLocker.  This means you may get an error when trying to run some scripts.

Solution:

Add a path rule to allow scripts to run in the below:

%OSDRIVE%\USERS\*\APPDATA\LOCAL\TEMP\__PSSCRIPTPOLICYTEST_*

Leave a Reply

Your email address will not be published. Required fields are marked *