Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 45 additions & 60 deletions reference/5.1/Microsoft.PowerShell.Core/Enable-PSRemoting.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
external help file: System.Management.Automation.dll-Help.xml
Locale: en-US
Module Name: Microsoft.PowerShell.Core
ms.date: 10/06/2023
ms.date: 11/25/2024
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/enable-psremoting?view=powershell-5.1&WT.mc_id=ps-gethelp
schema: 2.0.0
title: Enable-PSRemoting
Expand All @@ -15,25 +15,26 @@ Configures the computer to receive remote commands.
## SYNTAX

```
Enable-PSRemoting [-Force] [-SkipNetworkProfileCheck] [-WhatIf] [-Confirm] [<CommonParameters>]
Enable-PSRemoting [-Force] [-SkipNetworkProfileCheck] [-WhatIf] [-Confirm]
[<CommonParameters>]
```

## DESCRIPTION

The `Enable-PSRemoting` cmdlet configures the computer to receive PowerShell remote commands that
are sent by using the WS-Management technology.

PowerShell remoting is enabled by default on Windows Server 2012. You can use `Enable-PSRemoting`
to enable PowerShell remoting on other supported versions of Windows and to re-enable remoting on
Windows Server 2012 if it becomes disabled.
PowerShell remoting is enabled by default on Windows Server 2012 and higher. You can use
`Enable-PSRemoting` to enable PowerShell remoting on other supported versions of Windows and to
re-enable remoting if it becomes disabled.

You have to run this command only one time on each computer that will receive commands. You do not
have to run it on computers that only send commands. Because the configuration starts listeners, it
is prudent to run it only where it is needed.
You need to run this command only one time on each computer that receive commands. You don't need to
run it on computers that only send commands. Because the configuration starts listeners, it's
prudent to run it only where it's needed.

Beginning in PowerShell 3.0, the `Enable-PSRemoting` cmdlet can enable PowerShell remoting
on client versions of Windows when the computer is on a public network. For more information, see
the description of the **SkipNetworkProfileCheck** parameter.
Beginning in PowerShell 3.0, the `Enable-PSRemoting` cmdlet can enable PowerShell remoting on client
versions of Windows when the computer is on a public network. For more information, see the
description of the **SkipNetworkProfileCheck** parameter.

The `Enable-PSRemoting` cmdlet performs the following operations:

Expand All @@ -44,21 +45,20 @@ The `Enable-PSRemoting` cmdlet performs the following operations:
- Creates a listener to accept requests on any IP address.
- Enables a firewall exception for WS-Management communications.
- Registers the **Microsoft.PowerShell** and **Microsoft.PowerShell.Workflow** session
configurations, if it they are not already registered.
- Registers the **Microsoft.PowerShell32** session configuration on 64-bit computers, if it is
configurations, if it they're not already registered.
- Registers the **Microsoft.PowerShell32** session configuration on 64-bit computers, if it's
not already registered.
- Enables all session configurations.
- Changes the security descriptor of all session configurations to allow remote access.
- Restarts the WinRM service to make the preceding changes effective.

To run this cmdlet on the Windows platform, start PowerShell by using the Run as administrator
option. This does not apply to Linux or MacOS versions of PowerShell.
option.

> [!CAUTION]
> On systems that have both PowerShell 3.0 and PowerShell 2.0, do not use
> PowerShell 2.0 to run the `Enable-PSRemoting` and `Disable-PSRemoting` cmdlets. The commands
> might appear to succeed, but the remoting is not configured correctly. Remote commands and later
> attempts to enable and disable remoting, are likely to fail.
For more information about using PowerShell remoting, see the following articles:

- [about_Remote_Requirements](about/about_Remote_Requirements.md)
- [about_Remote](about/about_Remote.md)

## EXAMPLES

Expand Down Expand Up @@ -109,7 +109,7 @@ domain networks. The command uses the **SkipNetworkProfileCheck** parameter to a
from public networks in the same local subnet. The command specifies the **Force** parameter to
suppress confirmation messages.

The **SkipNetworkProfileCheck** parameter does not affect server versions of the Windows operating
The **SkipNetworkProfileCheck** parameter doesn't affect server versions of the Windows operating
system, which allow remote access from public networks in the same local subnet by default.

