Files
PSProxmox/docs/cmdlets/Connect-ProxmoxServer.md
T
2025-04-28 14:59:49 -04:00

5.9 KiB

Connect-ProxmoxServer

Connects to a Proxmox VE server.

Syntax

Connect-ProxmoxServer
   -Server <String>
   -Username <String>
   -Password <SecureString>
   [-Realm <String>]
   [-Port <Int32>]
   [-UseSSL <Boolean>]
   [-SkipCertificateValidation <Boolean>]
   [-Timeout <Int32>]
   [<CommonParameters>]
Connect-ProxmoxServer
   -Server <String>
   -Credential <PSCredential>
   [-Realm <String>]
   [-Port <Int32>]
   [-UseSSL <Boolean>]
   [-SkipCertificateValidation <Boolean>]
   [-Timeout <Int32>]
   [<CommonParameters>]
Connect-ProxmoxServer
   -Server <String>
   -ApiToken <String>
   -ApiTokenSecret <SecureString>
   [-Port <Int32>]
   [-UseSSL <Boolean>]
   [-SkipCertificateValidation <Boolean>]
   [-Timeout <Int32>]
   [<CommonParameters>]

Description

The Connect-ProxmoxServer cmdlet establishes a connection to a Proxmox VE server. This connection is required for all other cmdlets in the PSProxmox module.

Parameters

-Server

The hostname or IP address of the Proxmox VE server.

Type: String
Parameter Sets: (All)
Aliases:

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

-Username

The username to use for authentication.

Type: String
Parameter Sets: UsernamePassword
Aliases:

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

-Password

The password to use for authentication.

Type: SecureString
Parameter Sets: UsernamePassword
Aliases:

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

-Credential

The credential object to use for authentication.

Type: PSCredential
Parameter Sets: Credential
Aliases:

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

-ApiToken

The API token to use for authentication.

Type: String
Parameter Sets: ApiToken
Aliases:

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

-ApiTokenSecret

The API token secret to use for authentication.

Type: SecureString
Parameter Sets: ApiToken
Aliases:

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

-Realm

The authentication realm to use. Default is "pam".

Type: String
Parameter Sets: UsernamePassword, Credential
Aliases:

Required: False
Position: Named
Default value: pam
Accept pipeline input: False
Accept wildcard characters: False

-Port

The port to use for the connection. Default is 8006.

Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: 8006
Accept pipeline input: False
Accept wildcard characters: False

-UseSSL

Whether to use SSL for the connection. Default is $true.

Type: Boolean
Parameter Sets: (All)
Aliases:

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

-SkipCertificateValidation

Whether to skip SSL certificate validation. Default is $false.

Type: Boolean
Parameter Sets: (All)
Aliases:

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

-Timeout

The timeout in seconds for the connection. Default is 30.

Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: 30
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

None

Outputs

PSProxmox.Session.ProxmoxConnection

Notes

  • This cmdlet must be called before using any other cmdlets in the PSProxmox module.
  • The connection object is returned and should be stored in a variable for use with other cmdlets.
  • If you use the -SkipCertificateValidation parameter, the SSL certificate validation will be skipped, which is not recommended for production environments.

Examples

Example 1: Connect to a Proxmox VE server using username and password

$securePassword = ConvertTo-SecureString "password" -AsPlainText -Force
$connection = Connect-ProxmoxServer -Server "proxmox.example.com" -Username "root" -Password $securePassword -Realm "pam"

This example connects to a Proxmox VE server using a username and password.

Example 2: Connect to a Proxmox VE server using a credential object

$credential = Get-Credential
$connection = Connect-ProxmoxServer -Server "proxmox.example.com" -Credential $credential -Realm "pam"

This example connects to a Proxmox VE server using a credential object.

Example 3: Connect to a Proxmox VE server using an API token

$secureSecret = ConvertTo-SecureString "secret" -AsPlainText -Force
$connection = Connect-ProxmoxServer -Server "proxmox.example.com" -ApiToken "root@pam!token" -ApiTokenSecret $secureSecret

This example connects to a Proxmox VE server using an API token.

Example 4: Connect to a Proxmox VE server with SSL certificate validation disabled

$securePassword = ConvertTo-SecureString "password" -AsPlainText -Force
$connection = Connect-ProxmoxServer -Server "proxmox.example.com" -Username "root" -Password $securePassword -Realm "pam" -SkipCertificateValidation $true

This example connects to a Proxmox VE server with SSL certificate validation disabled.