[GH-ISSUE #41] Remove-PveNodesQemu not able to use Purge and DestroyUnreferencedDisks Parameters #26

Closed
opened 2026-02-26 17:32:12 +03:00 by kerem · 5 comments
Owner

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

  • I would like to do a Pull Request
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 ```shell ``` ### 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 - [ ] I would like to do a Pull Request
kerem closed this issue 2026-02-26 17:32:12 +03:00
Author
Owner

@franklupo commented on GitHub (Aug 12, 2025):

I'm checking the problem

bets regards

<!-- gh-comment-id:3178537524 --> @franklupo commented on GitHub (Aug 12, 2025): I'm checking the problem bets regards
Author
Owner

@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 purge and destroy-unreferenced-disks, but the command is passing integers (1) instead.

Cause:
PowerShell’s loose typing allows 1 to be interpreted as $true, but the Proxmox API requires explicit boolean values (true or false). Passing 1 causes the API to reject the request during parameter validation.

Solution:
Use proper boolean values when calling the function, like so:

Remove-PveNodesQemu -PveTicket $PveTicket -Node "node-name" -Vmid 123 -Purge:$true -DestroyUnreferencedDisks:$true

or

Remove-PveNodesQemu -PveTicket $PveTicket -Node "node-name" -Vmid 123 -Purge $true -DestroyUnreferencedDisks $true

Why it works:
This ensures the parameters are correctly serialized as booleans in the API request, avoiding the validation error.

Additional notes:

  • Omitting these parameters works because no invalid values are sent.
  • The :$true syntax 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.

<!-- gh-comment-id:3178570314 --> @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 `purge` and `destroy-unreferenced-disks`, but the command is passing integers (`1`) instead. **Cause:** PowerShell’s loose typing allows `1` to be interpreted as `$true`, but the Proxmox API requires explicit boolean values (`true` or `false`). Passing `1` causes the API to reject the request during parameter validation. **Solution:** Use proper boolean values when calling the function, like so: ```powershell Remove-PveNodesQemu -PveTicket $PveTicket -Node "node-name" -Vmid 123 -Purge:$true -DestroyUnreferencedDisks:$true ``` or ```powershell Remove-PveNodesQemu -PveTicket $PveTicket -Node "node-name" -Vmid 123 -Purge $true -DestroyUnreferencedDisks $true ``` **Why it works:** This ensures the parameters are correctly serialized as booleans in the API request, avoiding the validation error. **Additional notes:** * Omitting these parameters works because no invalid values are sent. * The `:$true` syntax 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.
Author
Owner

@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

<!-- gh-comment-id:3184999090 --> @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
Author
Owner

@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:

  • 🔍 Complete HTTP request sent to the Proxmox API
  • 📡 Headers and body of the request
  • 🔄 Detailed response from the server
  • ⚙️ Internal parameter mapping within the module

This will help us understand:

  1. How PowerShell parameters are translated to REST API calls
  2. What the Proxmox server actually receives
  3. Whether the issue is in the module or the server API

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:

  • Your Proxmox VE server version
  • Output of Get-PveVersion

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!

<!-- gh-comment-id:3187132164 --> @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: - 🔍 Complete HTTP request sent to the Proxmox API - 📡 Headers and body of the request - 🔄 Detailed response from the server - ⚙️ Internal parameter mapping within the module This will help us understand: 1. How PowerShell parameters are translated to REST API calls 2. What the Proxmox server actually receives 3. Whether the issue is in the module or the server API 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: - Your Proxmox VE server version - Output of Get-PveVersion 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!
Author
Owner

@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

<!-- gh-comment-id:3188421819 --> @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
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/cv4pve-api-powershell#26
No description provided.