The `Set-NetFirewallRule` cmdlet in the **NetSecurity** module adds a firewall rule that allows
Expand Down Expand Up @@ -141,13 +141,12 @@ Accept wildcard characters: False
### -SkipNetworkProfileCheck

Indicates that this cmdlet enables remoting on client versions of the Windows operating system when
the computer is on a public network. This parameter enables a firewall rule for public networks
that allows remote access only from computers in the same local subnet.
the computer is on a public network. This parameter enables a firewall rule for public networks that
allows remote access only from computers in the same local subnet.

This parameter does not affect server versions of the Windows operating system, which, by default,
have a local subnet firewall rule for public networks. If the local subnet firewall rule is
disabled on a server version, `Enable-PSRemoting` re-enables it, regardless of the value of this
parameter.
This parameter doesn't affect server versions of the Windows operating system, which, by default,
have a local subnet firewall rule for public networks. If the local subnet firewall rule is disabled
on a server version, `Enable-PSRemoting` re-enables it, regardless of the value of this parameter.

To remove the local subnet restriction and enable remote access from all locations on public
networks, use the `Set-NetFirewallRule` cmdlet in the **NetSecurity** module.
Expand Down Expand Up @@ -184,8 +183,7 @@ Accept wildcard characters: False

### -WhatIf

Shows what would happen if the cmdlet runs.
The cmdlet is not run.
Shows what would happen if the cmdlet runs. The cmdlet isn't run.

