After my laptop was upgraded from Windows 10 to Windows 11 I got the following when I tried to do anything much in #Powershell
“Cannot dot-source this command because it was defined in a different language mode. To invoke this command without importing its contents, omit the ‘.’ operator.”
This was because, for some reason, the upgrade had re-pointed the System Environment variables TEMP and TMP.
The new folders pointed to by those variables are nobbled by our Software Restriction Policy. I amended the two variables to point at folders from which software is allowed to run and everything started working again.