For the complete documentation index, see llms.txt. This page is also available as Markdown.

New-RDMSSHKey

Synopsis

Create an SSH key.

Syntax

Private

New-RDMSSHKey [-Algorithm] <string> -Format <string> [-Comment <string>] [-SavePrivateKey <string>]
 [-Size <int>] [-ForcePromptAnswer <DialogResult[]>] [<CommonParameters>]

EncryptedPrivate

New-RDMSSHKey [-Algorithm] <string> -Format <string> -Passphrase <securestring> [-Comment <string>]
 [-SavePrivateKey <string>] [-Size <int>] [-ForcePromptAnswer <DialogResult[]>] [<CommonParameters>]

Public

New-RDMSSHKey [-Algorithm] <string> [-Comment <string>] [-SavePublicKey <string>] [-Size <int>]
 [-ForcePromptAnswer <DialogResult[]>] [<CommonParameters>]

Description

Create an SSH key. The public key will be returned. There is also the possiblity the save a public or private key file. A passphrase can be used to protect the private key file. In both cases, an existing file will be overwritten.

Examples

Example 1

Create an SSH public key of 2048 bits using RSA and of format is Putty. The resulting key ends with the comment (username@hostname).

Example 2

Create an SSH public key of 256 bits using ECDSA with the comment username@hostname. The key is saved in the file C:\mypath\sshPublicKey.pub. If the file exists, it will be overwritten.

Example 3

First, the password used to encrypt the file is generated from the input of the user. Create an SSH private key of 521 bits using ECDSA with an empty comment. The key is saved in the file C:\mypath\sshPrivateKey.pri. The format used is PKCS8 with encryption SHA1_RC4_128 and 64 rounds. If the passphrase used is empty, no encryption will occur.

Example 4

Create an SSH private key of 521 bits using ECDSA with the comment username@hostname. The key is saved in the file C:\mypath\sshPrivateKey.pri and is not encrypted.

Parameters

-Algorithm

The algorithm used to generate the SSH key.

-Comment

The comment at the end of a public key. No space allowed.

-ForcePromptAnswer

Switch to use with caution. It will automatically answer prompt asking yes/no, yes/no/cancel, or ok/cancel questions. In case of multiple prompts, multiple values can be passed to this parameter. Here are the accepted values:

  • Yes: Accept the prompt. Cover the OK and Automatic value.

  • No: Refuse the yes/no/cancel prompt. "Cancel" is the fallback option if there is no "No" option.

  • Cancel: Cancel the yes/no/cancel prompt. "No" is the fallback option if there is no "Cancel" option.

-Format

The format used to store the private key.

-Passphrase

Passphrase used to protected the private key file. An empty SecureString is accepted, meaning no encryption will occur.

-SavePrivateKey

Save the private key in a file at the specified path. The supported extensions are: PKCS#1/OpenSSL (.key), PKCS#8 (.pri) and PuTTY (*ppk)

-SavePublicKey

Save the public key in a file at the specified path. The supported extension is (*.pub).

-Size

The number of bits in the key for RSA and ECDSA algorithms. For RSA, the default value is 2048 and the valid values are: 1024, 2048, 3072, 4096, 6144 and 8192. For ECDSA, the default value is 256 and the valid values are: 256, 384 and 521.

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

Notes

For more information, type "Get-Help New-RDMSSHKey -detailed". For technical information, type "Get-Help New-RDMSSHKey -full".

Last updated

Was this helpful?