Utiliser l'API REST de Proxmox avec Powershell

Ressources

Documentation de l'API Proxmox : https://pve.proxmox.com/wiki/Proxmox_VE_API

Utilisaton avec Powersell :https://github.com/Corsinvest/cv4pve-api-powershell

Install du modulke POwershell

Ouvrir une console Powershell

PS > Install-Module -Name Corsinvest.ProxmoxVE.Api

Connexion au cluster

Connexion au cluster en indiquant compte et mùot de passe

<code powershell> PS > Connect-PveCluster -HostsAndPorts 192.168.190.191:8006 -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