Code Monkey home page Code Monkey logo

cv4pve-api-powershell's Introduction

cv4pve-api-powershell

PowerShell Gallery Version download

ProxmoxVE Api

PowerShell Gallery

    ______                _                      __
   / ____/___  __________(_)___ _   _____  _____/ /_
  / /   / __ \/ ___/ ___/ / __ \ | / / _ \/ ___/ __/
 / /___/ /_/ / /  (__  ) / / / / |/ /  __(__  ) /_
 \____/\____/_/  /____/_/_/ /_/|___/\___/____/\__/

powerShell for Proxmox VE         (Made in Italy)

cv4pve-api-powershell is a part of suite cv4pve.
For more information visit https://www.corsinvest.it/cv4pve

๐Ÿ“ฐ Copyright

Copyright: Corsinvest Srl For licensing details please visit LICENSE

๐Ÿฆบ Commercial Support

This software is part of a suite of tools called cv4pve. If you want commercial support, visit the site

Introduction

PowerShell for Proxmox VE.

PowerShell for Proxmox VE

this is a CmdLet for PowerShell to manage Proxmox VE.

๐Ÿš€ Main features

  • Easy to learn
  • Set ResponseType json, png, extjs, html, text
  • Full class and method generated from documentation (about client)
  • Comment any method and parameters
  • Parameters indexed eg [n] is structured in array index and value
  • Return data Proxmox VE
  • Return result class more information PveResponse
    • Request
    • Response
    • Status
  • Utility
    • ConvertFrom-PveUnixTime
    • Wait-PveTaskIsFinish
    • Get-PveTaskIsRunning
    • Build-PveDocumentation
    • Get-PveVm (from id or name)
    • Unlock-PveVm (from id or name)
    • Start-PveVm (from id or name)
    • Stop-PveVm (from id or name)
    • Suspend-PveVm (from id or name)
    • Resume-PveVm (from id or name)
    • Reset-PveVm (from id or name)
    • And More
  • Method direct access using Invoke-PveRestApi return PveResponse
  • Connect-PveCluster accept multiple hosts for HA
  • Completely written in PowerShell
  • Use native api REST Proxmox VE
  • Independent os (Windows, Linux, Macosx)
  • Installation from PowerShellGallery or download file
  • Not require installation in Proxmox VE
  • Execute out side Proxmox VE
  • Open Source
  • Form Proxmox VE 6.2 support Api Token for user
  • Enter-PveSpice enter Spice VM
  • Login with One-time password for Two-factor authentication

๐Ÿ“™ Documentation

Documentation

Tutorial

Tutorial interactive in VSCode notebook

Video

Requirement

Minimum version requirement for Powershell is 6.0

Installation

Install PowerShell in your system.

From PowerShell Gallery

Open PowerShell and install module form gallery

PS /home/frank> Install-Module -Name Corsinvest.ProxmoxVE.Api

Manual

Download folder Corsinvest.ProxmoxVE.Api and copy in path module

# show path module
PS /home/frank> [Environment]::GetEnvironmentVariable("PSModulePath")

Api token

From version 6.2 of Proxmox VE is possible to use Api token. This feature permit execute Api without using user and password. If using Privilege Separation when create api token remember specify in permission. Format USER@REALM!TOKENID=UUID

Connect to cluster

For connection use the function Connect-PveCluster. This function generate a Ticket object that refer a PveTicket class. The first connection saved ticket data in the variable $Global:PveTicketLast. In the various functions, the -PveTicket parameter is the connection reference ticket. If not specified will be used $Global:PveTicketLast.

PveTicket Class

This class contain data after connection and login Connect-PveCluster

class PveTicket {
    [string] $HostName = ''
    [int] $Port = 8006
    [bool] $SkipCertificateCheck = $true
    [string] $Ticket = ''
    [string] $CSRFPreventionToken = ''
    [string] $ApiToken = ''
}

PveResponse Class

This class contain data after execution any command

class PveResponse {
    #Contain real response of Proxmox VE
    #Is converted in object Json response
    [PSCustomObject] $Response
    [int] $StatusCode = 200
    [string] $ReasonPhrase
    [bool] $IsSuccessStatusCode = $true
    [string] $RequestResource
    [hashtable] $Parameters
    [string] $Method
    [string] $ResponseType