```yaml
Type: System.Management.Automation.SwitchParameter
Expand All @@ -203,7 +201,8 @@ Accept wildcard characters: False

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose,
-WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
-WarningAction, and -WarningVariable. For more information, see
[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

Expand All @@ -219,42 +218,28 @@ This cmdlet returns strings that describe its results.

## NOTES

In PowerShell 3.0, `Enable-PSRemoting` creates the following firewall exceptions for
WS-Management communications.

On server versions of the Windows operating system, `Enable-PSRemoting` creates firewall rules
for private and domain networks that allow remote access, and creates a firewall rule for public
networks that allows remote access only from computers in the same local subnet.

On client versions of the Windows operating system, `Enable-PSRemoting` in PowerShell 3.0 creates
firewall rules for private and domain networks that allow unrestricted remote access. To create a
firewall rule for public networks that allows remote access from the same local subnet, use the
**SkipNetworkProfileCheck** parameter.

On client or server versions of the Windows operating system, to create a firewall rule for public
networks that removes the local subnet restriction and allows remote access , use the
`Set-NetFirewallRule` cmdlet in the NetSecurity module to run the following command:
`Set-NetFirewallRule -Name "WINRM-HTTP-In-TCP-PUBLIC" -RemoteAddress Any`
Starting in PowerShell 3.0, `Enable-PSRemoting` enables all session configurations by setting the
value of the **Enabled** property of all session configurations to `$True`.

In PowerShell 2.0, `Enable-PSRemoting` creates the following firewall exceptions for WS-Management
communications.
- On server versions of the Windows operating system, `Enable-PSRemoting` creates firewall rules for
private and domain networks that allow remote access, and creates a firewall rule for public
networks that allows remote access only from computers in the same local subnet.

On server versions of the Windows operating system, it creates firewall rules for all networks that
allow remote access.
- On client versions of the Windows operating system, `Enable-PSRemoting` in PowerShell 3.0 creates
firewall rules for private and domain networks that allow unrestricted remote access. To create a
firewall rule for public networks that allows remote access from the same local subnet, use the
**SkipNetworkProfileCheck** parameter.

On client versions of the Windows operating system, `Enable-PSRemoting` in PowerShell 2.0
creates a firewall exception only for domain and private network locations. To minimize security
risks, `Enable-PSRemoting` does not create a firewall rule for public networks on client versions
of Windows. When the current network location is public, `Enable-PSRemoting` returns the following
message: Unable to check the status of the firewall.
- On client or server versions of the Windows operating system, to create a firewall rule for public
networks that removes the local subnet restriction and allows remote access , use the
`Set-NetFirewallRule` cmdlet in the NetSecurity module to run the following command:
`Set-NetFirewallRule -Name "WINRM-HTTP-In-TCP-PUBLIC" -RemoteAddress Any`

Starting in PowerShell 3.0, `Enable-PSRemoting` enables all session configurations by setting the
value of the **Enabled** property of all session configurations to `$True`.
`Enable-PSRemoting` enables all session configurations by setting the value of the **Enabled**
property of all session configurations to `$True`.

In PowerShell 2.0, `Enable-PSRemoting` removes the **Deny_All** setting from the security
descriptor of session configurations. In PowerShell 3.0, `Enable-PSRemoting` removes the
**Deny_All** and **Network_Deny_All** settings. This provides remote access to session
configurations that were reserved for local use.
`Enable-PSRemoting` removes the **Deny_All** and **Network_Deny_All** settings. This provides remote
access to session configurations that were reserved for local use.

## RELATED LINKS

Expand Down
35 changes: 19 additions & 16 deletions reference/5.1/Microsoft.PowerShell.Utility/Add-Type.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml
Locale: en-US
Module Name: Microsoft.PowerShell.Utility
ms.date: 12/12/2022
ms.date: 11/25/2024
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/add-type?view=powershell-5.1&WT.mc_id=ps-gethelp
schema: 2.0.0
title: Add-Type
Expand Down Expand Up @@ -64,7 +64,7 @@ the class is available in all PowerShell sessions.

You can specify the type by specifying an existing assembly or source code files, or you can specify
the source code inline or saved in a variable. You can even specify only a method and `Add-Type`
will define and generate the class. On Windows, you can use this feature to make Platform Invoke
defines and generates the class. On Windows, you can use this feature to make Platform Invoke
(P/Invoke) calls to unmanaged functions in PowerShell. If you specify source code, `Add-Type`
compiles the specified source code and generates an in-memory assembly that contains the new .NET
Framework types.
Expand All @@ -77,7 +77,7 @@ the resulting assembly.

### Example 1: Add a .NET type to a session

This example adds the **BasicTest** class to the session by specifying source code that is stored in
This example adds the **BasicTest** class to the session by specifying source code that's stored in
a variable. The **BasicTest** class is used to add integers, create an object, and multiply
integers.

Expand Down Expand Up @@ -240,7 +240,7 @@ PowerShell console. The method takes two parameters: the window handle, and an i
specifies how the window is displayed.

To minimize the PowerShell console, `ShowWindowAsync` uses the `Get-Process` cmdlet with the `$PID`
automatic variable to get the process that is hosting the current PowerShell session. Then it uses
automatic variable to get the process that's hosting the current PowerShell session. Then it uses
the **MainWindowHandle** property of the current process and a value of `2`, which represents the
`SW_MINIMIZE` value.

Expand Down Expand Up @@ -484,7 +484,7 @@ Accept wildcard characters: False

### -MemberDefinition

Specifies new properties or methods for the class. `Add-Type` generates the template code that is
Specifies new properties or methods for the class. `Add-Type` generates the template code that's
required to support the properties or methods.

On Windows, you can use this feature to make Platform Invoke (P/Invoke) calls to unmanaged functions
Expand Down Expand Up @@ -525,12 +525,10 @@ Accept wildcard characters: False

### -Namespace

Specifies a namespace for the type.

If this parameter isn't included in the command, the type is created in the
**Microsoft.PowerShell.Commands.AddType.AutoGeneratedTypes** namespace. If the parameter is included
in the command with an empty string value or a value of `$Null`, the type is generated in the global
namespace.
By default, this command creates the type in the
**Microsoft.PowerShell.Commands.AddType.AutoGeneratedTypes** namespace. When you use this parameter,
the type is created in the specified namespace. If the value an empty string, the type is created in
the global namespace.

```yaml
Type: System.String
Expand All @@ -548,7 +546,8 @@ Accept wildcard characters: False

Generates a DLL file for the assembly with the specified name in the location. Enter an optional
path and filename. Wildcard characters are permitted. By default, `Add-Type` generates the assembly
only in memory.
only in memory. If you output the assembly to a file you should include the **PassThru** parameter
to return the type from the newly created assembly.

