ARI icon indicating copy to clipboard operation
ARI copied to clipboard

Cannot start job. The language mode for this session is incompatible with the system-wide language mode.

Open FoxFuze opened this issue 7 months ago • 10 comments

When trying to run Powershell (now in Powershell 7) I get the following list of errors. Trying to figure out if this is a usage error from my side, or issue with the module itself.

When trying to run Powershell (now in Powershell 7) I get the following list of errors. Trying to figure out if this is a usage error from my side, or issue with the module itself.

FoxFuze avatar May 20 '25 13:05 FoxFuze

Hello @FoxFuze

I remember someone else having that same issue in the past (#228 )

The issue was the LanguageMode was set to ConstrainedLanguage mode. By default this has to be FullLanguage.

Can you check how is the LanguageMode at your terminal?

$ExecutionContext.SessionState.LanguageMode

Claudio-Merola avatar May 20 '25 13:05 Claudio-Merola

@FoxFuze

That was not to change the configuration, was just to see what is the actual configuration of the LanguageMode.

So, it was set to ConstrainedMode?

Claudio-Merola avatar May 20 '25 14:05 Claudio-Merola

Apologies, see below.

PowerShell 7.5.1 [Constrained Language AUDIT Mode : No Restrictions] PS C:\Users\bartho.niemand> $ExecutionContext.SessionState.LanguageMode ConstrainedLanguage PS C:\Users\bartho.niemand>

FoxFuze avatar May 20 '25 14:05 FoxFuze

Yep, it should be FullLanguage

let's see if that cmd does the trick:

$ExecutionContext.SessionState.LanguageMode = "FullLanguage"

After that, check again if the LanguageMode have changed and try to run ARI (preferably in a new terminal window)

Claudio-Merola avatar May 20 '25 15:05 Claudio-Merola

@Claudio-Merola as stated in the previous output I did change the language mode and still it did not work

Please take a look at my previous comment. Output

FoxFuze avatar May 20 '25 15:05 FoxFuze

@FoxFuze I believe the LanguageMode is being set by an AppLocker policy, that is why is being impossible to change it.

Can you check internally if that is the case?

Claudio-Merola avatar May 20 '25 17:05 Claudio-Merola

Hi @Claudio-Merola I checked AppLocker policies and unable to see anything in the local policies. I've tried multiple troubleshooting steps using AI and still no luck. the weird thing is that this use to work without any issues a few months back. and the latest version is only compatible with PowerShell 7.x.x

My last resort will be to install an older module and hope for the best unless you have more guidance?

FoxFuze avatar May 21 '25 09:05 FoxFuze

Hi @FoxFuze

This has to be a policy to enforce the ConstrainedMode, a WDAC perhaps? (Using a system application control policy)

Did you checked on gpedit.msc at: Local Computer Policy > Computer Configuration > Windows Settings > Security Settings > Application Control Policies > AppLocker -> Script Rules

There are any rules there?

What about the registry, at: *HKLM\System\CurrentControlSet\Control\SESSION MANAGER\Environment*

There is any key named: "__PSLockdownPolicy" I believe value 4 would be ConstrainedMode

If that is the case I would suggest working with the policy team to workaround these configuration.

Maybe if you delete that Registry key and change the "Application Identity service" to manual, then stop it. and then change the LanguageMode to FullLanguage and then run the script it would work, but I'm not sure.

Also maybe you could try to create a PSSession file (New-PSSessionConfigurationFile), but if this is a security policy, I doubt it will bypass that.

Latest versions of the script won't work with Powershell version 5 and below due to the cmdlets we use in the script.

Claudio-Merola avatar May 21 '25 12:05 Claudio-Merola

My friend, please, remove all of your informations from the logs, don't show them to the public....

spartafiset143 avatar May 21 '25 14:05 spartafiset143

This Issue is stale and may be automatically close soon.

github-actions[bot] avatar Jun 21 '25 14:06 github-actions[bot]

Hi @Claudio-Merola , I'm having the exact same issue.

I'm using powershell 7.5.2. I'm running it elevated and I have the necessary access in our azure tenant.

I actually checked the Script Rules before I made this reply and there's no reference to PS in there.

Image

I checked in Registry in the path: HKLM\System\CurrentControlSet\Control\SESSION MANAGER\Environment

There's no PSLockdown entry or key.

When I run the ARI, I get the exact same issues and the output XL is empty.

when I check the language mode:

Image

gavinmcmenemy avatar Aug 25 '25 12:08 gavinmcmenemy