    [bool] ResponseInError() { return $null -ne $this.Response.error }
    [PSCustomObject] ToTable() { return $this.Response.data | Format-Table -Property * }
    [PSCustomObject] ToData() { return $this.Response.data }
    [void] ToCsv([string] $filename) { $this.Response.data | Export-Csv $filename }
    [void] ToGridView() { $this.Response.data | Out-GridView -Title "View Result Data" }
}

Usage

Example Connect and get version

#Connection to cluster user and password
PS /home/frank> Connect-PveCluster -HostsAndPorts 192.168.190.191:8006,192.168.190.192 -SkipCertificateCheck
PowerShell credential request
Proxmox VE Username and password, username formatted as user@pam, user@pve, user@yourdomain or user (default domain pam).
User: test
Password for user test: ****

#return Ticket, default set $Global:PveTicketLast
#this is useful when connections to multiple clusters are needed use parameter -SkipRefreshPveTicketLast
HostName             : 192.168.190.191
Port                 : 8006
SkipCertificateCheck : True
Ticket               : PVE:test@pam:5EFF3CCA::iXhSNb5NTgNUYznf93mBOhj8pqYvAXoecKBHCXa3coYwBWjsWO/x8TO1gIDX0yz9nfHuvY3alJ0+Ew5AouOTZlZl3NODO9Cp4Hl87qnzhsz4wvoYEzvS1NUOTBekt+yAa68jdbhP
                        OzhOd8ozEEQIK7Fw2lOSa0qBFUTZRoMtnCnlsjk/Nn3kNEnZrkHXRGm46fA+asprvr0nslLxJgPGh94Xxd6jpNDj+xJnp9u6W3PxiAojM9g7IRurbp7ZCJvAgHbA9FqxibpgjaVm4NCd8LdkLDgCROxgYCjI3eR
                        gjkDvu1P7lLjK9JxSzqnCWWD739DT3P3bW+Ac3SyVqTf8sw==
CSRFPreventionToken  : 5EFF3CCA:Cu0NuFiL6CkhFdha2V+HHigMQPk

#Connection to cluster using Api Token
PS /home/frank> Connect-PveCluster -HostsAndPorts 192.168.190.191:8006,192.168.190.192 -SkipCertificateCheck -ApiToken root@pam!qqqqqq=8a8c1cd4-d373-43f1-b366-05ce4cb8061f
HostName             : 192.168.190.191
Port                 : 8006
SkipCertificateCheck : True
Ticket               :
CSRFPreventionToken  :
ApiToken             : root@pam!qqqqqq=8a8c1cd4-d373-43f1-b366-05ce4cb8061f

#For disable output call Connect-PveCluster > $null

#Get version
PS /home/frank> $ret = Get-PveVersion

#$ret return a class PveResponse

#Show data
PS /home/frank> $ret.Response.data
repoid   release keyboard version
------   ------- -------- -------
d0ec33c6 15      it       5.4

#Show data 2
PS /home/frank> $ret.ToTable()
repoid   release keyboard version
------   ------- -------- -------
d0ec33c6 15      it       5.4

Get snapshots of vm

PS /home/frank> (Get-PveNodesQemuSnapshot -Node pve1 -Vmid 100).ToTable()

vmstate name                         parent                       description       snaptime
------- ----                         ------                       -----------       --------
      0 autowin10service200221183059 autowin10service200220183012 cv4pve-autosnap 1582306261
      0 autowin10service200220183012 autowin10service200219183012 cv4pve-autosnap 1582219813
      0 autowin10service200224183012 autowin10service200223183014 cv4pve-autosnap 1582565413
      0 autowin10service200223183014 autowin10service200222183019 cv4pve-autosnap 1582479015
      0 autowin10service200215183012 autowin10service200214183012 cv4pve-autosnap 1581787814
      0 autowin10service200216183017 autowin10service200215183012 cv4pve-autosnap 1581874219
      0 autowin10service200218183010 autowin10service200216183017 cv4pve-autosnap 1582047011
      0 autowin10service200219183012 autowin10service200218183010 cv4pve-autosnap 1582133413
      0 autowin10service200214183012                              cv4pve-autosnap 1581701413
      0 autowin10service200222183019 autowin10service200221183059 cv4pve-autosnap 1582392621
        current                      autowin10service200224183012 You are here!

Other method

(Get-PveVm -VmIdOrName 100 | Get-PveNodesQemuSnapshot).ToTable()
vmstate name                         parent                       description       snaptime
------- ----                         ------                       -----------       --------
      0 autowin10service200221183059 autowin10service200220183012 cv4pve-autosnap 1582306261
      0 autowin10service200220183012 autowin10service200219183012 cv4pve-autosnap 1582219813
      0 autowin10service200224183012 autowin10service200223183014 cv4pve-autosnap 1582565413
      0 autowin10service200223183014 autowin10service200222183019 cv4pve-autosnap 1582479015
      0 autowin10service200215183012 autowin10service200214183012 cv4pve-autosnap 1581787814
      0 autowin10service200216183017 autowin10service200215183012 cv4pve-autosnap 1581874219
      0 autowin10service200218183010 autowin10service200216183017 cv4pve-autosnap 1582047011
      0 autowin10service200219183012 autowin10service200218183010 cv4pve-autosnap 1582133413
      0 autowin10service200214183012                              cv4pve-autosnap 1581701413
      0 autowin10service200222183019 autowin10service200221183059 cv4pve-autosnap 1582392621
        current                      autowin10service200224183012 You are here!

Indexed data parameter

if you need to pass indexed parameters e.g. (-ScsiN, -IdeN, -NetN) you must use the following way:

#create variabile
$networkConfig = @{ 1 = [uri]::EscapeDataString("model=virtio,bridge=vmbr0") }
$storageConfig = @{ 1 = 'ssdpool:32' }
$bootableIso = @{ 1 = 'local:iso/ubuntu.iso' }

#use variable
New-PveNodesQemu -Node $node -Vmid 105 -Memory 2048 -ScsiN $storageConfig -IdeN $bootableIso -NetN $networkConfig

The [uri]::EscapeDataString escape value to pass.

Build documentation

For build documentation use command Build-PveDocumentation

This command accept TemplateFile parameter is a template for generate documentation. The default file.

cv4pve-api-powershell's People

Contributors

franklupo avatar magnes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cv4pve-api-powershell's Issues

Parameter verification failed with 8.0.4

What happened?

Hello I think i just found a regression,

With 8.04, simple functions like Get-PveClusterNextid now fails with error "Parameter verification failed".

Get-PveClusterNextid -vmid 50000
Response            :
StatusCode          : 400
ReasonPhrase        : Parameter verification failed.
IsSuccessStatusCode : False
RequestResource     : /cluster/nextid
Parameters          : {[vmid, 50000]}
Method              : Get
ResponseType        : json

Expected behavior

with 8.0.3 behaviour is ok :

Get-PveClusterNextid -vmid 50000

Response            : @{data=50017}
StatusCode          : 200
ReasonPhrase        :
IsSuccessStatusCode : True
RequestResource     : /cluster/nextid
Parameters          : {[vmid, 50000]}
Method              : Get
ResponseType        : json

Relevant log output

No response

Proxmox VE Version

7.4

Version (bug)

8.0.4

Version (working)

8.0.3

On what operating system are you experiencing the issue?

Windows

Pull Request

  • I would like to do a Pull Request

Module manifest needs PowerShellVersion attribute defined

What happened?

I installed and attempted to import this module via PowerShell ISE (which uses the older Windows PowerShell 5.1). This failed with multiple errors of missing types or incorrect language syntax.

This is an easy fix by updating this line in the manifest to whatever the minimum version being used by the dev team.

# Minimum version of the PowerShell engine required by this module
# PowerShellVersion = ''

If using PowerShell Core 6.0, you'd change that line to this:

# Minimum version of the PowerShell engine required by this module
PowerShellVersion = '6.0'

Happy to create a PR for this, although I don't know what version is being used by your team.

