Skip to content

Add PolicyId output to Get-TeamViewerGroup function#102

Open
fs1n wants to merge 4 commits into
teamviewer:mainfrom
fs1n:feature/OutputPolicyIDforGroup
Open

Add PolicyId output to Get-TeamViewerGroup function#102
fs1n wants to merge 4 commits into
teamviewer:mainfrom
fs1n:feature/OutputPolicyIDforGroup

Conversation

@fs1n

@fs1n fs1n commented Jun 29, 2026

Copy link
Copy Markdown

Summary

This PR adds the PolicyId field to the output of the Get-TeamViewerGroup function. This enhancement enables retreival of the PolicyID, assigned to a group via the Get-TeamViewerGroup -Id <groupID> cmdlet.

Changes

  • Added PolicyId field to Get-TeamViewerGroup cmdlet output
  • Updated ConvertTo-TeamViewerGroup conversion function to support the new field
  • Updated all related tests to accommodate the new field

Motivation & Context

Being able to set an Policy to a group, I thought, "Why can't I retrieve it via the PowerShell module?" In a script that I had built, I had to use Invoke-RestMethod in the middle of the script, which is a bit of a maintenance pain. So I updated the module to make this output available too.


Checklist

  • Tests have been added/updated and all tests pass
  • Changes have been tested locally
  • No breaking changes to existing functionality

@AchilleasMitos-TV AchilleasMitos-TV left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also bump the minor version of the TeamViewerPS.psd1 as well as add an entry to the CHANGELOG for it.

else {
Write-Output ($response.groups | ConvertTo-TeamViewerGroup)
$groups = @($response.groups | ConvertTo-TeamViewerGroup)
$groups | ForEach-Object { $_.PSObject.Properties.Remove('PolicyId') }

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: why don't we want the PolicyId field when requesting multiple groups?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well yes, this is very individual. Personally, I don't need this information in the all group output.
If you say you want it, I can remove my filter again.
I just wanted to keep the "general" output streamlined.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the WebApi endpoint exposes it, I don't see a reason for not including it in the Powershell's response :)

@AchilleasMitos-TV AchilleasMitos-TV left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the improvement on the Cmdlet!

else {
Write-Output ($response.groups | ConvertTo-TeamViewerGroup)
$groups = @($response.groups | ConvertTo-TeamViewerGroup)
$groups | ForEach-Object { $_.PSObject.Properties.Remove('PolicyId') }

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the WebApi endpoint exposes it, I don't see a reason for not including it in the Powershell's response :)

Comment thread Cmdlets/TeamViewerPS.psd1

# Version number of this module.
ModuleVersion = '2.5.1'
ModuleVersion = '2.5.2'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Patch version is for documentation changes and other such fixes. Here, we are doing much more than that, hence a minor version bump is in order.

Suggested change
ModuleVersion = '2.5.2'
ModuleVersion = '2.6.0'

Comment thread CHANGELOG.md
@@ -1,5 +1,11 @@
# Change Log

## 2.5.2 (not released yet)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## 2.5.2 (not released yet)
## 2.6.0 (not released yet)

Please note that you have to request a release for this from @ChristianJ-TV or @stefanhubertus when it is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants