Restricted powershell mode

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

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

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
5,904 questions
Windows 10 Network
Windows 10 Network
Windows 10: A Microsoft operating system that runs on personal computers and tablets.Network: A group of devices that communicate either wirelessly or via a physical connection.
1,933 questions
Windows 10 Security
Windows 10 Security
Windows 10: A Microsoft operating system that runs on personal computers and tablets.Security: The precautions taken to guard against crime, attack, sabotage, espionage, or another threat.
2,132 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
4,615 questions
{count} votes

2 answers

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

    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

    No comments

  2. answered 2021-11-23T09:00:28.607+00:00
    Limitless Technology 37,291 Reputation points

    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--