Skip to content

Revert "Replace Windows PowerShell with PowerShell" #2780

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 6, 2018
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
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ continue to run while the session is disconnected.

The Disconnected Sessions feature is available only when the computer at the
remote end of a connection is running Windows PowerShell 3.0 or a later
version of Windows PowerShell and using the WSMan transport.
version of Windows PowerShell.

The Disconnected Sessions feature allows you to close the session in which a
PSSession was created, and even close Windows PowerShell, and shut down the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,7 @@ supported versions of Windows, you must change the security descriptors of the
session configurations to allow remote access.

To enable remote access to the session configurations on the computer, use the
Enable-PSRemoting cmdlet. This cmdlet creates two session configurations:
- with the name defined as: "PowerShell." + "current PowerShell version"
- with name "PowerShell.6", untied to any specific PowerShell version.
Enable-PSRemoting cmdlet.

Also, by default, only members of the Administrators group on the computer
have Execute permission to the default session configurations, but you can
Expand Down
11 changes: 1 addition & 10 deletions reference/6/Microsoft.PowerShell.Core/About/about_pwsh.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ pwsh[.exe]
[-NoProfile]
[-OutputFormat {Text | XML}]
[-WindowStyle <style>]
[-WorkingDirectory <DirectoryPath>]
[-File <FilePath> [<Args>]]
[-Command { - | <script-block> [-args <arg-array>]
| <string> [<CommandParameters>] } ]
Expand Down Expand Up @@ -108,13 +107,6 @@ Determines how output from PowerShell is formatted. Valid values are "Text"
Sets the window style for the session. Valid values are Normal, Minimized,
Maximized and Hidden.

#### -WorkingDirectory <DirectoryPath>

Sets the initial working directory when starting PowerShell. Any valid
PowerShell file path is supported.

To start PowerShell in your home directory, use: pwsh -WorkingDirectory ~

#### -Command

Executes the specified commands (and any parameters) as though they were typed
Expand Down Expand Up @@ -154,9 +146,8 @@ pwsh -Version
# Example using a script block
pwsh -Command {Get-Command -Name Get-Item}

# Examples using a string
# Example using a string
pwsh -Command "Get-Command -Name Get-Item"
pwsh -Command "& {Get-Command -Name Get-Command}"

