Get-SCXSSHCredential
Creates a privileged credential, by using the Secure Shell (SSH) protocol, for management operations on UNIX and Linux computers.
Syntax
Default (Default)
Get-SCXSSHCredential
[-UserName] <String>
[-SSHKey <String>]
[-ElevationType <String>]
[-SuppressWarning]
[<CommonParameters>]
Description
The Get-SCXSSHCredential cmdlet creates a credential for use in privileged UNIX or Linux SSH agent management operations.
Examples
Example 1: Create privileged credential
PS C:\>Get-SCXSSHCredential -UserName "root"
Password: *************
This command creates a privileged SSH credential with a user name and prompts for a password.
Example 2: Create privileged credential with su type
PS C:\>Get-SCXSSHCredential -UserName "DavidChew" -ElevationType su
Password: *************
Su Password: *************
This command creates a low-privileged credential with a user name and su elevation type. It then prompts for a password for the low-privileged account and the su password for the elevation.
Example 3: Create privileged credential with sudo type
PS C:\>Get-SCXSSHCredential -UserName "DavidChew" -ElevationType sudo
Password: *************
This command creates a credential with a low-privileged account with a user name and a sudo elevation type. It then prompts for a password for the low-privileged account.
Example 4: Create privileged credential with passphrase
PS C:\>Get-SCXSSHCredential -UserName "root" -SSHKey "C:\keys\admin.ppk"
Key Passphrase: *************
This command creates a privileged credential with a user name and an SSH key. It then prompts for a passphrase. If a passphrase was not configured with the SSH key, just press Enter.
Example 5: Create privileged credential with su and passphrase
PS C:\>Get-SCXSSHCredential -UserName "DavidChew" -SSHKey "C:\keys\DavidChew.ppk" -ElevationType su
Su Password: *************
Key Passphrase:
This command creates a low-privileged credential with a user name, an SSH key, and a su elevation type. It then prompts for the su password and a key passphrase.
Example 6: Create privileged credential with sudo and passphrase
C:\PS>Get-SCXSSHCredential -UserName "DavidChew" -SSHKey "C:\keys\DavidChew.ppk" -ElevationType sudo
Key Passphrase:
This command creates a low-privileged credential with a user name, an SSH key, and a sudo elevation type. It then prompts for a key passphrase.
Parameters
-ElevationType
Specifies the elevation method, either su
or sudo
, that elevates the supplied credential to a privileged account on the UNIX or Linux computer.
If left unspecified, the cmdlet treats the credential that is used to create the SSH connection as privileged.
If ElevationType is su, a root password must be provided for the SuPassword parameter.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-SSHKey
Specifies the file name, including its path, of an SSH key. The SSH key file must be in PuTTY key format. This parameter is required unless a password is specified.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-SuppressWarning
Indicates that this cmdlet suppresses warnings.
Parameter properties
Type: | SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-UserName
Specifies the user name for an SSH connection.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | 1 |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Outputs
Microsoft.Unix.SSHCredential
This cmdlet returns the SSHCredential object as output.