From c0c15a9b546f6686706d65541e757487d43575ab Mon Sep 17 00:00:00 2001 From: "Frederik S." <71598139+fs1n@users.noreply.github.com> Date: Thu, 4 Jun 2026 19:57:00 +0200 Subject: [PATCH 1/4] Add PolicyId to ConvertTo-TeamViewerGroup output and update related tests --- Cmdlets/Private/ConvertTo-TeamViewerGroup.ps1 | 1 + Cmdlets/Public/Get-TeamViewerGroup.ps1 | 2 +- Docs/Help/Get-TeamViewerGroup.md | 7 +++++++ Tests/Public/Get-TeamViewerGroup.Tests.ps1 | 18 ++++++++++++++---- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/Cmdlets/Private/ConvertTo-TeamViewerGroup.ps1 b/Cmdlets/Private/ConvertTo-TeamViewerGroup.ps1 index 472bcb9..9ead588 100644 --- a/Cmdlets/Private/ConvertTo-TeamViewerGroup.ps1 +++ b/Cmdlets/Private/ConvertTo-TeamViewerGroup.ps1 @@ -9,6 +9,7 @@ function ConvertTo-TeamViewerGroup { Id = $InputObject.id Name = $InputObject.name Permissions = $InputObject.permissions + PolicyId = $InputObject.policy_id SharedWith = @($InputObject.shared_with | ConvertTo-TeamViewerGroupShare) } if ($InputObject.owner) { diff --git a/Cmdlets/Public/Get-TeamViewerGroup.ps1 b/Cmdlets/Public/Get-TeamViewerGroup.ps1 index a1f49bd..e4c50a3 100644 --- a/Cmdlets/Public/Get-TeamViewerGroup.ps1 +++ b/Cmdlets/Public/Get-TeamViewerGroup.ps1 @@ -52,6 +52,6 @@ function Get-TeamViewerGroup { Write-Output ($response | ConvertTo-TeamViewerGroup) } else { - Write-Output ($response.groups | ConvertTo-TeamViewerGroup) + Write-Output ($response.groups | ConvertTo-TeamViewerGroup | Select-Object -ExcludeProperty PolicyId) } } diff --git a/Docs/Help/Get-TeamViewerGroup.md b/Docs/Help/Get-TeamViewerGroup.md index 4e714e1..a3170a9 100644 --- a/Docs/Help/Get-TeamViewerGroup.md +++ b/Docs/Help/Get-TeamViewerGroup.md @@ -136,6 +136,13 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS +- **Id**: Group identifier +- **Name**: Group name +- **Permissions**: Permissions for this group +- **SharedWith**: Array of users the group is shared with +- **Owner**: Owner information (UserId, Name) +- **PolicyId**: (ByGroupId mode only) Policy identifier for this group + ## NOTES ## RELATED LINKS diff --git a/Tests/Public/Get-TeamViewerGroup.Tests.ps1 b/Tests/Public/Get-TeamViewerGroup.Tests.ps1 index ef40711..f79a3b0 100644 --- a/Tests/Public/Get-TeamViewerGroup.Tests.ps1 +++ b/Tests/Public/Get-TeamViewerGroup.Tests.ps1 @@ -10,9 +10,9 @@ BeforeAll { Mock Get-TeamViewerApiUri { '//unit.test' } Mock Invoke-TeamViewerRestMethod { @{ groups = @( - @{ id = 'g1234'; name = 'test group 1' }, - @{ id = 'g4567'; name = 'test group 2' }, - @{ id = 'g8901'; name = 'test group 3' } + @{ id = 'g1234'; name = 'test group 1'; policy_id = 'p1234' }, + @{ id = 'g4567'; name = 'test group 2'; policy_id = 'p4567' }, + @{ id = 'g8901'; name = 'test group 3'; policy_id = 'p8901' } ) } } } @@ -29,7 +29,7 @@ Describe 'Get-TeamViewerGroup' { } It 'Should call the correct API endpoint for single group' { - Get-TeamViewerGroup -ApiToken $testApiToken -Group 'g1234' + Get-TeamViewerGroup -ApiToken $testApiToken -Id 'g1234' Assert-MockCalled Invoke-TeamViewerRestMethod -Times 1 -Scope It -ParameterFilter { $ApiToken -eq $testApiToken -And ` @@ -62,4 +62,14 @@ Describe 'Get-TeamViewerGroup' { Assert-MockCalled Invoke-TeamViewerRestMethod -Times 1 -Scope It -ParameterFilter { $Body -And $Body['name'] -eq 'TestName' } } + + It 'Should include PolicyId when getting single group' { + $result = Get-TeamViewerGroup -ApiToken $testApiToken -Id 'g1234' + $result.PolicyId | Should -Be 'p1234' + } + + It 'Should exclude PolicyId when filtering groups' { + $result = Get-TeamViewerGroup -ApiToken $testApiToken + $result[0].PSObject.Properties.Name | Should -Not -Contain 'PolicyId' + } } From 44c0b50650773457aa8af630fb17b00a4221fddc Mon Sep 17 00:00:00 2001 From: "Frederik S." <71598139+fs1n@users.noreply.github.com> Date: Mon, 29 Jun 2026 16:50:05 +0200 Subject: [PATCH 2/4] Exclude PolicyId from group output and update related tests --- Cmdlets/Public/Get-TeamViewerGroup.ps1 | 4 +++- Tests/Public/Get-TeamViewerGroup.Tests.ps1 | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Cmdlets/Public/Get-TeamViewerGroup.ps1 b/Cmdlets/Public/Get-TeamViewerGroup.ps1 index e4c50a3..a617fce 100644 --- a/Cmdlets/Public/Get-TeamViewerGroup.ps1 +++ b/Cmdlets/Public/Get-TeamViewerGroup.ps1 @@ -52,6 +52,8 @@ function Get-TeamViewerGroup { Write-Output ($response | ConvertTo-TeamViewerGroup) } else { - Write-Output ($response.groups | ConvertTo-TeamViewerGroup | Select-Object -ExcludeProperty PolicyId) + $groups = @($response.groups | ConvertTo-TeamViewerGroup) + $groups | ForEach-Object { $_.PSObject.Properties.Remove('PolicyId') } + Write-Output $groups } } diff --git a/Tests/Public/Get-TeamViewerGroup.Tests.ps1 b/Tests/Public/Get-TeamViewerGroup.Tests.ps1 index f79a3b0..3a1f94e 100644 --- a/Tests/Public/Get-TeamViewerGroup.Tests.ps1 +++ b/Tests/Public/Get-TeamViewerGroup.Tests.ps1 @@ -15,6 +15,9 @@ BeforeAll { @{ id = 'g8901'; name = 'test group 3'; policy_id = 'p8901' } ) } } + Mock Invoke-TeamViewerRestMethod { @{ id = 'g1234'; name = 'test group 1'; policy_id = 'p1234' } } -ParameterFilter { + $Uri -eq '//unit.test/groups/g1234' + } } Describe 'Get-TeamViewerGroup' { From 86bf8a0eca09e3f137ed863869878c0bcdb0b632 Mon Sep 17 00:00:00 2001 From: "Frederik S." <71598139+fs1n@users.noreply.github.com> Date: Mon, 29 Jun 2026 17:02:54 +0200 Subject: [PATCH 3/4] Remove output fields from Get-TeamViewerGroup documentation Removed output details for TeamViewer group. --- Docs/Help/Get-TeamViewerGroup.md | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Docs/Help/Get-TeamViewerGroup.md b/Docs/Help/Get-TeamViewerGroup.md index a3170a9..4e714e1 100644 --- a/Docs/Help/Get-TeamViewerGroup.md +++ b/Docs/Help/Get-TeamViewerGroup.md @@ -136,13 +136,6 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -- **Id**: Group identifier -- **Name**: Group name -- **Permissions**: Permissions for this group -- **SharedWith**: Array of users the group is shared with -- **Owner**: Owner information (UserId, Name) -- **PolicyId**: (ByGroupId mode only) Policy identifier for this group - ## NOTES ## RELATED LINKS From 11ca6b343f22c96c98899b13b25c76027d5692e5 Mon Sep 17 00:00:00 2001 From: "Frederik S." <71598139+fs1n@users.noreply.github.com> Date: Tue, 7 Jul 2026 21:37:49 +0200 Subject: [PATCH 4/4] CHORE: Add Changelog entry and bump minor version in main psd --- CHANGELOG.md | 6 ++++++ Cmdlets/TeamViewerPS.psd1 | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 45703a6..c65c3ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log +## 2.5.2 (not released yet) + +### Updated + +- Updates `Get-TeamViewerGroup` to list the assigned PolicyID of a defined group + ## 2.5.1 (not released yet) diff --git a/Cmdlets/TeamViewerPS.psd1 b/Cmdlets/TeamViewerPS.psd1 index ff343a5..46cae75 100644 --- a/Cmdlets/TeamViewerPS.psd1 +++ b/Cmdlets/TeamViewerPS.psd1 @@ -3,7 +3,7 @@ RootModule = 'TeamViewerPS.psm1' # Version number of this module. - ModuleVersion = '2.5.1' + ModuleVersion = '2.5.2' # Supported PSEditions. # CompatiblePSEditions = @()