Restricted powershell mode

Harish Parameswaran 46 Reputation points
2021-11-22T00:10:04.567+00:00

Is it possible to use powershell "Invoke-command" while on restricted powershell mode?

Windows for business Windows Client for IT Pros Networking Network connectivity and file sharing
Windows for business Windows Client for IT Pros Devices and deployment Configure application groups
Windows for business Windows Server User experience PowerShell
Windows for business Windows Client for IT Pros User experience Other
{count} votes

2 answers

Sort by: Most helpful
  1. Rich Matheisen 47,901 Reputation points
    2021-11-22T00:34:43.353+00:00

    Yes, Invoke-Command is permitted, but not script blocks. There are also restrictions on the uses of variables, comparison operators, other things. You can use Invoke-Command with a file, though.

    about_language_modes

    0 comments No comments

  2. Limitless Technology 39,916 Reputation points
    2021-11-23T09:00:28.607+00:00

    Hi there,

    The default execution policy of PowerShell is called Restricted. In this mode, PowerShell operates as an interactive shell only. It does not run scripts, and loads only configuration files signed by a publisher that you trust.

    Invoke-command is Interactive one and you can use it in Restricted PowerShell command.

    The Invoke-Command cmdlet runs commands on a local or remote computer and returns all output from the commands, including errors.

    https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/invoke-command?view=powershell-7.2

    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------

    --If the reply is helpful, please Upvote and Accept it as an answer--


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.