locked
how to change powershell languagemode to FullLanguage RRS feed

  • Question

  • Hi,

    on my windows 10 machine powershell script execution started failing with below error :

     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.

    I check my language mode and it was : ConstrainedLanguage

    I tried to set environment variable __PSLockdownPolicy to 0 and 

    $ExecutionContext.SessionState.LanguageMode=[System.Management.Automation.PSLanguageMode]::FullLanguage

    but no luck at all.

    Can you guys help me how to change language mode or any other pointer in microsoft's powershell team to contact.

    Wednesday, February 13, 2019 5:37 AM

All replies

  • Just don't dot source the file. Your admins have set the remote endpoint to constrained mode to limit its capabilities. You will need to contact them to find out what they are setting and what the limits are.


    \_(ツ)_/

    Wednesday, February 13, 2019 5:59 AM
  • Hi Thanks for your reply.

    Can you please tell what kind of setting it could be ?

    Its working fine on all my colleagues machine and all of sudden this started failing. 


    Wednesday, February 13, 2019 6:45 AM
  • Language mode is set by the remote.  Ask the owner of the remote system.  If you are not an admin on the remote system then you may be using a different endpoint than other users.


    \_(ツ)_/

    Wednesday, February 13, 2019 6:49 AM
  • Hi,

    I apologies for asking very naive question here.

    But what is 'remote' here. Its my local box and I 'm user part of admin group.

    and Can you tell in details what changes are require by admin group as well ?


    Wednesday, February 13, 2019 7:05 AM
  • Without an example of your code then we are just poking in the dark.  What local command causes  the error?  What OS and PS version?


    \_(ツ)_/

    Wednesday, February 13, 2019 7:27 AM
  • Hi,

    Was your issue resolved?

    If you resolved it using our solution, please "mark it as answer" to help other community members find the helpful reply quickly.

    If you resolve it using your own solution, please share your experience and solution here. It will be very beneficial for other community members who have similar questions.

    If no, please reply and tell us the current situation in order to provide further help.

    Best Regards,

    Lee


    Just do it.

    Thursday, February 28, 2019 2:30 PM