However, some food for thought: Any scripting I've done that resolves around potential server infrastructure management (such as managing a hypervisor), I specifically code with a "lowest common denominator" approach to avoid having to install any unnecessary (and potantially vulnerable) applications on servers, writing modules specifically using the 5.1 PowerShell engine (I connect my VS Code to a Windows VM with a VS Code server installed, for example).

Expected behavior

Importing the module in ISE should have failed with the message that I was running too low a version of PowerShell.

Relevant log output

No response

Proxmox VE Version

8.0.4

Version (bug)

8.0.4

Version (working)

No response

On what operating system are you experiencing the issue?

Windows

Pull Request

  • I would like to do a Pull Request

Get-PveNodesQemuAgentExecStatus parameter transmission problem

What happened?

image
At the same time from console:
image

Expected behavior

The same result as with pvesh

Relevant log output

No response

Proxmox VE Version

7.4.17

Version (bug)

8.0.3

Version (working)

No response

On what operating system are you experiencing the issue?

Windows, Linux

Pull Request

  • I would like to do a Pull Request

Convert Hashtables into appropriate querystring values

What happened?

I tried to pass a <Hashtable> argument to the Module, but I kept getting a response with a status code of 400. Here's the example:

$networkConfig = @{
    1 = @{
        model = 'virtio';
        bridge = 'vmbr0';
        macaddr = $mac;
    };
}

$storageConfig = @{
    1 = 'local-lvm:32';
}

$bootableIso = @{
    1 = 'local:iso/ubuntu.iso'
}

New-PveNodesQemu -Node $node -Vmid 105 -Memory 2048 -ScsiN $storageConfig -IdeN $bootableIso -NetN $networkConfig

To resolve the issue, I received a suggestion to change the variable to $networkConfig = @{ 1 = "model=virtio,bridge=vmbr0,macaddr=$mac" } , but during debugging, I noticed that the value was not properly escaped in the URI.

The only way for $networkConfig to be accepted was to format it like this:
$networkConfig = @{ 1 = "model%3Dvirtio%2Cbridge%3Dvmbr0%2Cmacaddr%3D$mac" }

Expected behavior

Accept <Hashtable> Format and maybe add a simple example to the documentation about the correct aproach.

Relevant log output

No response

Proxmox VE Version

8.1.3

Version (bug)

8.1.0

Version (working)

No response

On what operating system are you experiencing the issue?

Windows

Pull Request

  • I would like to do a Pull Request

Syntax requirement

hello,
Unable to write a satisfying request in powershell, equivalent to a pvesh command

====================

For an api request with pvesh
pvesh set /nodes/precision/qemu/105/config -ipconfig0 "ip=10.1.1.21/24,gw=10.1.1.254"

Result
update VM 105: -ipconfig0 ip=10.1.1.21/24,gw=10.1.1.254

================

But with powershell

==================
$ipval=@{}
$ipval[0]="ip=10.1.1.21/24,gw=10.1.1.254"
PS C:\Users\user\Desktop> set-PveNodesQemuConfig -vmid 105 -Node proxserver -IpconfigN $ipval

StatusCode : 400
IsSuccessStatusCode : False
Response :
ReasonPhrase : Parameter verification failed.
RequestResource : /nodes/proxserver/qemu/105/config
Parameters : {ipconfig0}
Method : Put
ResponseType : json

========================

Sorry if i made a basic error with PS, I am not very familiar.

perhaps add an example with Hashtables to the doc.
thank you,
Best regards,
ken

How to execute commands on VM via QEMU

What happened?

I need to be able to execute commands on my VMs (qm guest exec). I can do this with the shell on the host directly, but it would be nice to be able to do it via Powershell as well. Do you have a way to do this through PS or would you maybe consider implementing it in your plugin?

Expected behavior

I am filing this question here because i was told to :)

Relevant log output

No response

Proxmox VE Version

8.x

Version (bug)

8.x

Version (working)

No response

On what operating system are you experiencing the issue?

Windows

Pull Request

  • I would like to do a Pull Request

Start-PveVm is broken

What happened?

image

Expected behavior

VM started

