[GH-ISSUE #22] @tag-??? search in get-pvevm uses incorrect substring length #16

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

Originally created by @sgtmjrme on GitHub (Sep 23, 2024).
Original GitHub issue: https://github.com/Corsinvest/cv4pve-api-powershell/issues/22

What happened?

If you attempt to filter your get-pvevm command using the "-vmidorname '@tag-BLAH'" flag, it returns nothing.

The issue is that the elseif search uses $item.substring(6)... "@tag-" is only 5 characters, and so adding any character between your expected tag and the "-" will make it work again. Ex, "@tag-ABLAH" will search for all VM's with a tag of "BLAH".

*While doing other testing, I've also noticed that (at least for the API for 8.2.7), tags are separated with semi-colons instead of commas, so searching for a tag when a VM has more than one always fails.

Expected behavior

It returns something when used appropriately.

Relevant log output

PS C:\Program Files\PowerShell\7> get-pvevm -vmidorname '@tag-rj'
PS C:\Program Files\PowerShell\7> get-pvevm -vmidorname '@tag-Brj'

name      : <Server Name>
...

Proxmox VE Version

8.2.7

Version (bug)

Latest

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 @sgtmjrme on GitHub (Sep 23, 2024). Original GitHub issue: https://github.com/Corsinvest/cv4pve-api-powershell/issues/22 ### What happened? If you attempt to filter your get-pvevm command using the "-vmidorname '@tag-BLAH'" flag, it returns nothing. The issue is that the elseif search uses $item.substring(6)... "@tag-" is only 5 characters, and so adding _any_ character between your expected tag and the "-" will make it work again. Ex, "@tag-ABLAH" will search for all VM's with a tag of "BLAH". *While doing other testing, I've also noticed that (at least for the API for 8.2.7), tags are separated with semi-colons instead of commas, so searching for a tag when a VM has more than one _always_ fails. ### Expected behavior It returns something when used appropriately. ### Relevant log output ```shell PS C:\Program Files\PowerShell\7> get-pvevm -vmidorname '@tag-rj' PS C:\Program Files\PowerShell\7> get-pvevm -vmidorname '@tag-Brj' name : <Server Name> ... ``` ### Proxmox VE Version 8.2.7 ### Version (bug) Latest ### 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:08 +03:00
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#16
No description provided.