```yaml
Type: System.String
Expand All @@ -566,7 +565,8 @@ Accept wildcard characters: True

Specifies the output type of the output assembly. By default, no output type is specified. This
parameter is valid only when an output assembly is specified in the command. For more information
about the values, see [OutputAssemblyType Enumeration](/dotnet/api/microsoft.powershell.commands.outputassemblytype).
about the values, see
[OutputAssemblyType Enumeration](/dotnet/api/microsoft.powershell.commands.outputassemblytype).

The acceptable values for this parameter are as follows:

Expand All @@ -590,7 +590,8 @@ Accept wildcard characters: False
### -PassThru

Returns a **System.Runtime** object that represents the types that were added. By default, this
cmdlet doesn't generate any output.
cmdlet doesn't generate any output. Use this parameter if you used **OutputAssembly** to create a
DLL file and you want to return the type from the newly created assembly.

```yaml
Type: System.Management.Automation.SwitchParameter
Expand Down Expand Up @@ -697,7 +698,8 @@ Accept wildcard characters: False

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose,
-WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
-WarningAction, and -WarningVariable. For more information, see
[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

Expand All @@ -719,7 +721,8 @@ the new type.
## NOTES

The types that you add exist only in the current session. To use the types in all sessions, add them
to your PowerShell profile. For more information about the profile, see [about_Profiles](../Microsoft.PowerShell.Core/About/about_Profiles.md).
to your PowerShell profile. For more information about the profile, see
[about_Profiles](../Microsoft.PowerShell.Core/About/about_Profiles.md).

Type names and namespaces must be unique within a session. You can't unload a type or change it. If
you need to change the code for a type, you must change the name or start a new PowerShell session.
Expand Down
18 changes: 11 additions & 7 deletions reference/7.4/Microsoft.PowerShell.Core/Enable-PSRemoting.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
external help file: System.Management.Automation.dll-Help.xml
Locale: en-US
Module Name: Microsoft.PowerShell.Core
ms.date: 10/06/2023
ms.date: 11/25/2024
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/enable-psremoting?view=powershell-7.4&WT.mc_id=ps-gethelp
schema: 2.0.0
title: Enable-PSRemoting
Expand Down Expand Up @@ -31,9 +31,9 @@ PowerShell remoting is enabled by default on Windows Server platforms. You can u
`Enable-PSRemoting` to enable PowerShell remoting on other supported versions of Windows and to
re-enable remoting if it becomes disabled.

You have to run this command only one time on each computer that will receive commands. You do not
have to run it on computers that only send commands. Because the configuration starts listeners to
accept remote connections, it is prudent to run it only where it is needed.
You need to run this command only one time on each computer that receive commands. You don't need to
run it on computers that only send commands. Because the configuration starts listeners, it's
prudent to run it only where it's needed.

Enabling PowerShell remoting on client versions of Windows when the computer is on a public network
is normally disallowed, but you can skip this restriction by using the **SkipNetworkProfileCheck**
Expand Down Expand Up @@ -81,6 +81,11 @@ option. This cmdlet is not available on Linux or MacOS versions of PowerShell.
> disable PowerShell remoting endpoints that are hosted by Windows PowerShell, run the
> `Enable-PSRemoting` cmdlet from within a Windows PowerShell session.

For more information about using PowerShell remoting, see the following articles:

- [about_Remote_Requirements](about/about_Remote_Requirements.md)
- [about_Remote](about/about_Remote.md)

## EXAMPLES

### Example 1: Configure a computer to receive remote commands
Expand Down Expand Up @@ -237,7 +242,7 @@ Indicates that this cmdlet enables remoting on client versions of the Windows op
the computer is on a public network. This parameter enables a firewall rule for public networks that
allows remote access only from computers in the same local subnet.

This parameter does not affect server versions of the Windows operating system, which, by default,
This parameter doesn't affect server versions of the Windows operating system, which, by default,
have a local subnet firewall rule for public networks. If the local subnet firewall rule is disabled
on a server version, `Enable-PSRemoting` re-enables it, regardless of the value of this parameter.

Expand Down Expand Up @@ -276,8 +281,7 @@ Accept wildcard characters: False

### -WhatIf

Shows what would happen if the cmdlet runs.
The cmdlet is not run.
Shows what would happen if the cmdlet runs. The cmdlet isn't run.

```yaml
Type: System.Management.Automation.SwitchParameter
Expand Down
Loading