mirror of
https://github.com/Corsinvest/cv4pve-api-powershell.git
synced 2026-04-25 12:15:48 +03:00
[GH-ISSUE #41] Remove-PveNodesQemu not able to use Purge and DestroyUnreferencedDisks Parameters #26
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/cv4pve-api-powershell#26
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @IST-System-Manager on GitHub (Aug 11, 2025).
Original GitHub issue: https://github.com/Corsinvest/cv4pve-api-powershell/issues/41
What happened?
When using the Remove-PveNodesQemu with the Purge and DestroyUnreferencedDisks Parameters I get the message Parameter verification failed.
Code I'm using:
Remove-PveNodesQemu -PveTicket [valid ticket] -Node [Node of vm] -Vmid [ID of vm] -Purge 1 -DestroyUnreferencedDisks 1
Response:
Response :
StatusCode : 400
ReasonPhrase : Parameter verification failed.
IsSuccessStatusCode : False
RequestResource : /nodes/[Node of vm]/qemu/[ID of vm]
Parameters : {[destroy-unreferenced-disks, True], [purge, True]}
Method : Delete
ResponseType : json
The code works if I remove the parameters.
I'm using:
Windows 11
Powershell 7.5.2
VS Code: 1.102.3
cv4pve-api-powershell: v8.4.1
Expected behavior
Expected behavior should be when I use the Remove-PveNodesQemu function with the Purge and DestroyUnreferencedDisks Parameters the function will destroy the referenced VMs and Purge from job configurations and Destroy unreferenced disks owned by guest.
Relevant log output
Proxmox VE Version
8.4.1
Version (bug)
8.4.1
Version (working)
No response
On what operating system are you experiencing the issue?
Windows
Pull Request
@franklupo commented on GitHub (Aug 12, 2025):
I'm checking the problem
bets regards
@franklupo commented on GitHub (Aug 12, 2025):
Issue explanation:
The error "Parameter verification failed" (HTTP 400) occurs because the Proxmox API expects boolean parameters for
purgeanddestroy-unreferenced-disks, but the command is passing integers (1) instead.Cause:
PowerShell’s loose typing allows
1to be interpreted as$true, but the Proxmox API requires explicit boolean values (trueorfalse). Passing1causes the API to reject the request during parameter validation.Solution:
Use proper boolean values when calling the function, like so:
or
Why it works:
This ensures the parameters are correctly serialized as booleans in the API request, avoiding the validation error.
Additional notes:
:$truesyntax forces the parameter binding as boolean in PowerShell.With this change, the VM will be deleted, the purge process will clean job configurations, and unreferenced disks owned by the VM will be destroyed as expected.
@IST-System-Manager commented on GitHub (Aug 13, 2025):
I'm getting the same error with both examples.
Remove-PveNodesQemu -PveTicket $PveTicket -Node "node-name" -Vmid 123 -Purge:$true -DestroyUnreferencedDisks:$true
Remove-PveNodesQemu -PveTicket $PveTicket -Node "node-name" -Vmid 123 -Purge $true -DestroyUnreferencedDisks $true
I've also tried other configurations with the same result:
Remove-PveNodesQemu -PveTicket $PveTicket -Node "node-name" -Vmid 123 -Purge:$True -DestroyUnreferencedDisks:$True
Remove-PveNodesQemu -PveTicket $PveTicket -Node "node-name" -Vmid 123 -Purge $True -DestroyUnreferencedDisks $True
[bool]$PassValue = $True
Remove-PveNodesQemu -PveTicket $PveTicket -Node "node-name" -Vmid 123 -Purge:$PassValue -DestroyUnreferencedDisks:$PassValue
Remove-PveNodesQemu -PveTicket $PveTicket -Node "node-name" -Vmid 123 -Purge $PassValue -DestroyUnreferencedDisks $PassValue
[bool]$PassValue = 1
Remove-PveNodesQemu -PveTicket $PveTicket -Node "node-name" -Vmid 123 -Purge:$PassValue -DestroyUnreferencedDisks:$PassValue
Remove-PveNodesQemu -PveTicket $PveTicket -Node "node-name" -Vmid 123 -Purge $PassValue -DestroyUnreferencedDisks $PassValue
I even tried $False to see if that would make a difference:
Remove-PveNodesQemu -PveTicket $PveTicket -Node "node-name" -Vmid 123 -Purge:$False -DestroyUnreferencedDisks:$False
Remove-PveNodesQemu -PveTicket $PveTicket -Node "node-name" -Vmid 123 -Purge $False -DestroyUnreferencedDisks $False
Every attempt returns the same message. It is unable to verify the parameters.
Response :
StatusCode : 400
ReasonPhrase : Parameter verification failed.
IsSuccessStatusCode : False
RequestResource : /nodes/"node-name"/qemu/123
Parameters : {[destroy-unreferenced-disks, True], [purge, True]}
Method : Delete
ResponseType : json
@franklupo commented on GitHub (Aug 14, 2025):
To help diagnose this issue, please try adding the -Debug parameter to your command and share the complete log output:
Remove-PveNodesQemu -PveTicket $PveTicket -Node "node-name" -Vmid 123 -Purge:$true -DestroyUnreferencedDisks:$true -Debug
The -Debug parameter will show:
This will help us understand:
Please attach the complete log (you can redact sensitive information like IP addresses/tickets) so we can see exactly what's happening
at the HTTP communication level.
Additionally, could you please share:
This will help us identify if this is an API compatibility issue. The error suggests the server is rejecting the parameters, which
could indicate version incompatibility or incorrect parameter formatting at the REST API level.
Thank you for your patience in helping us resolve this issue!
@IST-System-Manager commented on GitHub (Aug 14, 2025):
Promox VE server version: 8.4.1
Get-PveVersion Output:
release version repoid
8.4 8.4.1 2a5fa54a8503f96d
Debug Output:
DEBUG: Parameters:
DEBUG: destroy-unreferenced-disks => True
DEBUG: purge => True
DEBUG:
Name : Method
Value : Delete
Name : Headers
Value : {[CSRFPreventionToken, TOKEN]}
Name : SkipCertificateCheck
Value : True
Name : Uri
Value : https://[HOST IP]:8006/api2/json/nodes/"NODE NAME"/qemu/10006?destroy-unreferenced-disks=True&purge=True
Name : WebSession
Value : Microsoft.PowerShell.Commands.WebRequestSession
DEBUG: Params:
Name Value
Method Delete
Headers {[CSRFPreventionToken, TOKEN]}
SkipCertificateCheck True
Uri https://[HOST IP]:8006/api2/json/nodes/"NODE NAME"/qemu/10006?destroy-unreferenced-disks=True&purge=True
WebSession Microsoft.PowerShell.Commands.WebRequestSession
DEBUG: PveRestApi Response:
DEBUG: PveRestApi IsSuccessStatusCode: False
DEBUG: PveRestApi StatusCode: 400
DEBUG: PveRestApi ReasonPhrase: Parameter verification failed.
Response :
StatusCode : 400
ReasonPhrase : Parameter verification failed.
IsSuccessStatusCode : False
RequestResource : /nodes/ois-host03/qemu/10006
Parameters : {[destroy-unreferenced-disks, True], [purge, True]}
Method : Delete
ResponseType : json