Relevant log output

No response

Proxmox VE Version

7.4.17

Version (bug)

8.0.3

Version (working)

No response

On what operating system are you experiencing the issue?

Windows

Pull Request

  • I would like to do a Pull Request

Get-PveVm with -PveTicket parameter

What happened?

Parameter is not accepted with error:
[Get-PveVm: Cannot process argument transformation on parameter 'PveTicket'. Cannot convert the "PveTicket" value of type "PveTicket" to type "System.Management.Automation.ValidateNotNullAttribute".]

bug

Expected behavior

Commandlet executes successfully

Relevant log output

No response

Proxmox VE Version

7.4.3

Version (bug)

8.0

Version (working)

No response

On what operating system are you experiencing the issue?

Windows

Pull Request

  • I would like to do a Pull Request

Obscure error message at Copy-PveQemu

What happened?

Running this command
image

Expected behavior

Expected a successful result

Relevant log output

No response

Proxmox VE Version

7.4.16

Version (bug)

8.0.2

Version (working)

No response

On what operating system are you experiencing the issue?

Windows

Pull Request

  • I would like to do a Pull Request

Problems importing module within Powershell

What happened?

Honestly, thank you guys for making this module! It will really help many with converting from EXSI to Proxmox in a reproducible way.

I basically am unable to import the powershell module after a clean fresh installation directly from the Powershell gallery on two separate devices.

Expected behavior

The module should import and export all expected functions into the current powershell session.

Relevant log output

$ModuleName = 'Corsinvest.ProxmoxVE.Api'
Install-Module -Name ($ModuleName) -Scope AllUsers -AllowClobber -Force -Verbose
Import-Module -Name ($ModuleName) -Force -Verbose


VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Corsinvest.ProxmoxVE.Api\8.1.0\Corsinvest.ProxmoxVE.Api.psd1'.
VERBOSE: Populating RepositorySourceLocation property for module Corsinvest.ProxmoxVE.Api.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Corsinvest.ProxmoxVE.Api\8.1.0\Corsinvest.ProxmoxVE.Api.psm1'.
At C:\Program Files\WindowsPowerShell\Modules\Corsinvest.ProxmoxVE.Api\8.1.0\Corsinvest.ProxmoxVE.Api.psm1:369 char:63
+                     (Invoke-WebRequest $TemplateFile).Content :
+                                                               ~
Unexpected token ':' in expression or statement.
At C:\Program Files\WindowsPowerShell\Modules\Corsinvest.ProxmoxVE.Api\8.1.0\Corsinvest.ProxmoxVE.Api.psm1:457 char:59
+             $parameters = @{ proxy = $null -eq $PveTicket ? $PveTicke ...
+                                                           ~
Unexpected token '?' in expression or statement.
At C:\Program Files\WindowsPowerShell\Modules\Corsinvest.ProxmoxVE.Api\8.1.0\Corsinvest.ProxmoxVE.Api.psm1:457 char:58
+             $parameters = @{ proxy = $null -eq $PveTicket ? $PveTicke ...
+                                                          ~
The hash literal was incomplete.
At C:\Program Files\WindowsPowerShell\Modules\Corsinvest.ProxmoxVE.Api\8.1.0\Corsinvest.ProxmoxVE.Api.psm1:473 char:1
+ }
+ ~
Unexpected token '}' in expression or statement.
At C:\Program Files\WindowsPowerShell\Modules\Corsinvest.ProxmoxVE.Api\8.1.0\Corsinvest.ProxmoxVE.Api.psm1:4 char:25
+ ... idateVmId : System.Management.Automation.IValidateSetValuesGenerator  ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unable to find type [System.Management.Automation.IValidateSetValuesGenerator].
At C:\Program Files\WindowsPowerShell\Modules\Corsinvest.ProxmoxVE.Api\8.1.0\Corsinvest.ProxmoxVE.Api.psm1:8 char:27
+ ... ateVmName : System.Management.Automation.IValidateSetValuesGenerator  ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unable to find type [System.Management.Automation.IValidateSetValuesGenerator].
At C:\Program Files\WindowsPowerShell\Modules\Corsinvest.ProxmoxVE.Api\8.1.0\Corsinvest.ProxmoxVE.Api.psm1:14 char:25
+ ... idateNode : System.Management.Automation.IValidateSetValuesGenerator  ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unable to find type [System.Management.Automation.IValidateSetValuesGenerator].
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnexpectedToken
 
Import-Module : The module to process 'Corsinvest.ProxmoxVE.Api.psm1', listed in field 'ModuleToProcess/RootModule' of module manifest 
'C:\Program Files\WindowsPowerShell\Modules\Corsinvest.ProxmoxVE.Api\8.1.0\Corsinvest.ProxmoxVE.Api.psd1' was not processed because no valid 
module was found in any module directory.
At line:1 char:1
+ Import-Module 'Corsinvest.ProxmoxVE.Api' -Force -Verbose
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (Corsinvest.ProxmoxVE.Api:String) [Import-Module], PSInvalidOperationException
    + FullyQualifiedErrorId : Modules_ModuleFileNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

Proxmox VE Version

8.X

Version (bug)

8.1.0

Version (working)

No response

On what operating system are you experiencing the issue?

Windows

Pull Request

  • I would like to do a Pull Request

Windows Specific command execution

What happened?

Hello, I have a few questions.

I'm coming from VMware and was using PowerCLI to do my VM creation + configuration.

However with ( cv4pve-api-powershell | PVE-API ) I encounter some problems:

1 - I have the impression that anything related to url encoding is prohibited.
1.1 - For example if I have a password like "P@s+w0r&&rd!", I receive a failed authentication; if I use "P@ssw0rd!" No problem

How to avoid this kind of problem? (For example passwords are generated randomly and removing possible chars from url encoding is not an option)

2 - Sending a command does not allow you to send a group of commands:

$Cmd3 = @"
touch /home/manager/pve3
echo 'test' > /home/manager/pve3
"@

New-PveNodesQemuAgentExec -PveTicket $PveTicket `
                           -Node $Node_Name `
                           -Vmid 500 `
                           -Command $Cmd3

Same as for point 1, if I use &&

New-PveNodesQemuAgentExec -PveTicket $PveTicket `
                           -Node $Node_Name `
                           -Vmid 500 `
                           -Command "touch /home/manager/pve4 && echo 'test' > /home/manager/pve4"

How can I send blocks of orders?

The goal being that under Windows if the commands "follow each other" in the terminal I can use the variables sent previously such as for example:

(The tild allows me that powershell does not interpret the variable currently, but that the vm which receives it does (The tild is removed when it is received by the vm) finally it worked under PowerCli->Windows I think that will be the case here too I haven't tested)

`$Username = $Username
`$Password = ConvertTo-SecureString $Password -AsPlainText -Force
`$Credential = New-Object System.Management.Automation.PSCredential(`$Username, `$password)
Start-Process Executable1.exe -Credential `$Credential

the try with

New-PveNodesQemuAgentFileWrite

Work for the cmd3 example but not with the Tild example

The final goal is to be able to fully configure a Windows server, for example, via this API:

  • Create the VM
  • Configure the vm (Host name, network, Disk, etc.)
  • Add and configure the role (Active Directory for example)

Perhaps one or more elements are the "fault" of the PVE API and necessarily of the Powershell module, I'm just trying to understand how to migrate my massive scripts to this module without "too much" change.

Even if I more or less understood that the simplest would be to send the scripts 1 by 1 to the VM rather than direct execution through the API.

Expected behavior

N/A

Relevant log output

No response

Proxmox VE Version

5.15.131-3

Version (bug)

1.0.0

Version (working)

No response

On what operating system are you experiencing the issue?

Windows

Pull Request

  • I would like to do a Pull Request

Connect-PveCluster

Why the Connect-PveCluster function was deleted from exported ?
It was replaced by another one or it is no longer used?
The correct way for using the module is
$Ticket = Connect-PveCluster...
... more calls of module functions with $Ticket as parameter

In Power shell 5.1 I'm not able to import it obtaining the followin error message.
DETTAGLIATO: Caricamento del modulo dal percorso 'C:\Users\xxx\Documents\WindowsPowerShell\Modules\Corsinvest.ProxmoxVE.Api\Corsinvest.ProxmoxVE.Api.psd1'.
DETTAGLIATO: Caricamento del modulo dal percorso 'C:\Users\xxx\Documents\WindowsPowerShell\Modules\Corsinvest.ProxmoxVE.Api\Corsinvest.ProxmoxVE.Api.psm1'.
In C:\Users\xxx\Documents\WindowsPowerShell\Modules\Corsinvest.ProxmoxVE.Api\Corsinvest.ProxmoxVE.Api.psm1:235 car:55

  •                 $Parameters[$_] = $Parameters[$_] ? 1 : 0
    
  •                                                   ~
    

Token '?' imprevisto nell'espressione o nell'istruzione.
In C:\Users\xxx\Documents\WindowsPowerShell\Modules\Corsinvest.ProxmoxVE.Api\Corsinvest.ProxmoxVE.Api.psm1:355 car:84

  • ... t = (($TemplateFile -as [System.Uri]).Scheme -match '[http|https]') ?
  •                                                                     ~
    

Token '?' imprevisto nell'espressione o nell'istruzione.
In C:\Users\xxx\Documents\WindowsPowerShell\Modules\Corsinvest.ProxmoxVE.Api\Corsinvest.ProxmoxVE.Api.psm1:356 car:63

  •                 (Invoke-WebRequest $TemplateFile).Content :
    
  •                                                           ~
    

Token ':' imprevisto nell'espressione o nell'istruzione.
In C:\Users\xxx\Documents\WindowsPowerShell\Modules\Corsinvest.ProxmoxVE.Api\Corsinvest.ProxmoxVE.Api.psm1:11 car:22

  • ... ValidVmId : System.Management.Automation.IValidateSetValuesGenerator ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    

Impossibile trovare il tipo [System.Management.Automation.IValidateSetValuesGenerator].
In C:\Users\xxx\Documents\WindowsPowerShell\Modules\Corsinvest.ProxmoxVE.Api\Corsinvest.ProxmoxVE.Api.psm1:17 car:24

  • ... lidVmName : System.Management.Automation.IValidateSetValuesGenerator ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    

Impossibile trovare il tipo [System.Management.Automation.IValidateSetValuesGenerator].
In C:\Users\xxx\Documents\WindowsPowerShell\Modules\Corsinvest.ProxmoxVE.Api\Corsinvest.ProxmoxVE.Api.psm1:23 car:22

  • ... ValidNode : System.Management.Automation.IValidateSetValuesGenerator ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    

Impossibile trovare il tipo [System.Management.Automation.IValidateSetValuesGenerator].
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : UnexpectedToken

Import-Module : Impossibile elaborare il modulo 'Corsinvest.ProxmoxVE.Api.psm1' elencato nel campo 'ModuleToProcess/RootModule' del manifesto del modulo
'C:\Users\xxx\Documents\WindowsPowerShell\Modules\Corsinvest.ProxmoxVE.Api\Corsinvest.ProxmoxVE.Api.psd1'. Non sono stati trovati moduli validi in alcuna directory di moduli.
In riga:1 car:1

  • Import-Module C:\Users\xxx\Documents\WindowsPowerShell\Modules\Co ...
  •   + CategoryInfo          : ResourceUnavailable: (Corsinvest.ProxmoxVE.Api:String) [Import-Module], PSInvalidOperationException
      + FullyQualifiedErrorId : Modules_ModuleFileNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
    
    

Thank for the great work

Upid

What happened?

Iam using the -upid Parameter which exists in the variable delete. But when i use it I get the the error Code that it cannot be found.
image

Expected behavior

In the delete.Response the upid is available. But when i wanna call it with Wait-PveTaskIsFinish -Upid $deltete.Response.data, I get the error Code Get-PveNodesTasks: A parameter cannot be found that matches parameter name 'Upid'.
image

Relevant log output

No response

Proxmox VE Version

7.1

Version (bug)

7.2

Version (working)

No response

On what operating system are you experiencing the issue?

Windows

Pull Request

  • I would like to do a Pull Request

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.