< Back
Configure-PwshRemoting
Post
NAME Configure-PwshRemoting
SYNOPSIS
This function does the following to a Remote Host:
- Installs the latest version of PowerShell Core using the Remote Host's Package Management system
- Configures sshd on the Remote Host to use pwsh by default
- If the Remote Host is Linux, removes the default setting that causes a password prompt when a sudoer uses runs
'sudo pwsh'
SYNTAX
Configure-PwshRemoting [-RemoteOSGuess <String>] -RemoteHostNameOrIP <String> -LocalUserName <String>
[-LocalPasswordSS <SecureString>] [-KeyFilePath <String>] [-DomainUserForNoSudoPwd <String[]>]
[-LocalUserForNoSudoPwd <String[]>] [<CommonParameters>]
Configure-PwshRemoting [-RemoteOSGuess <String>] -RemoteHostNameOrIP <String> -DomainUserName <String>
[-DomainPasswordSS <SecureString>] [-KeyFilePath <String>] [-DomainUserForNoSudoPwd <String[]>]
[-DomainGroupForNoSudoPwd <String[]>] [<CommonParameters>]
DESCRIPTION
See SYNOPSIS
PARAMETERS
-RemoteOSGuess <String>
This parameter is OPTIONAL.
This parameter takes a string (either "Windows" or "Linux") that represents the type of platform you
anticipate the
Remote Host is running. The default value for this parameter is "Windows".
IMPORTANT NOTE: If you specify "Linux" and it turns out that the Remote Host is running Windows, this function
will fail.
So, if you're not sure, leave the default value "Windows".
Required? false
Position? named
Default value Windows
Accept pipeline input? false
Accept wildcard characters? false
-RemoteHostNameOrIP <String>
This parameter is MANDATORY.
This parameter takes a string that represents the DNS-resolvable HostName/FQDN or IPv4 Address of the target
Remote Host
Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-LocalUserName <String>
This parameter is MANDATORY for the Parameter Set 'Local'.
This parameter takes a string that represents the Local User Account on the Remote Host that you are using to
ssh into
the Remote Host. This string must be in format: <RemoteHostName>\\<UserName>
Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-DomainUserName <String>
This parameter is MANDATORY for the Parameter Set 'Domain'.
This parameter takes a string that represents the Domain User Account on the Remote Host that you are using to
ssh into
the Remote Host. This string must be in format: <DomainShortName>\\<UserName>
Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-LocalPasswordSS <SecureString>
This parameter is OPTIONAL. (However, either -LocalPasswordSS or -KeyFilePath is mandatory for the 'Domain'
Parameter Set)
This parameter takes a securestring that represents the password for the -LocalUserName you are using to ssh
into the
Remote Host.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-DomainPasswordSS <SecureString>
This parameter is OPTIONAL. (However, either -DomainPasswordSS or -KeyFilePath is mandatory for the 'Domain'
Parameter Set)
This parameter takes a securestring that represents the password for the -DomainUserName you are using to ssh
into the
Remote Host.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-KeyFilePath <String>
This parameter is OPTIONAL. (However, either -DomainPasswordSS, -LocalPasswordSS, or -KeyFilePath is required)
This parameter takes a string that represents the full path to the Key File you are using to ssh into the
Remote Host.
Use this parameter instead of -LocalPasswordSS or -DomainPasswordSS.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-DomainUserForNoSudoPwd <String[]>
This parameter is OPTIONAL.
This parameter takes a string or array of strings that represent Domain Users that you would like to allow to
use
'sudo pwsh' without a password prompt. Each user must be in format: <DomainShortName>\\<UserName>
Only applies to Linux Remote Hosts.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-LocalUserForNoSudoPwd <String[]>
This parameter is OPTIONAL.
This parameter takes a string or array of strings that represent Local Users on the Remote Host that you would
like to
allow to use 'sudo pwsh' without a password prompt. Each user must be in format: <RemoteHostName>\\<UserName>
Only applies to Linux Remote Hosts.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-DomainGroupForNoSudoPwd <String[]>
This parameter is OPTIONAL.
This parameter takes a string or array of strings that represent Domain Groups that you would like to allow to
use
'sudo pwsh' without a password prompt.
Only applies to Linux Remote Hosts.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
-------------------------- EXAMPLE 1 --------------------------
PS C:\\># Minimal parameters...
$ConfigurePwshRemotingSplatParams = @{
RemoteHostNameOrIP = "192.168.2.61"
LocalUserName = "centos7x\\vagrant"
LocalPasswordSS = $(Read-Host -Prompt "Enter password" -AsSecureString)
}
$ConfigurePwshRemotingResult = Configure-PwshRemoting @ConfigurePwshRemotingSplatParams
RELATED LINKS
SYNOPSIS
This function does the following to a Remote Host:
- Installs the latest version of PowerShell Core using the Remote Host's Package Management system
- Configures sshd on the Remote Host to use pwsh by default
- If the Remote Host is Linux, removes the default setting that causes a password prompt when a sudoer uses runs
'sudo pwsh'
SYNTAX
Configure-PwshRemoting [-RemoteOSGuess <String>] -RemoteHostNameOrIP <String> -LocalUserName <String>
[-LocalPasswordSS <SecureString>] [-KeyFilePath <String>] [-DomainUserForNoSudoPwd <String[]>]
[-LocalUserForNoSudoPwd <String[]>] [<CommonParameters>]
Configure-PwshRemoting [-RemoteOSGuess <String>] -RemoteHostNameOrIP <String> -DomainUserName <String>
[-DomainPasswordSS <SecureString>] [-KeyFilePath <String>] [-DomainUserForNoSudoPwd <String[]>]
[-DomainGroupForNoSudoPwd <String[]>] [<CommonParameters>]
DESCRIPTION
See SYNOPSIS
PARAMETERS
-RemoteOSGuess <String>
This parameter is OPTIONAL.
This parameter takes a string (either "Windows" or "Linux") that represents the type of platform you
anticipate the
Remote Host is running. The default value for this parameter is "Windows".
IMPORTANT NOTE: If you specify "Linux" and it turns out that the Remote Host is running Windows, this function
will fail.
So, if you're not sure, leave the default value "Windows".
Required? false
Position? named
Default value Windows
Accept pipeline input? false
Accept wildcard characters? false
-RemoteHostNameOrIP <String>
This parameter is MANDATORY.
This parameter takes a string that represents the DNS-resolvable HostName/FQDN or IPv4 Address of the target
Remote Host
Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-LocalUserName <String>
This parameter is MANDATORY for the Parameter Set 'Local'.
This parameter takes a string that represents the Local User Account on the Remote Host that you are using to
ssh into
the Remote Host. This string must be in format: <RemoteHostName>\\<UserName>
Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-DomainUserName <String>
This parameter is MANDATORY for the Parameter Set 'Domain'.
This parameter takes a string that represents the Domain User Account on the Remote Host that you are using to
ssh into
the Remote Host. This string must be in format: <DomainShortName>\\<UserName>
Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-LocalPasswordSS <SecureString>
This parameter is OPTIONAL. (However, either -LocalPasswordSS or -KeyFilePath is mandatory for the 'Domain'
Parameter Set)
This parameter takes a securestring that represents the password for the -LocalUserName you are using to ssh
into the
Remote Host.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-DomainPasswordSS <SecureString>
This parameter is OPTIONAL. (However, either -DomainPasswordSS or -KeyFilePath is mandatory for the 'Domain'
Parameter Set)
This parameter takes a securestring that represents the password for the -DomainUserName you are using to ssh
into the
Remote Host.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-KeyFilePath <String>
This parameter is OPTIONAL. (However, either -DomainPasswordSS, -LocalPasswordSS, or -KeyFilePath is required)
This parameter takes a string that represents the full path to the Key File you are using to ssh into the
Remote Host.
Use this parameter instead of -LocalPasswordSS or -DomainPasswordSS.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-DomainUserForNoSudoPwd <String[]>
This parameter is OPTIONAL.
This parameter takes a string or array of strings that represent Domain Users that you would like to allow to
use
'sudo pwsh' without a password prompt. Each user must be in format: <DomainShortName>\\<UserName>
Only applies to Linux Remote Hosts.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-LocalUserForNoSudoPwd <String[]>
This parameter is OPTIONAL.
This parameter takes a string or array of strings that represent Local Users on the Remote Host that you would
like to
allow to use 'sudo pwsh' without a password prompt. Each user must be in format: <RemoteHostName>\\<UserName>
Only applies to Linux Remote Hosts.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-DomainGroupForNoSudoPwd <String[]>
This parameter is OPTIONAL.
This parameter takes a string or array of strings that represent Domain Groups that you would like to allow to
use
'sudo pwsh' without a password prompt.
Only applies to Linux Remote Hosts.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
-------------------------- EXAMPLE 1 --------------------------
PS C:\\># Minimal parameters...
$ConfigurePwshRemotingSplatParams = @{
RemoteHostNameOrIP = "192.168.2.61"
LocalUserName = "centos7x\\vagrant"
LocalPasswordSS = $(Read-Host -Prompt "Enter password" -AsSecureString)
}
$ConfigurePwshRemotingResult = Configure-PwshRemoting @ConfigurePwshRemotingSplatParams
RELATED LINKS