# Example using a command as the last parameter
pwsh -Command Get-Command -Name Get-Item
Expand Down
2 changes: 0 additions & 2 deletions reference/6/Microsoft.PowerShell.Core/Disconnect-PSSession.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ The **Disconnect-PSSession** cmdlet disconnects a Windows PowerShell session (**
As a result, the **PSSession** is in a disconnected state.
You can connect to the disconnected **PSSession** from the current session or from another session on the local computer or a different computer.

Note that this capability only works with PSSessions using the WSMan transport.

The **Disconnect-PSSession** cmdlet disconnects only open **PSSessions** that are connected to the current session.
**Disconnect-PSSession** cannot disconnect broken or closed **PSSession** objects, or interactive **PSSession** objects started by using the Enter-PSSession cmdlet, and it cannot disconnect **PSSession** objects that are connected to other sessions.

Expand Down
35 changes: 3 additions & 32 deletions reference/6/Microsoft.PowerShell.Core/Enter-PSSession.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ Enter-PSSession -ContainerId <String> [-ConfigurationName <String>] [-RunAsAdmin

### HostName
```
Enter-PSSession [-HostName] <string> [-Port <int>] [-UserName <string>] [-KeyFilePath <string>] [-SSHTransport]
[-Subsystem <String>] [<CommonParameters>]
Enter-PSSession [-HostName] <string> [-Port <int>] [-UserName <string>] [-KeyFilePath <string>] [-SSHTransport] [<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -155,14 +154,14 @@ You can also use the **Exit** keyword to end the interactive session.

### Example 6: Start an interactive session using SSH
```
PS C:\> Enter-PSSession -HostName UserA@LinuxServer01
PS C:\> Enter-PSSession -HostName LinuxServer01 -UserName UserA
```

This example shows how to start an interactive session using Secure Shell (SSH). If SSH is configured on the remote computer to prompt for passwords then you will get a password prompt. Otherwise you will have to use SSH key based user authentication.

### Example 7: Start an interactive session using SSH and specify the Port and user authentication key
```
PS C:\> Enter-PSSession -HostName UserA@LinuxServer02:22 -KeyFilePath c:\<path>\userAKey_rsa
PS C:\> Enter-PSSession -HostName LinuxServer02 -UserName UserA -Port 22 -KeyFilePath c:\<path>\userAKey_rsa
```

This example shows how to start an interactive session using SSH. It uses the *Port* parameter to specify the port to use and the *KeyFilePath* parameter to specify an RSA key used to authenticate the user on the remote computer.
Expand Down Expand Up @@ -305,9 +304,6 @@ Specifies the session configuration that is used for the interactive session.
Enter a configuration name or the fully qualified resource URI for a session configuration.
If you specify only the configuration name, the following schema URI is prepended: http://schemas.microsoft.com/powershell.

When used with SSH, this specifies the subsystem to use on the target as defined in sshd_config.
The default value for SSH is the `powershell` subsystem.

The session configuration for a session is located on the remote computer.
If the specified session configuration does not exist on the remote computer, the command fails.

Expand Down Expand Up @@ -423,10 +419,6 @@ Accept wildcard characters: False
### -HostName
Specifies a computer name for a Secure Shell (SSH) based connection.
This is similar to the *ComputerName* parameter except that the connection to the remote computer is made using SSH rather than Windows WinRM.
This parameter supports specifying the user name and/or port as part of the host name parameter value using
the form `user@hostname:port`.
The user name and/or port specified as part of the host name takes precedence over the `-UserName` and `-Port` parameters, if specified.
This allows passing multiple computer names to this parameter where some have specific user names and/or ports, while others use the user name and/or port from the `-UserName` and `-Port` parameters.

This parameter was introduced in PowerShell 6.0.

Expand Down Expand Up @@ -629,27 +621,6 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -Subsystem
Specifies the SSH subsystem used for the new **PSSession**.

This specifies the subsystem to use on the target as defined in sshd_config.
The subsystem starts a specific version of PowerShell with predefined parameters.
If the specified subsystem does not exist on the remote computer, the command fails.

If this parameter is not used, the default is the 'powershell' subsystem.

```yaml
Type: String
Parameter Sets: HostName
Aliases:

Required: False
Position: Named
Default value: powershell
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -UserName
Specifies the user name for the account used to create a session on the remote computer. User authentication method will depend on how Secure Shell (SSH) is configured on the remote computer.

Expand Down
43 changes: 7 additions & 36 deletions reference/6/Microsoft.PowerShell.Core/Invoke-Command.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ Invoke-Command [-ConfigurationName <String>] [-ThrottleLimit <Int32>] [-AsJob] [

### HostName
```
Invoke-Command [-Subsystem <String>] -ScriptBlock <scriptblock> -HostName <string[]> [-Port <int>]
[-AsJob] [-HideComputerName] [-UserName <string>] [-KeyFilePath <string>] [-SSHTransport] [-RemoteDebug]
[-InputObject <psobject>] [-ArgumentList <Object[]>] [<CommonParameters>]
Invoke-Command -ScriptBlock <scriptblock> -HostName <string[]> [-Port <int>] [-AsJob]
[-HideComputerName] [-UserName <string>] [-KeyFilePath <string>] [-SSHTransport] [-RemoteDebug]
[-InputObject <psobject>] [-ArgumentList <Object[]>] [<CommonParameters>]
```

### FilePathHostName
Expand Down Expand Up @@ -491,21 +491,21 @@ To get the results of commands and scripts that run in disconnected sessions, us

### Example 17: Run a command on a remote computer using SSH
```
PS C:\> Invoke-Command -HostName UserA@LinuxServer01 -ScriptBlock { Get-MailBox * }
PS C:\> Invoke-Command -HostName LinuxServer01 -UserName UserA -ScriptBlock { Get-MailBox * }
```

This example shows how to run a command on a remote computer using Secure Shell (SSH). If SSH is configured on the remote computer to prompt for passwords then you will get a password prompt. Otherwise you will have to use SSH key based user authentication.

### Example 18: Run a command on a remote computer using SSH and specify a user authentication key
```
PS C:\> Invoke-Command -HostName UserA@LinuxServer01 -ScriptBlock { Get-MailBox * } -KeyFilePath c:\<path>\userAKey_rsa
PS C:\> Invoke-Command -HostName LinuxServer01 -UserName UserA -ScriptBlock { Get-MailBox * } -KeyFilePath c:\<path>\userAKey_rsa
```

This example shows how to run a command on a remote computer using SSH and specifying a key file for user authentication. You will not get a password prompt unless the key authentication fails and the remote computer is configured to allow basic password authentication.

### Example 19: Run a script file on multiple remote computers using SSH as a job
```
PS C:\> $sshConnections = @{ HostName="WinServer1"; UserName="domain\userA"; KeyFilePath="c:\users\UserA\id_rsa" }, @{ HostName="UserB@LinuxServer5"; KeyFilePath="c:\UserB\<path>\id_rsa }
PS C:\> $sshConnections = @{ HostName="WinServer1"; UserName="domain\userA"; KeyFilePath="c:\users\UserA\id_rsa" }, @{ HostName="LinuxServer5"; UserName="UserB"; KeyFilePath="c:\UserB\<path>\id_rsa }
PS C:\> $results = Invoke-Command -FilePath c:\Scripts\CollectEvents.ps1 -SSHConnection $sshConnections
```

Expand Down Expand Up @@ -703,9 +703,6 @@ Specifies the session configuration that is used for the new **PSSession**.
Enter a configuration name or the fully qualified resource URI for a session configuration.
If you specify only the configuration name, the following schema URI is prepended: http://schemas.microsoft.com/PowerShell.

When used with SSH, this specifies the subsystem to use on the target as defined in sshd_config.
The default value for SSH is the `powershell` subsystem.

The session configuration for a session is located on the remote computer.
If the specified session configuration does not exist on the remote computer, the command fails.

Expand Down Expand Up @@ -1171,10 +1168,6 @@ Accept wildcard characters: False

### -HostName
Specifies an array of computer names for a Secure Shell (SSH) based connection. This is similar to the ComputerName parameter except that the connection to the remote computer is made using SSH rather than Windows WinRM.
This parameter supports specifying the user name and/or port as part of the host name parameter value using
the form `user@hostname:port`.
The user name and/or port specified as part of the host name takes precedence over the `-UserName` and `-Port` parameters, if specified.
This allows passing multiple computer names to this parameter where some have specific user names and/or ports, while others use the user name and/or port from the `-UserName` and `-Port` parameters.

This parameter was introduced in PowerShell 6.0.

Expand Down Expand Up @@ -1228,27 +1221,6 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -Subsystem
Specifies the SSH subsystem used for the new **PSSession**.

This specifies the subsystem to use on the target as defined in sshd_config.
The subsystem starts a specific version of PowerShell with predefined parameters.
If the specified subsystem does not exist on the remote computer, the command fails.

If this parameter is not used, the default is the 'powershell' subsystem.

```yaml
Type: String
Parameter Sets: HostName
Aliases:

Required: False
Position: Named
Default value: powershell
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -UserName
Specifies the user name for the account used to run a command on the remote computer. User authentication method will depend on how Secure Shell (SSH) is configured on the remote computer.

Expand All @@ -1273,10 +1245,9 @@ Accept wildcard characters: False
```

### -SSHConnection
This parameter takes an array of hashtables where each hashtable contains one or more connection parameters needed to establish a Secure Shell (SSH) connection (HostName, Port, UserName, KeyFilePath, Subsystem).
This parameter takes an array of hashtables where each hashtable contains one or more connection parameters needed to establish a Secure Shell (SSH) connection (HostName, Port, UserName, KeyFilePath).

The hashtable connection parameters are the same as defined for the HostName parameter set.
Note that the order of the keys in the hashtable result in user name and port being used for the connection where the last one specified is used. For example, if you use `@{UserName="first";HostName="second@host"}`, then the user name `second` will be used. However, if you use `@{HostName="second@host:22";Port=23}`, then port 23 will be used.

The SSHConnection parameter is useful for creating multiple sessions where each session requires different connection information.

Expand Down
9 changes: 3 additions & 6 deletions reference/6/Microsoft.PowerShell.Core/New-PSSession.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,21 +215,21 @@ The value of the SessionOption parameter is the **SessionOption** object in the

### Example 12: Create a session using SSH
```
PS C:\> New-PSSession -HostName UserA@LinuxServer01
PS C:\> New-PSSession -HostName LinuxServer01 -UserName UserA
```

This example shows how to create a new **PSSession** using Secure Shell (SSH). If SSH is configured on the remote computer to prompt for passwords then you will get a password prompt. Otherwise you will have to use SSH key based user authentication.

### Example 13: Create a session using SSH and specify the port and user authentication key
```
PS C:\> New-PSSession -HostName UserA@LinuxServer01:22 -KeyFilePath c:\<path>\userAKey_rsa
PS C:\> New-PSSession -HostName LinuxServer01 -UserName UserA -Port 22 -KeyFilePath c:\<path>\userAKey_rsa
```

This example shows how to create a **PSSession** using Secure Shell (SSH). It uses the *Port* parameter to specify the port to use and the *KeyFilePath* parameter to specify an RSA key used to identify and authenticate the user on the remote computer.

### Example 14: Create multiple sessions using SSH
```
PS C:\> $sshConnections = @{ HostName="WinServer1"; UserName="domain\userA"; KeyFilePath="c:\users\UserA\id_rsa" }, @{ HostName="UserB@LinuxServer5"; KeyFilePath="c:\UserB\<path>\id_rsa }
PS C:\> $sshConnections = @{ HostName="WinServer1"; UserName="domain\userA"; KeyFilePath="c:\users\UserA\id_rsa" }, @{ HostName="LinuxServer5"; UserName="UserB"; KeyFilePath="c:\UserB\<path>\id_rsa }
PS C:\> New-PSSession -SSHConnection $sshConnections
```

Expand Down Expand Up @@ -372,9 +372,6 @@ Specifies the session configuration that is used for the new **PSSession**.
Enter a configuration name or the fully qualified resource URI for a session configuration.
If you specify only the configuration name, the following schema URI is prepended: http://schemas.microsoft.com/PowerShell.

When used with SSH, this specifies the subsystem to use on the target as defined in sshd_config.
The default value for SSH is the `powershell` subsystem.

The session configuration for a session is located on the remote computer.
If the specified session configuration does not exist on the remote computer, the command fails.

Expand Down
2 changes: 1 addition & 1 deletion reference/6/Microsoft.PowerShell.Core/Save-Help.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ Do not specify a file name or file name extension.
```yaml
Type: String[]
Parameter Sets: Path
Aliases: Path
Aliases:

Required: True
Position: 0
Expand Down
2 changes: 1 addition & 1 deletion reference/6/Microsoft.PowerShell.Core/Update-Help.md
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ For more information, see about_Group_Policy_Settings (http://go.microsoft.com/f
```yaml
Type: String[]
Parameter Sets: Path
Aliases: Path
Aliases:

Required: False
Position: 1
Expand Down
24 changes: 0 additions & 24 deletions reference/6/Microsoft.PowerShell.Core/Where-Object.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ Selects objects from a collection based on their property values.
Where-Object [-InputObject <PSObject>] [-Property] <String> [[-Value] <Object>] [-EQ] [<CommonParameters>]
```

### NotSet
```
Where-Object [-Property] <string> -Not [-InputObject <psobject>] [<CommonParameters>]
```

### ScriptBlockSet

```
Expand Down Expand Up @@ -929,25 +924,6 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -Not
Indicates that this cmdlet gets objects if the property does not exist or has a value of null or false.

For example: `Get-Service | where -Not "DependentServices"`

This parameter was introduced in Windows PowerShell 6.1.

```yaml
Type: SwitchParameter
Parameter Sets: Not
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -NotContains

Indicates that this cmdlet gets objects if none of the items in the property value is an exact match for the specified value.
Expand Down
2 changes: 1 addition & 1 deletion reference/6/Microsoft.PowerShell.Management/New-Service.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ This parameter is required.
```yaml
Type: String
Parameter Sets: (All)
Aliases: Path
Aliases:

Required: True
Position: 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ If you specify only a file name, use the *WorkingDirectory* parameter to specify
```yaml
Type: String
Parameter Sets: (All)
Aliases: PSPath, Path
Aliases: PSPath

Required: True
Position: 1
Expand Down
Loading