diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index deeba7d..1dbd115 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,48 +2,48 @@ name: CI # Controls when the workflow will run on: - # Triggers the workflow on push or pull request events but only for the master branch - push: - branches: [ main ] - pull_request: - branches: [ main ] + # Triggers the workflow on push or pull request events but only for the master branch + push: + branches: [main] + pull_request: + branches: [main] - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: jobs: - verify: - runs-on: ubuntu-latest + verify: + runs-on: windows-latest - steps: - # Checks-out the repository under $GITHUB_WORKSPACE, so the job can access it - - uses: actions/checkout@v3 + steps: + # Checks-out the repository under $GITHUB_WORKSPACE, so the job can access it + - uses: actions/checkout@v3 - # Print Powershell version - - name: Powershell Environment - shell: pwsh - run: | - $PSVersionTable - # Run linter - - name: Run linter (via PSScriptAnalyzer) - shell: pwsh - run: | - $ProgressPreference = 'SilentlyContinue' - $ErrorActionPreference = 'Stop' - Install-Module -Name PSScriptAnalyzer -SkipPublisherCheck -Scope CurrentUser -MinimumVersion 1.19.1 -Force -Verbose - Invoke-ScriptAnalyzer -Path $env:GITHUB_WORKSPACE -Recurse -Settings (Join-Path -Path $env:GITHUB_WORKSPACE -ChildPath 'PSScriptAnalyzerSettings.psd1') -ReportSummary -EnableExit - # Run tests - - name: Run tests (via Pester) - shell: pwsh - run: | - $ProgressPreference = 'SilentlyContinue' - Install-Module -Name Pester -SkipPublisherCheck -Scope CurrentUser -MinimumVersion 5.1.1 -Force -Verbose - Invoke-Pester -Path $env:GITHUB_WORKSPACE -Output Detailed -CI - # Build package - - name: Package Build - shell: pwsh - run: | - $ProgressPreference = 'SilentlyContinue' - $ErrorActionPreference = 'Stop' - Install-Module -Name platyPS, BuildHelpers -SkipPublisherCheck -Scope CurrentUser -Force - & $env:GITHUB_WORKSPACE/Build/New-TeamViewerPSPackage.ps1 -Verbose + # Print Powershell version + - name: Powershell Environment + shell: pwsh + run: | + $PSVersionTable + # Run linter + - name: Run linter (via PSScriptAnalyzer) + shell: pwsh + run: | + $ProgressPreference = 'SilentlyContinue' + $ErrorActionPreference = 'Stop' + Install-Module -Name PSScriptAnalyzer -SkipPublisherCheck -Scope CurrentUser -MinimumVersion 1.19.1 -Force -Verbose + Invoke-ScriptAnalyzer -Path $env:GITHUB_WORKSPACE -Recurse -Settings (Join-Path -Path $env:GITHUB_WORKSPACE/Linters -ChildPath 'PSScriptAnalyzer.psd1') -ReportSummary -EnableExit + # Run tests + - name: Run tests (via Pester) + shell: pwsh + run: | + $ProgressPreference = 'SilentlyContinue' + Install-Module -Name Pester -SkipPublisherCheck -Scope CurrentUser -MinimumVersion 5.1.1 -Force -Verbose + Invoke-Pester -Path $env:GITHUB_WORKSPACE -Output Detailed -CI + # Build package + - name: Package Build + shell: pwsh + run: | + $ProgressPreference = 'SilentlyContinue' + $ErrorActionPreference = 'Stop' + Install-Module -Name platyPS, BuildHelpers -SkipPublisherCheck -Scope CurrentUser -Force + & $env:GITHUB_WORKSPACE/Build/New-Package.ps1 -Verbose diff --git a/.github/workflows/powershell-analysis.yml b/.github/workflows/powershell-analysis.yml index a8dc0aa..cd0427c 100644 --- a/.github/workflows/powershell-analysis.yml +++ b/.github/workflows/powershell-analysis.yml @@ -20,9 +20,9 @@ on: jobs: build: name: PSScriptAnalyzer - runs-on: ubuntu-latest + runs-on: windows-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Run PSScriptAnalyzer uses: microsoft/psscriptanalyzer-action@2044ae068e37d0161fa2127de04c19633882f061 @@ -31,8 +31,8 @@ jobs: # The below set up runs PSScriptAnalyzer to your entire repository and runs some basic security rules. path: .\ recurse: true - # Include your own basic security rules. Removing this option will run all the rules - # includeRule: '"PSAvoidGlobalAliases", "PSAvoidUsingConvertToSecureStringWithPlainText"' + # Exclude your own basic security rules. Removing this option will run all the rules + excludeRule: '"PSUseToExportFieldsInManifest","PSAvoidGlobalVars"' output: results.sarif # Upload the SARIF file generated in the previous step diff --git a/.github/workflows/publish_production.yml b/.github/workflows/publish_production.yml index 4ba1430..8b5fc43 100644 --- a/.github/workflows/publish_production.yml +++ b/.github/workflows/publish_production.yml @@ -7,17 +7,17 @@ on: jobs: publish: - runs-on: ubuntu-latest + runs-on: windows-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Build package shell: pwsh run: | $ProgressPreference='SilentlyContinue' Install-Module platyPS,BuildHelpers -Force -SkipPublisherCheck -Scope CurrentUser - & $env:GITHUB_WORKSPACE/Build/New-TeamViewerPSPackage.ps1 -Verbose + & $env:GITHUB_WORKSPACE/Build/New-Package.ps1 -Verbose - name: Publish to powershellgallery.com env: @@ -26,5 +26,5 @@ jobs: run: | $ProgressPreference='SilentlyContinue' Publish-Module ` - -Path $env:GITHUB_WORKSPACE/BuildOutput/TeamViewerPS/ ` + -Path $env:GITHUB_WORKSPACE/Build/Output/ ` -NuGetApiKey $env:NUGET_APIKEY_PRODUCTION diff --git a/.github/workflows/publish_testing.yml b/.github/workflows/publish_testing.yml index bcb105e..b943a5c 100644 --- a/.github/workflows/publish_testing.yml +++ b/.github/workflows/publish_testing.yml @@ -5,17 +5,17 @@ on: jobs: publish: - runs-on: ubuntu-latest + runs-on: windows-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Build package shell: pwsh run: | $ProgressPreference='SilentlyContinue' Install-Module platyPS,BuildHelpers -Force -SkipPublisherCheck -Scope CurrentUser - & $env:GITHUB_WORKSPACE/Build/New-TeamViewerPSPackage.ps1 -Verbose + & $env:GITHUB_WORKSPACE/Build/New-Package.ps1 -Verbose - name: Publish to poshtestgallery.com env: @@ -27,7 +27,7 @@ jobs: -Name PSTestGallery ` -SourceLocation https://www.poshtestgallery.com/api/v2 Publish-Module ` - -Path $env:GITHUB_WORKSPACE/BuildOutput/TeamViewerPS/ ` + -Path $env:GITHUB_WORKSPACE/Build/Output/ ` -NuGetApiKey $env:NUGET_APIKEY_TESTING ` -Repository PSTestGallery ` -Force diff --git a/.gitignore b/.gitignore index 17506b0..9585e52 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -/BuildOutput +/Build/Output diff --git a/.spelling b/.vscode/.spelling similarity index 100% rename from .spelling rename to .vscode/.spelling diff --git a/.vscode/tasks.json b/.vscode/tasks.json index a68e5ee..9274ea4 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -5,7 +5,7 @@ { "label": "Lint (via PSScriptAnalyzer)", "type": "shell", - "command": "Invoke-ScriptAnalyzer -Path '${workspaceFolder}' -Severity Information, Warning, Error -Recurse", + "command": "Invoke-ScriptAnalyzer -Path '${workspaceFolder}/Linters' -Severity Information, Warning, Error -Recurse", "group": { "kind": "build", "isDefault": true diff --git a/Build/New-TeamViewerPSPackage.ps1 b/Build/New-Package.ps1 similarity index 64% rename from Build/New-TeamViewerPSPackage.ps1 rename to Build/New-Package.ps1 index c608dfe..da19d4f 100644 --- a/Build/New-TeamViewerPSPackage.ps1 +++ b/Build/New-Package.ps1 @@ -3,7 +3,7 @@ param( [Parameter()] [string] - $BuildOutputPath = "$(Resolve-Path "$PSScriptRoot/..")/BuildOutput" + $BuildOutputPath = "$(Resolve-Path "$PSScriptRoot/..")/Build/Output" ) $repoPath = Resolve-Path "$PSScriptRoot/.." @@ -14,18 +14,18 @@ if (Test-Path $BuildOutputPath) { } Write-Verbose 'Creating build output directories.' New-Item -Type Directory $BuildOutputPath | Out-Null -New-Item -Type Directory "$BuildOutputPath/TeamViewerPS" | Out-Null + # Compile all functions into a single psm file -$targetFile = "$BuildOutputPath/TeamViewerPS/TeamViewerPS.psm1" +$targetFile = "$BuildOutputPath/TeamViewerPS.psm1" Write-Verbose 'Compiling single-file TeamViewer module.' -$ModuleTypes = @(Get-ChildItem -Path "$repoPath/TeamViewerPS/TeamViewerPS.Types.ps1") +$ModuleTypes = @(Get-ChildItem -Path "$repoPath/Docs/TeamViewerPS.Types.ps1") $PrivateFunctions = @(Get-ChildItem ` - -Path "$repoPath/TeamViewerPS/Private/*.ps1" ` + -Path "$repoPath/Docs/Cmdlets/Private/*.ps1" ` -ErrorAction SilentlyContinue) Write-Verbose "Found $($PrivateFunctions.Count) private function files." $PublicFunctions = @(Get-ChildItem ` - -Path "$repoPath/TeamViewerPS/Public/*.ps1" ` + -Path "$repoPath/Docs/Cmdlets/Public/*.ps1" ` -ErrorAction SilentlyContinue) Write-Verbose "Found $($PublicFunctions.Count) public function files." @($ModuleTypes + $PrivateFunctions + $PublicFunctions) | ` @@ -36,24 +36,24 @@ Write-Verbose "Found $($PublicFunctions.Count) public function files." # Create help from markdown Write-Verbose 'Building help from Markdown' New-ExternalHelp ` - -Path "$repoPath/docs" ` - -OutputPath "$BuildOutputPath/TeamViewerPS/en-US" | ` + -Path "$repoPath/Docs" ` + -OutputPath "$BuildOutputPath/en-US" | ` Out-Null New-ExternalHelp ` - -Path "$repoPath/docs/commands" ` - -OutputPath "$BuildOutputPath/TeamViewerPS/en-US" | ` + -Path "$repoPath/Docs/Cmdlets_help" ` + -OutputPath "$BuildOutputPath/en-US" | ` Out-Null # Create module manifest Write-Verbose 'Creating module manifest' Copy-Item ` - -Path "$repoPath/TeamViewerPS/TeamViewerPS.psd1" ` - -Destination "$BuildOutputPath/TeamViewerPS/" + -Path "$repoPath/Docs/TeamViewerPS.psd1" ` + -Destination "$BuildOutputPath/" Copy-Item ` - -Path "$repoPath/TeamViewerPS/*.format.ps1xml" ` - -Destination "$BuildOutputPath/TeamViewerPS/" + -Path "$repoPath/Docs/*.format.ps1xml" ` + -Destination "$BuildOutputPath/" Update-Metadata ` - -Path "$BuildOutputPath/TeamViewerPS/TeamViewerPS.psd1" ` + -Path "$BuildOutputPath/TeamViewerPS.psd1" ` -PropertyName 'FunctionsToExport' ` -Value $PublicFunctions.BaseName @@ -61,14 +61,14 @@ Update-Metadata ` Write-Verbose 'Copying additional files into the package' Copy-Item ` -Path ` - "$repoPath/LICENSE", ` + "$repoPath/LICENSE.md", ` "$repoPath/CHANGELOG.md", ` "$repoPath/README.md"` - -Destination "$BuildOutputPath/TeamViewerPS/" + -Destination "$BuildOutputPath/" Write-Verbose 'Listing package files:' Push-Location $BuildOutputPath -Get-ChildItem -Recurse "$BuildOutputPath/TeamViewerPS" | ` +Get-ChildItem -Recurse "$BuildOutputPath/" | ` Sort-Object -Property FullName | ` Resolve-Path -Relative Pop-Location diff --git a/CHANGELOG.md b/CHANGELOG.md index f53495d..64affa1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,28 @@ # Change Log +## 2.0.0 (2023-09-13) + +### Added + + -Added 'Set-TeamViewerApiURi' to use TeamViewer test API. + -Added user role commands to remotely manage user roles of a TeamViewer company. + -Added `Add-TeamViewerAssignment` and `Remove-TeamViewerAssignment` commands to assign and unassign a device from a TeamViewer company. + -Added `Add-TeamViewerCustomization` and `Remove-TeamViewerCustomization` commands to apply and remove customization. + -Added `Export-TeamViewerSystemInformation` to create zip file for support. + -Added `Set-TeamViewerPSProxy` and `Remove-TeamViewerPSProxy` to set proxy to access WebAPI. + -Added `Get-TeamViewerInstallationDirectory` to return installation directory. + -Added `Remove-TeamViewerPolicyFromManagedDevice` to remove policies from managed devices. + +### Changed + + -Extended `Invoke-TeamViewerPackageDownload` with MSI package type. + -Folder structure modified. + -`-RemovePolicy` switch removed from `Set-TeamViewerManagedDevice`. + +### Fixed + + -Fixed `Get-TeamViewerLinuxGlobalConfig` to handle null values. + ## 1.5.1 (2023-07-18) - Improved `User ID` parameter handling for `Add-TeamViewerUserGroupMember` and `Remove-TeamViewerUserGroupMember` diff --git a/LICENSE b/LICENSE.md similarity index 100% rename from LICENSE rename to LICENSE.md diff --git a/Linters/PSScriptAnalyzer.psd1 b/Linters/PSScriptAnalyzer.psd1 new file mode 100644 index 0000000..a327eb8 --- /dev/null +++ b/Linters/PSScriptAnalyzer.psd1 @@ -0,0 +1,4 @@ +@{ + Severity = @('Error', 'Warning') + ExcludeRules = @('PSUseToExportFieldsInManifest','PSAvoidGlobalVars') +} diff --git a/PSScriptAnalyzerSettings.psd1 b/PSScriptAnalyzerSettings.psd1 deleted file mode 100644 index 8d6610f..0000000 --- a/PSScriptAnalyzerSettings.psd1 +++ /dev/null @@ -1,4 +0,0 @@ -@{ - Severity = @('Error', 'Warning', 'Information') - ExcludeRules = @('PSUseToExportFieldsInManifest') -} diff --git a/TeamViewerPS/Private/Get-TeamViewerApiUri.ps1 b/TeamViewerPS/Private/Get-TeamViewerApiUri.ps1 deleted file mode 100644 index 404d1ed..0000000 --- a/TeamViewerPS/Private/Get-TeamViewerApiUri.ps1 +++ /dev/null @@ -1,3 +0,0 @@ -function Get-TeamViewerApiUri { - Write-Output 'https://webapi.teamviewer.com/api/v1' -} diff --git a/TeamViewerPS/Public/Test-TeamViewerInstallation.ps1 b/TeamViewerPS/Public/Test-TeamViewerInstallation.ps1 deleted file mode 100644 index 70e2fd1..0000000 --- a/TeamViewerPS/Public/Test-TeamViewerInstallation.ps1 +++ /dev/null @@ -1,18 +0,0 @@ -function Test-TeamViewerInstallation { - switch (Get-OperatingSystem) { - 'Windows' { - $regKey = Get-TeamViewerRegKeyPath - $installationDirectory = if (Test-Path $regKey) { (Get-Item $regKey).GetValue('InstallationDirectory') } - Write-Output ( - $installationDirectory -And ` - (Test-Path "$installationDirectory/TeamViewer.exe") - ) - } - 'Linux' { - Write-Output ( - (Test-Path '/opt/teamviewer/tv_bin/TeamViewer') - ) - } - default { $false } - } -} diff --git a/Tests/Public/Add-TeamViewerAssignment.Tests.ps1 b/Tests/Public/Add-TeamViewerAssignment.Tests.ps1 new file mode 100644 index 0000000..83c150b --- /dev/null +++ b/Tests/Public/Add-TeamViewerAssignment.Tests.ps1 @@ -0,0 +1,68 @@ +BeforeAll { + . "$PSScriptRoot/../../docs/Cmdlets/Public/Add-TeamViewerAssignment.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Get-TeamViewerInstallationDirectory.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Test-TeamViewerInstallation.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Get-TeamViewerVersion.ps1" + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` + ForEach-Object { . $_.FullName } +} +Describe 'Add-TeamViewerAssignment' { + Context 'Windows' { + BeforeAll { + # Testing independent behavior using mocked dependencies + Mock Get-TeamViewerInstallationDirectory { 'testPath' } + Mock Get-TeamViewerVersion { '15.50' } + Mock Test-TeamViewerInstallation { $true } + Mock Set-Location {} + Mock Start-Process {} + Mock Resolve-AssignmentErrorCode {} + Mock Start-Process { + $process = New-Object PSObject -Property @{ + ExitCode = 0 + } + $process + } + } + + It 'Should set the location to the installation directory' { + Add-TeamViewerAssignment -AssignmentId '123' -DeviceAlias 'TestAlias' -Retries 3 + Assert-MockCalled Set-Location -Scope It -Times 1 -ParameterFilter { + $Path -eq 'testPath' + } + } + + It 'Should call TeamViewer.exe assignment with device alias and retries' { + Mock Start-Process -ParameterFilter { $_.FilePath -eq 'TeamViewer.exe' -and $_.ArgumentList -eq 'assignment --id 123 --device-alias=TestAlias --retries=3' } + Add-TeamViewerAssignment -AssignmentId '123' -DeviceAlias 'TestAlias' -Retries 3 + Assert-MockCalled Start-Process -Scope It -Times 1 + } + + It 'Should call TeamViewer.exe assignment with device alias' { + Mock Start-Process -ParameterFilter { $_.FilePath -eq 'TeamViewer.exe' -and $_.ArgumentList -eq 'assignment --id 123 --device-alias=TestAlias' } + Add-TeamViewerAssignment -AssignmentId '123' -DeviceAlias 'TestAlias' + Assert-MockCalled Start-Process -Scope It -Times 1 + } + + It 'Should call TeamViewer.exe assignment with retries' { + Mock Start-Process -ParameterFilter { $_.FilePath -eq 'TeamViewer.exe' -and $_.ArgumentList -eq 'assignment --id 123 --retries=3' } + Add-TeamViewerAssignment -AssignmentId '123' -Retries 3 + Assert-MockCalled Start-Process -Scope It -Times 1 + } + + It 'Should call TeamViewer.exe assignment without device alias or retries' { + Mock Start-Process -ParameterFilter { $_.FilePath -eq 'TeamViewer.exe' -and $_.ArgumentList -eq 'assignment --id 123' } + Add-TeamViewerAssignment -AssignmentId '123' + Assert-MockCalled Start-Process -Scope It -Times 1 + } + + It 'Should restore the current directory after calling cmd.exe' { + $currentDirectory = Get-Location + Add-TeamViewerAssignment -AssignmentId '123' -DeviceAlias 'TestAlias' + Assert-MockCalled Set-Location -Scope It -Times 1 -ParameterFilter { + $Path -eq $currentDirectory + } + } + } +} + + diff --git a/Tests/Public/Add-TeamViewerCustomization.Tests.ps1 b/Tests/Public/Add-TeamViewerCustomization.Tests.ps1 new file mode 100644 index 0000000..ce9e1e5 --- /dev/null +++ b/Tests/Public/Add-TeamViewerCustomization.Tests.ps1 @@ -0,0 +1,79 @@ +BeforeAll { + . "$PSScriptRoot/../../docs/Cmdlets/Public/Add-TeamViewerCustomization.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Test-TeamViewerInstallation.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Get-TeamViewerInstallationDirectory.ps1" + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` + ForEach-Object { . $_.FullName } +} + +Describe 'Add-TeamViewerCustomization' { + Context 'When only Id is provided' { + BeforeAll { + Mock Test-TeamViewerInstallation { $true } + Mock Get-TeamViewerInstallationDirectory { 'testpath' } + Mock Set-Location + Mock Start-Process { + $process = New-Object PSObject -Property @{ + ExitCode = 0 + } + $process + } + Mock Resolve-CustomizationErrorCode {} + } + + It 'Should call TeamViewer.exe customize with the provided Id' { + Mock Start-Process -ParameterFilter { $_.FilePath -eq 'TeamViewer.exe' -and $_.ArgumentList -eq 'customize --id 123"' } + Add-TeamViewerCustomization -Id '123' + Assert-MockCalled Start-Process -Scope It -Times 1 + } + + It 'Should resolve the customization error code' { + Mock Resolve-CustomizationErrorCode {} + Add-TeamViewerCustomization -Id '123' + Assert-MockCalled Resolve-CustomizationErrorCode -Scope It -Times 1 + } + } + + Context 'When only Path is provided' { + BeforeAll { + Mock Test-TeamViewerInstallation { $true } + Mock Get-TeamViewerInstallationDirectory { 'testpath' } + Mock Set-Location + Mock Start-Process { + $process = New-Object PSObject -Property @{ + ExitCode = 0 + } + $process + } + Mock Resolve-CustomizationErrorCode {} + } + + It 'Should call TeamViewer.exe customize with the provided Path' { + Mock Start-Process -ParameterFilter { $_.FilePath -eq 'TeamViewer.exe' -and $_.ArgumentList -eq 'customize --path C:\TeamViewer.zip"' } + Add-TeamViewerCustomization -Path 'C:\TeamViewer.zip' + Assert-MockCalled Start-Process -Scope It -Times 1 + } + + It 'Should resolve the customization error code' { + Mock Resolve-CustomizationErrorCode {} + Add-TeamViewerCustomization -Path 'C:\TeamViewer.zip' + Assert-MockCalled Resolve-CustomizationErrorCode -Scope It -Times 1 + } + } + + + Context 'When TeamViewer is not installed' { + BeforeAll { + Mock Test-TeamViewerInstallation { $false } + Mock Write-Error {} + Mock Start-Process {} + } + + It 'Should write an error message' { + Mock Write-Error -ParameterFilter { $_ -eq 'TeamViewer is not installed' } + Add-TeamViewerCustomization -Id '123' + Assert-MockCalled Start-Process -Scope It -Times 0 + Assert-MockCalled Write-Error -Scope It -Times 1 + } + } +} diff --git a/Tests/Public/Add-TeamViewerManagedDevice.Tests.ps1 b/Tests/Public/Add-TeamViewerManagedDevice.Tests.ps1 index 3b75729..e4997a2 100644 --- a/Tests/Public/Add-TeamViewerManagedDevice.Tests.ps1 +++ b/Tests/Public/Add-TeamViewerManagedDevice.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Add-TeamViewerManagedDevice.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Add-TeamViewerManagedDevice.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/Add-TeamViewerManager.Tests.ps1 b/Tests/Public/Add-TeamViewerManager.Tests.ps1 index cbc2b95..dd605dc 100644 --- a/Tests/Public/Add-TeamViewerManager.Tests.ps1 +++ b/Tests/Public/Add-TeamViewerManager.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Add-TeamViewerManager.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Add-TeamViewerManager.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/Add-TeamViewerRoleToAccount.Tests.ps1 b/Tests/Public/Add-TeamViewerRoleToAccount.Tests.ps1 new file mode 100644 index 0000000..ab247ef --- /dev/null +++ b/Tests/Public/Add-TeamViewerRoleToAccount.Tests.ps1 @@ -0,0 +1,61 @@ +BeforeAll { + . "$PSScriptRoot/../../docs/Cmdlets/Public/Add-TeamViewerRoleToAccount.ps1" + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` + ForEach-Object { . $_.FullName } + + $testApiToken = [securestring]@{} + $null = $testApiToken + $testAccount = @('u123', 'u124') + $null = $testAccount + $testUserRoleId = '9b465ea2-2f75-4101-a057-58a81ed0e57b' + $null = $testUserRoleId + + Mock Get-TeamViewerApiUri { '//unit.test' } + $mockArgs = @{} + Mock Invoke-TeamViewerRestMethod { $mockArgs.Body = $Body + @{ + UserIds = @($testAccount) + UserRoleId = $testUserRoleId + } + } +} +Describe 'Add-TeamViewerRoleToAccount' { + + It 'Should call the correct API endpoint' { + Add-TeamViewerRoleToAccount -ApiToken $testApiToken -UserRoleId $testUserRoleId -Accounts $testAccount + + Assert-MockCalled Invoke-TeamViewerRestMethod -Times 1 -Scope It -ParameterFilter { + $ApiToken -eq $testApiToken -And ` + $Uri -eq '//unit.test/userroles/assign/account' -And ` + $Method -eq 'Post' + } + } + + + It 'Should assign the given account to the user role' { + Add-TeamViewerRoleToAccount ` + -ApiToken $testApiToken ` + -UserRoleId $testUserRoleId ` + -Accounts $testAccount + $mockArgs.Body | Should -Not -BeNullOrEmpty + $body = [System.Text.Encoding]::UTF8.GetString($mockArgs.Body) | ConvertFrom-Json + $body.UserIds | Should -HaveCount 2 + foreach ($id in $testAccount) { + $body.UserIds | Should -Contain $id + } + $body.UserRoleId | Should -Be $testUserRoleId + } + + It 'Should accept pipeline input' { + $testAccount | Add-TeamViewerRoleToAccount ` + -ApiToken $testApiToken ` + -UserRoleId $testUserRoleId + $mockArgs.Body | Should -Not -BeNullOrEmpty + $body = [System.Text.Encoding]::UTF8.GetString($mockArgs.Body) | ConvertFrom-Json + $body.UserIds | Should -HaveCount 2 + foreach ($id in $testAccount) { + $body.UserIds | Should -Contain $id + } + $body.UserRoleId | Should -Be $testUserRoleId + } +} diff --git a/Tests/Public/Add-TeamViewerRoleToUserGroup.Tests.ps1 b/Tests/Public/Add-TeamViewerRoleToUserGroup.Tests.ps1 new file mode 100644 index 0000000..d6ca0ac --- /dev/null +++ b/Tests/Public/Add-TeamViewerRoleToUserGroup.Tests.ps1 @@ -0,0 +1,36 @@ +BeforeAll { + . "$PSScriptRoot/../../docs/Cmdlets/Public/Add-TeamViewerRoleToUserGroup.ps1" + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` + ForEach-Object { . $_.FullName } + + $testApiToken = [securestring]@{} + $null = $testApiToken + $testUserGroup = 1234 + $null = $testUserGroup + $testUserRoleId = '9b465ea2-2f75-4101-a057-58a81ed0e57b' + $null = $testUserRoleId + Mock Get-TeamViewerApiUri { '//unit.test' } + $mockArgs = @{} + Mock Invoke-TeamViewerRestMethod { $mockArgs.Body = $Body + @{ + UserRoleId = $testUserRoleId + UserGroupId = $testUserGroup + } + } +} +Describe 'Add-TeamViewerRoleToUserGroup' { + It 'Should call the correct API endpoint' { + Add-TeamViewerRoleToUserGroup -ApiToken $testApiToken -UserRoleId $testUserRoleId -UserGroup $testUserGroup + Assert-MockCalled Invoke-TeamViewerRestMethod -Times 1 -Scope It -ParameterFilter { + $ApiToken -eq $testApiToken -And ` + $Uri -eq '//unit.test/userroles/assign/usergroup' -And ` + $Method -eq 'Post' + } + } + + # It 'Should return a UserRole/UserGroup object' { + #Request doesn't return a response body + # } + + +} diff --git a/Tests/Public/Add-TeamViewerSsoExclusion.Tests.ps1 b/Tests/Public/Add-TeamViewerSsoExclusion.Tests.ps1 index 77ca1aa..2c4842f 100644 --- a/Tests/Public/Add-TeamViewerSsoExclusion.Tests.ps1 +++ b/Tests/Public/Add-TeamViewerSsoExclusion.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Add-TeamViewerSsoExclusion.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Add-TeamViewerSsoExclusion.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/Add-TeamViewerUserGroupMember.Tests.ps1 b/Tests/Public/Add-TeamViewerUserGroupMember.Tests.ps1 index 9b6e02f..571fb6e 100644 --- a/Tests/Public/Add-TeamViewerUserGroupMember.Tests.ps1 +++ b/Tests/Public/Add-TeamViewerUserGroupMember.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Add-TeamViewerUserGroupMember.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Add-TeamViewerUserGroupMember.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/Connect-TeamViewerApi.Tests.ps1 b/Tests/Public/Connect-TeamViewerApi.Tests.ps1 index 284312e..3d42fb5 100644 --- a/Tests/Public/Connect-TeamViewerApi.Tests.ps1 +++ b/Tests/Public/Connect-TeamViewerApi.Tests.ps1 @@ -1,8 +1,8 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Invoke-TeamViewerPing.ps1" - . "$PSScriptRoot/../../TeamViewerPS/Public/Connect-TeamViewerApi.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Invoke-TeamViewerPing.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Connect-TeamViewerApi.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/Disconnect-TeamViewerApi.Tests.ps1 b/Tests/Public/Disconnect-TeamViewerApi.Tests.ps1 index dff83ae..494b067 100644 --- a/Tests/Public/Disconnect-TeamViewerApi.Tests.ps1 +++ b/Tests/Public/Disconnect-TeamViewerApi.Tests.ps1 @@ -1,5 +1,5 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Disconnect-TeamViewerApi.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Disconnect-TeamViewerApi.ps1" } Describe 'Disconnect-TeamViewerApi' { diff --git a/Tests/Public/Export-TeamViewerSystemInformation.Tests.ps1 b/Tests/Public/Export-TeamViewerSystemInformation.Tests.ps1 new file mode 100644 index 0000000..58610ba --- /dev/null +++ b/Tests/Public/Export-TeamViewerSystemInformation.Tests.ps1 @@ -0,0 +1,55 @@ +BeforeAll { + . "$PSScriptRoot/../../docs/Cmdlets/Public/Export-TeamViewerSystemInformation.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Test-TeamViewerInstallation.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Get-TeamViewerInstallationDirectory.ps1" + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` + ForEach-Object { . $_.FullName } + Mock -CommandName Test-TeamViewerInstallation { return $true } + Mock -CommandName Get-OperatingSystem { return 'Windows' } + Mock -CommandName Get-Location { return 'C:\Temp' } + Mock -CommandName Get-TSCDirectoryFile { return } + Mock -CommandName Get-InstalledSoftware { return } + Mock -CommandName Get-IpConfig { return } + Mock -CommandName Get-MSInfo32 { return } + Mock -CommandName Get-HostFile { return } + Mock -CommandName Get-NSLookUpData { return } + Mock -CommandName Get-RouteTable { return } + Mock -CommandName Get-RegistryPath { return } + Mock -CommandName Get-ClientId { return '12345' } + Mock -CommandName Compress-Archive { return } + Mock -CommandName Test-Path { return $true } + Mock -CommandName Copy-Item {return} +} + +Describe "Export-TeamViewerSystemInformation" { + Context "When TeamViewer is installed on Windows" { + It "Should create a zip file with the correct name" { + $TargetDirectory = 'C:\' + $TempPath = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(), [System.Guid]::NewGuid().ToString()) + $ZipFileName = 'TV_SC_12345_WINPS.zip' + $ZipPath = Join-Path -Path "$TempPath\Data" -ChildPath $ZipFileName + $CompressPath = Compress-Archive -Path $Temp\* -DestinationPath $ZipPath -Force + Mock -CommandName "Join-Path" -MockWith { $ZipPath } + Mock -CommandName "Copy-Item" -MockWith {$null} + Mock -CommandName "Compress-Archive" -MockWith { $CompressPath } + Export-TeamViewerSystemInformation -TargetDirectory $TargetDirectory + Assert-MockCalled -CommandName "Join-Path" -Exactly -Times 1 + Assert-MockCalled -CommandName "Compress-Archive" -Times 1 + } + } + + Context "When TeamViewer is not installed" { + BeforeAll { + Mock -CommandName Test-TeamViewerInstallation -MockWith { return $false } + Mock -CommandName Write-Error -MockWith { return } + } + + It "Should write an error message" { + Mock -CommandName "Write-Error" -MockWith { $null } + Export-TeamViewerSystemInformation + Assert-MockCalled -CommandName "Write-Error" -Exactly -Times 1 + } + } +} + + diff --git a/Tests/Public/Get-TeamViewerAccount.Tests.ps1 b/Tests/Public/Get-TeamViewerAccount.Tests.ps1 index 0076f9a..395b6ce 100644 --- a/Tests/Public/Get-TeamViewerAccount.Tests.ps1 +++ b/Tests/Public/Get-TeamViewerAccount.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Get-TeamViewerAccount.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Get-TeamViewerAccount.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/Get-TeamViewerConnectionReport.Tests.ps1 b/Tests/Public/Get-TeamViewerConnectionReport.Tests.ps1 index fa5847f..62aad8b 100644 --- a/Tests/Public/Get-TeamViewerConnectionReport.Tests.ps1 +++ b/Tests/Public/Get-TeamViewerConnectionReport.Tests.ps1 @@ -1,8 +1,8 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/TeamViewerPS.Types.ps1" - . "$PSScriptRoot/../../TeamViewerPS/Public/Get-TeamViewerConnectionReport.ps1" + . "$PSScriptRoot/../../Docs/TeamViewerPS.Types.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Get-TeamViewerConnectionReport.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} @@ -52,7 +52,7 @@ Describe 'Get-TeamViewerConnectionReport' { It 'Should fetch consecutive pages' { Mock Invoke-TeamViewerRestMethod { @{ - records = @( + records = @( @{ id = '0755a8dd-df19-4ea7-af47-cabb6b2a97e4' userid = 'u1234' @@ -67,7 +67,7 @@ Describe 'Get-TeamViewerConnectionReport' { next_offset = '0755a8dd-df19-4ea7-af47-cabb6b2a97e4' } } Mock Invoke-TeamViewerRestMethod { @{ - records = @( + records = @( @{ id = '5ae6d2a9-57e9-4c62-b236-280390954b6f' userid = 'u5678' @@ -81,7 +81,7 @@ Describe 'Get-TeamViewerConnectionReport' { ) next_offset = '5ae6d2a9-57e9-4c62-b236-280390954b6f' } } -ParameterFilter { $Body.offset_id -eq '0755a8dd-df19-4ea7-af47-cabb6b2a97e4' } - Mock Invoke-TeamViewerRestMethod { @{ + Mock Invoke-TeamViewerRestMethod { @{ records = @( @{ id = '018d007c-9faf-474a-b39a-4021251860e7' @@ -96,6 +96,7 @@ Describe 'Get-TeamViewerConnectionReport' { ) } } -ParameterFilter { $Body.offset_id -eq '5ae6d2a9-57e9-4c62-b236-280390954b6f' } + $result = Get-TeamViewerConnectionReport -ApiToken $testApiToken $result | Should -HaveCount 3 Assert-MockCalled Invoke-TeamViewerRestMethod -Times 3 -Scope It diff --git a/Tests/Public/Get-TeamViewerContact.Tests.ps1 b/Tests/Public/Get-TeamViewerContact.Tests.ps1 index f2cef41..e65a62c 100644 --- a/Tests/Public/Get-TeamViewerContact.Tests.ps1 +++ b/Tests/Public/Get-TeamViewerContact.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Get-TeamViewerContact.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Get-TeamViewerContact.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/Get-TeamViewerCustomModuleId.Tests.ps1 b/Tests/Public/Get-TeamViewerCustomModuleId.Tests.ps1 new file mode 100644 index 0000000..2ebd483 --- /dev/null +++ b/Tests/Public/Get-TeamViewerCustomModuleId.Tests.ps1 @@ -0,0 +1,45 @@ +BeforeAll { + . "$PSScriptRoot/../../docs/Cmdlets/Public/Get-TeamViewerCustomModuleId.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Test-TeamViewerInstallation.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Get-TeamViewerInstallationDirectory.ps1" + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` + ForEach-Object { . $_.FullName } +} + +Describe 'Get-TeamViewerCustomModuleId' { + Context 'When TeamViewer is installed and customization is applied' { + BeforeAll { + Mock Test-TeamViewerInstallation { $true } + Mock Test-Path { $true } + Mock Get-Content { '{"id": "customModuleId"}' } + Mock Get-TeamViewerInstallationDirectory {return 'C:\'} + $installationDirectory = Get-TeamViewerInstallationDirectory + $fileName ='TeamViewer.Json' + $filePath = Join-Path -Path $installationDirectory -ChildPath $fileName + Mock -CommandName Join-Path -MockWith {$filePath} + } + + It 'Should return the custom module ID' { + $expectedId = 'customModuleId' + $result = Get-TeamViewerCustomModuleId + $result | Should -Be $expectedId + } + } + + + Context 'When TeamViewer is not installed' { + BeforeAll { + Mock Test-TeamViewerInstallation { $false } + Mock Write-Error {} + } + + It 'Should write an error message' { + Mock Write-Error -ParameterFilter { $_ -eq 'TeamViewer is not installed' } + Get-TeamViewerCustomModuleId + Assert-MockCalled Write-Error -Scope It -Times 1 + } + } + +} + + diff --git a/Tests/Public/Get-TeamViewerDevice.Tests.ps1 b/Tests/Public/Get-TeamViewerDevice.Tests.ps1 index 7e47d82..eea87a7 100644 --- a/Tests/Public/Get-TeamViewerDevice.Tests.ps1 +++ b/Tests/Public/Get-TeamViewerDevice.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Get-TeamViewerDevice.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Get-TeamViewerDevice.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/Get-TeamViewerEventLog.Tests.ps1 b/Tests/Public/Get-TeamViewerEventLog.Tests.ps1 index a1af8f5..e0b8615 100644 --- a/Tests/Public/Get-TeamViewerEventLog.Tests.ps1 +++ b/Tests/Public/Get-TeamViewerEventLog.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Get-TeamViewerEventLog.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Get-TeamViewerEventLog.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/Get-TeamViewerGroup.Tests.ps1 b/Tests/Public/Get-TeamViewerGroup.Tests.ps1 index 2e0c553..e439a46 100644 --- a/Tests/Public/Get-TeamViewerGroup.Tests.ps1 +++ b/Tests/Public/Get-TeamViewerGroup.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Get-TeamViewerGroup.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Get-TeamViewerGroup.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/Get-TeamViewerId.Tests.ps1 b/Tests/Public/Get-TeamViewerId.Tests.ps1 index 2e92e6e..519c360 100644 --- a/Tests/Public/Get-TeamViewerId.Tests.ps1 +++ b/Tests/Public/Get-TeamViewerId.Tests.ps1 @@ -1,8 +1,8 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Get-TeamViewerId.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Get-TeamViewerId.ps1" - . "$PSScriptRoot/../../TeamViewerPS/Public/Test-TeamViewerInstallation.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + . "$PSScriptRoot/../../docs/Cmdlets/Public/Test-TeamViewerInstallation.ps1" + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } Mock Get-ItemPropertyValue { 123456 } } diff --git a/Tests/Public/Get-TeamViewerInstallationDirectory.Tests.ps1 b/Tests/Public/Get-TeamViewerInstallationDirectory.Tests.ps1 new file mode 100644 index 0000000..b684fb2 --- /dev/null +++ b/Tests/Public/Get-TeamViewerInstallationDirectory.Tests.ps1 @@ -0,0 +1,60 @@ +BeforeAll { + . "$PSScriptRoot/../../docs/Cmdlets/Public/Get-TeamViewerInstallationDirectory.ps1" + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` + ForEach-Object { . $_.FullName } +} + +Describe 'Get-TeamViewerInstallationDirectory' { + Context 'Windows' { + BeforeAll { + Mock Get-OperatingSystem { 'Windows' } + Mock Get-TeamViewerRegKeyPath { 'testRegistry' } + Mock Test-Path { $true } + function Get-TestItemValue([object]$obj) { + } + $testItem = [PSCustomObject]@{} + $testItem | Add-Member ` + -MemberType ScriptMethod ` + -Name GetValue ` + -Value { param($obj) Get-TestItemValue @PSBoundParameters } + Mock Get-TestItemValue { 'testPath' } + Mock Get-Item { $testItem } + } + + It 'Should check the registry path and return the installation directory' { + $result = Get-TeamViewerInstallationDirectory + $result | Should -Be 'testPath' + Assert-MockCalled Test-Path -Scope It -Times 1 -ParameterFilter { + $Path -eq 'testRegistry' + } + Assert-MockCalled Get-Item -Scope It -Times 1 -ParameterFilter { + $Path -eq 'testRegistry' + } + Assert-MockCalled Test-Path -Scope It -Times 1 -ParameterFilter { + $Path -eq 'testPath/TeamViewer.exe' + } + } + + It 'Should return null if registry path does not exist' { + Mock Test-Path -ParameterFilter { $Path -eq 'testRegistry' } { $false } + $result = Get-TeamViewerInstallationDirectory + $result | Should -BeNull + } + } + + Context 'Linux' { + BeforeAll { + Mock Get-OperatingSystem { 'Linux' } + Mock Test-Path { $true } + } + + It 'Should return the Linux installation directory' { + $result = Get-TeamViewerInstallationDirectory + $result | Should -Be '/opt/teamviewer/tv_bin/' + Assert-MockCalled Test-Path -Scope It -Times 1 -ParameterFilter { + $Path -eq '/opt/teamviewer/tv_bin/TeamViewer' + } + } + } + +} diff --git a/Tests/Public/Get-TeamViewerLogFilePath.Tests.ps1 b/Tests/Public/Get-TeamViewerLogFilePath.Tests.ps1 new file mode 100644 index 0000000..191c45b --- /dev/null +++ b/Tests/Public/Get-TeamViewerLogFilePath.Tests.ps1 @@ -0,0 +1,38 @@ +BeforeAll { + . "$PSScriptRoot/../../docs/Cmdlets/Public/Get-TeamViewerLogFilePath.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Test-TeamViewerInstallation.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Get-TeamViewerInstallationDirectory.ps1" + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` + ForEach-Object { . $_.FullName } + + Mock Get-TSCSearchDirectory { + @{ + 'TestFolder1' = @('C:\Logs\TestFolder1') + 'TestFolder2' = @('C:\Logs\TestFolder2') + } + } + Mock Test-Path { $true } + Mock Get-ChildItem { + [PSCustomObject]@{ Name = 'file1.log'; FullName = 'C:\Logs\TestFolder1\file1.log' }, + [PSCustomObject]@{ Name = 'file2.log'; FullName = 'C:\Logs\TestFolder2\file2.log' } + } + +} + +Describe 'Get-TeamViewerLogFilePath function' { + Context 'When TeamViewer is not installed' { + BeforeAll { + Mock Test-TeamViewerInstallation { return $false } + Mock Write-Error { return } + } + + It 'Should write an error message' { + Mock -CommandName 'Write-Error' -MockWith { $null } + Get-TeamViewerLogFilePath + Assert-MockCalled -CommandName 'Write-Error' -Exactly -Times 1 + } + } +} + + + diff --git a/Tests/Public/Get-TeamViewerManagedDevice.Tests.ps1 b/Tests/Public/Get-TeamViewerManagedDevice.Tests.ps1 index 9aa85c9..1058365 100644 --- a/Tests/Public/Get-TeamViewerManagedDevice.Tests.ps1 +++ b/Tests/Public/Get-TeamViewerManagedDevice.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Get-TeamViewerManagedDevice.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Get-TeamViewerManagedDevice.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/Get-TeamViewerManagedGroup.Tests.ps1 b/Tests/Public/Get-TeamViewerManagedGroup.Tests.ps1 index c5da68e..09ee3ad 100644 --- a/Tests/Public/Get-TeamViewerManagedGroup.Tests.ps1 +++ b/Tests/Public/Get-TeamViewerManagedGroup.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Get-TeamViewerManagedGroup.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Get-TeamViewerManagedGroup.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/Get-TeamViewerManagementId.Tests.ps1 b/Tests/Public/Get-TeamViewerManagementId.Tests.ps1 index c7cc18e..97d250c 100644 --- a/Tests/Public/Get-TeamViewerManagementId.Tests.ps1 +++ b/Tests/Public/Get-TeamViewerManagementId.Tests.ps1 @@ -1,8 +1,8 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Get-TeamViewerManagementId.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Get-TeamViewerManagementId.ps1" - . "$PSScriptRoot/../../TeamViewerPS/Public/Test-TeamViewerInstallation.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + . "$PSScriptRoot/../../docs/Cmdlets/Public/Test-TeamViewerInstallation.ps1" + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testManagementId = New-Guid $null = $testManagementId diff --git a/Tests/Public/Get-TeamViewerManager.Tests.ps1 b/Tests/Public/Get-TeamViewerManager.Tests.ps1 index 4639666..69a3226 100644 --- a/Tests/Public/Get-TeamViewerManager.Tests.ps1 +++ b/Tests/Public/Get-TeamViewerManager.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Get-TeamViewerManager.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Get-TeamViewerManager.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/Get-TeamViewerPolicy.Tests.ps1 b/Tests/Public/Get-TeamViewerPolicy.Tests.ps1 index 6d89619..61bca1b 100644 --- a/Tests/Public/Get-TeamViewerPolicy.Tests.ps1 +++ b/Tests/Public/Get-TeamViewerPolicy.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Get-TeamViewerPolicy.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Get-TeamViewerPolicy.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/Get-TeamViewerRoleAssignmentToAccount.Tests.ps1 b/Tests/Public/Get-TeamViewerRoleAssignmentToAccount.Tests.ps1 new file mode 100644 index 0000000..8622899 --- /dev/null +++ b/Tests/Public/Get-TeamViewerRoleAssignmentToAccount.Tests.ps1 @@ -0,0 +1,38 @@ +BeforeAll { + . "$PSScriptRoot/../../docs/Cmdlets/Public/Get-TeamViewerRoleAssignmentToAccount.ps1" + + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` + ForEach-Object { . $_.FullName } + + Mock Get-TeamViewerApiUri { '//unit.test' } + $Assigned = @('u201', 'u202') + Mock Invoke-TeamViewerRestMethod { @{ + ContinuationToken = $null + AssignedToUsers = $Assigned + } } + + $testApiToken = [securestring]@{} + $null = $testApiToken + $testUserRoleId = '72abbedc-9853-4fc8-9d28-fa35e207b048' + $null = $testUserRoleId +} + +Describe 'Get-TeamViewerRoleAssignmentToAccount' { + Context 'When retrieving role assignments' { + It 'Should call the correct API endpoint' { + Get-TeamViewerRoleAssignmentToAccount -ApiToken $testApiToken -UserRoleId $testUserRoleId + + Assert-MockCalled Invoke-TeamViewerRestMethod -Times 1 -Scope It -ParameterFilter { + $ApiToken -eq $testApiToken -And ` + $Uri -eq "//unit.test/userroles/assignments/account?userRoleId=$testUserRoleId" -And ` + $Method -eq 'Get' + } + } + + It 'Should return assigned users' { + $result = Get-TeamViewerRoleAssignmentToAccount -ApiToken $testApiToken -UserRoleId $testUserRoleId + $result | Should -HaveCount 2 + } + + } +} diff --git a/Tests/Public/Get-TeamViewerRoleAssignmentToUserGroup.Tests.ps1 b/Tests/Public/Get-TeamViewerRoleAssignmentToUserGroup.Tests.ps1 new file mode 100644 index 0000000..e13febb --- /dev/null +++ b/Tests/Public/Get-TeamViewerRoleAssignmentToUserGroup.Tests.ps1 @@ -0,0 +1,38 @@ +BeforeAll { + . "$PSScriptRoot/../../docs/Cmdlets/Public/Get-TeamViewerRoleAssignmentToUserGroup.ps1" + + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` + ForEach-Object { . $_.FullName } + + Mock Get-TeamViewerApiUri { '//unit.test' } + $Assigned = @('1001', '1002') + Mock Invoke-TeamViewerRestMethod { @{ + ContinuationToken = $null + AssignedToGroups = $Assigned + } } + + $testApiToken = [securestring]@{} + $null = $testApiToken + $testUserRoleId = '72abbedc-9853-4fc8-9d28-fa35e207b048' + $null = $testUserRoleId +} + +Describe 'Get-TeamViewerRoleAssignmentTouserGroup' { + Context 'When retrieving role assignments' { + It 'Should call the correct API endpoint' { + Get-TeamViewerRoleAssignmentToUserGroup -ApiToken $testApiToken -UserRoleId $testUserRoleId + + Assert-MockCalled Invoke-TeamViewerRestMethod -Times 1 -Scope It -ParameterFilter { + $ApiToken -eq $testApiToken -And ` + $Uri -eq "//unit.test/userroles/assignments/usergroups?userRoleId=$testUserRoleId" -And ` + $Method -eq 'Get' + } + } + + It 'Should return assigned groups' { + $result = Get-TeamViewerRoleAssignmentToUserGroup -ApiToken $testApiToken -UserRoleId $testUserRoleId + $result | Should -HaveCount 2 + } + + } +} diff --git a/Tests/Public/Get-TeamViewerService.Tests.ps1 b/Tests/Public/Get-TeamViewerService.Tests.ps1 index b06ec74..1ab2467 100644 --- a/Tests/Public/Get-TeamViewerService.Tests.ps1 +++ b/Tests/Public/Get-TeamViewerService.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Get-TeamViewerService.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Get-TeamViewerService.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } if (-Not (Get-Command -Name 'Get-Service' -ErrorAction SilentlyContinue)) { diff --git a/Tests/Public/Get-TeamViewerSsoDomain.Tests.ps1 b/Tests/Public/Get-TeamViewerSsoDomain.Tests.ps1 index c70f71d..18509fe 100644 --- a/Tests/Public/Get-TeamViewerSsoDomain.Tests.ps1 +++ b/Tests/Public/Get-TeamViewerSsoDomain.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Get-TeamViewerSsoDomain.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Get-TeamViewerSsoDomain.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/Get-TeamViewerSsoExclusion.Tests.ps1 b/Tests/Public/Get-TeamViewerSsoExclusion.Tests.ps1 index b5785cc..778c89d 100644 --- a/Tests/Public/Get-TeamViewerSsoExclusion.Tests.ps1 +++ b/Tests/Public/Get-TeamViewerSsoExclusion.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Get-TeamViewerSsoExclusion.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Get-TeamViewerSsoExclusion.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/Get-TeamViewerUser.Tests.ps1 b/Tests/Public/Get-TeamViewerUser.Tests.ps1 index 4d61ccb..03aace6 100644 --- a/Tests/Public/Get-TeamViewerUser.Tests.ps1 +++ b/Tests/Public/Get-TeamViewerUser.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Get-TeamViewerUser.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Get-TeamViewerUser.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/Get-TeamViewerUserGroup.Tests.ps1 b/Tests/Public/Get-TeamViewerUserGroup.Tests.ps1 index 79616c0..ac34349 100644 --- a/Tests/Public/Get-TeamViewerUserGroup.Tests.ps1 +++ b/Tests/Public/Get-TeamViewerUserGroup.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Get-TeamViewerUserGroup.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Get-TeamViewerUserGroup.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/Get-TeamViewerUserGroupMember.Tests.ps1 b/Tests/Public/Get-TeamViewerUserGroupMember.Tests.ps1 index 18b76cb..622e8d3 100644 --- a/Tests/Public/Get-TeamViewerUserGroupMember.Tests.ps1 +++ b/Tests/Public/Get-TeamViewerUserGroupMember.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Get-TeamViewerUserGroupMember.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Get-TeamViewerUserGroupMember.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/Get-TeamViewerUserRole.Tests.ps1 b/Tests/Public/Get-TeamViewerUserRole.Tests.ps1 new file mode 100644 index 0000000..39979ce --- /dev/null +++ b/Tests/Public/Get-TeamViewerUserRole.Tests.ps1 @@ -0,0 +1,70 @@ + +BeforeAll { + . "$PSScriptRoot/../../docs/Cmdlets/Public/Get-TeamViewerUserRole.ps1" + + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` + ForEach-Object { . $_.FullName } + + $testApiToken = [securestring]@{} + $null = $testApiToken + + Mock Get-TeamViewerApiUri { '//unit.test' } + Mock Invoke-TeamViewerRestMethod { @{ + Roles = @( + @{ id = 'a9c9435d-8544-4e6a-9830-9337078c9aab'; name = 'Role 1'; }, + @{ id = 'e1631449-6321-4a58-920c-5440029b092e'; name = 'Role 2'; } + ) + } + } +} + +Describe 'Get-TeamViewerUserRole' { + + It 'Should call the correct API endpoint to list roles' { + Get-TeamViewerUserRole -ApiToken $testApiToken + + Assert-MockCalled Invoke-TeamViewerRestMethod -Times 1 -Scope It -ParameterFilter { + $ApiToken -eq $testApiToken -And ` + $Uri -eq '//unit.test/userroles' -And ` + $Method -eq 'Get' } + } + + It 'Should convert input object to TeamViewerPS.UserRole' { + $inputObject = @{ + id = 'a9c9435d-8544-4e6a-9830-9337078c9aab' + name = 'Role 1' + Permissions = @{ + AllowGroupSharing = $true + ManageAdmins = $false + ManageUsers = $true + ModifyConnections = $true + } + } | ConvertTo-Json + + $result = $inputObject | ConvertFrom-Json | ConvertTo-TeamViewerUserRole + + $result | Should -BeOfType [PSCustomObject] + $result.PSObject.TypeNames | Should -Contain 'TeamViewerPS.UserRole' + $result.RoleName | Should -Be 'Role 1' + $result.RoleID | Should -Be 'a9c9435d-8544-4e6a-9830-9337078c9aab' + $result.AllowGroupSharing | Should -Be $true + $result.ManageAdmins | Should -Be $false + $result.ManageUsers | Should -Be $true + $result.ModifyConnections | Should -Be $true + } + + It 'Should call the correct API endpoint for assigned users' { + Get-TeamViewerUserRole -ApiToken $testApiToken + + Assert-MockCalled Invoke-TeamViewerRestMethod -Times 1 -Scope It -ParameterFilter { + $ApiToken -eq $testApiToken -And ` + $Uri -eq '//unit.test/userroles' -And ` + $Method -eq 'Get' } + } + + It 'Should return Role objects' { + $result = Get-TeamViewerUserRole -ApiToken $testApiToken + $result | Should -HaveCount 2 + $result[0].PSObject.TypeNames | Should -Contain 'TeamViewerPS.UserRole' + } +} diff --git a/Tests/Public/Get-TeamViewerVersion.Tests.ps1 b/Tests/Public/Get-TeamViewerVersion.Tests.ps1 index fa60967..add13b3 100644 --- a/Tests/Public/Get-TeamViewerVersion.Tests.ps1 +++ b/Tests/Public/Get-TeamViewerVersion.Tests.ps1 @@ -1,8 +1,8 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Get-TeamViewerVersion.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Get-TeamViewerVersion.ps1" - . "$PSScriptRoot/../../TeamViewerPS/Public/Test-TeamViewerInstallation.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + . "$PSScriptRoot/../../docs/Cmdlets/Public/Test-TeamViewerInstallation.ps1" + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } Mock Get-ItemPropertyValue { '15.10.0' } diff --git a/Tests/Public/Invoke-TeamViewerPing.Tests.ps1 b/Tests/Public/Invoke-TeamViewerPing.Tests.ps1 index 42b59b1..be7ad54 100644 --- a/Tests/Public/Invoke-TeamViewerPing.Tests.ps1 +++ b/Tests/Public/Invoke-TeamViewerPing.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Invoke-TeamViewerPing.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Invoke-TeamViewerPing.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/New-TeamViewerContact.Tests.ps1 b/Tests/Public/New-TeamViewerContact.Tests.ps1 index 93c5848..92de509 100644 --- a/Tests/Public/New-TeamViewerContact.Tests.ps1 +++ b/Tests/Public/New-TeamViewerContact.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/New-TeamViewerContact.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/New-TeamViewerContact.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/New-TeamViewerDevice.Tests.ps1 b/Tests/Public/New-TeamViewerDevice.Tests.ps1 index 4fed522..055aa1b 100644 --- a/Tests/Public/New-TeamViewerDevice.Tests.ps1 +++ b/Tests/Public/New-TeamViewerDevice.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/New-TeamViewerDevice.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/New-TeamViewerDevice.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/New-TeamViewerGroup.Tests.ps1 b/Tests/Public/New-TeamViewerGroup.Tests.ps1 index b5639de..adc594f 100644 --- a/Tests/Public/New-TeamViewerGroup.Tests.ps1 +++ b/Tests/Public/New-TeamViewerGroup.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/New-TeamViewerGroup.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/New-TeamViewerGroup.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/New-TeamViewerManagedGroup.Tests.ps1 b/Tests/Public/New-TeamViewerManagedGroup.Tests.ps1 index eca84e0..51f4a77 100644 --- a/Tests/Public/New-TeamViewerManagedGroup.Tests.ps1 +++ b/Tests/Public/New-TeamViewerManagedGroup.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/New-TeamViewerManagedGroup.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/New-TeamViewerManagedGroup.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/New-TeamViewerPolicy.Tests.ps1 b/Tests/Public/New-TeamViewerPolicy.Tests.ps1 index e7acbed..8ca9745 100644 --- a/Tests/Public/New-TeamViewerPolicy.Tests.ps1 +++ b/Tests/Public/New-TeamViewerPolicy.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/New-TeamViewerPolicy.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/New-TeamViewerPolicy.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/New-TeamViewerUser.Tests.ps1 b/Tests/Public/New-TeamViewerUser.Tests.ps1 index fa1f082..e323143 100644 --- a/Tests/Public/New-TeamViewerUser.Tests.ps1 +++ b/Tests/Public/New-TeamViewerUser.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/New-TeamViewerUser.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/New-TeamViewerUser.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/New-TeamViewerUserGroup.Tests.ps1 b/Tests/Public/New-TeamViewerUserGroup.Tests.ps1 index 14a6d8d..2ee4b6d 100644 --- a/Tests/Public/New-TeamViewerUserGroup.Tests.ps1 +++ b/Tests/Public/New-TeamViewerUserGroup.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/New-TeamViewerUserGroup.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/New-TeamViewerUserGroup.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/New-TeamViewerUserRole.tests.ps1 b/Tests/Public/New-TeamViewerUserRole.tests.ps1 new file mode 100644 index 0000000..ea41399 --- /dev/null +++ b/Tests/Public/New-TeamViewerUserRole.tests.ps1 @@ -0,0 +1,63 @@ +BeforeAll { + . "$PSScriptRoot/../../docs/Cmdlets/Public/New-TeamViewerUserRole.ps1" + + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ForEach-Object { . $_.FullName } + + $testApiToken = [securestring]@{} + $null = $testApiToken + $mockArgs = @{} + $testUserRoleName = 'Test Role' + $testPermissions = 'AllowGroupSharing', 'AssignBackupPolicies' + + Mock Get-TeamViewerApiUri { '//unit.test' } + Mock Invoke-TeamViewerRestMethod { + $mockArgs.Body = $Body + @{ + Role = @{ + Name = $testUserRoleName + Id = '9b465ea2-2f75-4101-a057-58a81ed0e57b' + Permissions = $testPermissions + + } + } + } +} + +Describe 'New-TeamViewerUserRole' { + It 'Should call the correct API endpoint' { + New-TeamViewerUserRole -ApiToken $testApiToken -Name $testUserRoleName + + Assert-MockCalled Invoke-TeamViewerRestMethod -Times 1 -Scope It -ParameterFilter { + $ApiToken -eq $testApiToken -And ` + $Uri -eq '//unit.test/userroles' -And ` + $Method -eq 'Post' + } + } + + It 'Should include the given name in the request' { + New-TeamViewerUserRole -ApiToken $testApiToken -Name $testUserRoleName + + $mockArgs.Body | Should -Not -BeNullOrEmpty + $body = [System.Text.Encoding]::UTF8.GetString($mockArgs.Body) | ConvertFrom-Json + $body.Name | Should -Be $testUserRoleName + } + + It 'Should include the given permissions in the request' { + New-TeamViewerUserRole -ApiToken $testApiToken -Name $testUserRoleName -Permissions $testPermissions + + $mockArgs.Body | Should -Not -BeNullOrEmpty + $body = [System.Text.Encoding]::UTF8.GetString($mockArgs.Body) | ConvertFrom-Json + $body.Permissions | Should -Be $testPermissions + } + + It 'Should return a UserRole object' { + $result = New-TeamViewerUserRole -ApiToken $testApiToken -Name $testUserRoleName -Permissions $testPermissions + $result | Should -Not -BeNullOrEmpty + $result | Should -BeOfType [PSObject] + $result.PSObject.TypeNames | Should -Contain 'TeamViewerPS.UserRole' + $result.RoleName | Should -Be $testUserRoleName + foreach ($Rule in $result.Permissions) { + $result.Permissions.$Rule | Should -Be $testPermissions + } + } +} diff --git a/Tests/Public/Publish-TeamViewerGroup.Tests.ps1 b/Tests/Public/Publish-TeamViewerGroup.Tests.ps1 index 7185679..a7094fc 100644 --- a/Tests/Public/Publish-TeamViewerGroup.Tests.ps1 +++ b/Tests/Public/Publish-TeamViewerGroup.Tests.ps1 @@ -1,6 +1,6 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Publish-TeamViewerGroup.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + . "$PSScriptRoot/../../docs/Cmdlets/Public/Publish-TeamViewerGroup.ps1" + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} $null = $testApiToken diff --git a/Tests/Public/Remove-TeamViewerAssignment.Tests.ps1 b/Tests/Public/Remove-TeamViewerAssignment.Tests.ps1 new file mode 100644 index 0000000..6e71775 --- /dev/null +++ b/Tests/Public/Remove-TeamViewerAssignment.Tests.ps1 @@ -0,0 +1,49 @@ +BeforeAll { + . "$PSScriptRoot/../../docs/Cmdlets/Public/Remove-TeamViewerAssignment.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Get-TeamViewerInstallationDirectory.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Get-TeamViewerVersion.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Test-TeamViewerInstallation.ps1" + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` + ForEach-Object { . $_.FullName } +} +Describe 'Remove-TeamViewerAssignment' { + Context 'Windows' { + BeforeAll { + # Testing independent behavior using mocked dependencies + Mock Get-TeamViewerInstallationDirectory { 'testPath' } + Mock Get-TeamViewerVersion { '15.50' } + Mock Test-TeamViewerInstallation { $true } + Mock Set-Location {} + Mock Start-Process { + $process = New-Object PSObject -Property @{ + ExitCode = 0 + } + $process + } + Mock Resolve-AssignmentErrorCode {} + } + + It 'Should set the location to the installation directory' { + Remove-TeamViewerAssignment + Assert-MockCalled Set-Location -Scope It -Times 1 -ParameterFilter { + $Path -eq 'testPath' + } + } + + + It 'Should call TeamViewer.exe unassignment' { + Mock Start-Process -ParameterFilter { $_.FilePath -eq 'TeamViewer.exe' -and $_.ArgumentList -eq 'unassign' } + Remove-TeamViewerAssignment + Assert-MockCalled Start-Process -Scope It -Times 1 + } + + It 'Should restore the current directory after calling cmd.exe' { + Mock cmd.exe {} + $currentDirectory = Get-Location + Remove-TeamViewerAssignment + Assert-MockCalled Set-Location -Scope It -Times 1 -ParameterFilter { + $Path -eq $currentDirectory + } + } + } +} diff --git a/Tests/Public/Remove-TeamViewerContact.Tests.ps1 b/Tests/Public/Remove-TeamViewerContact.Tests.ps1 index cf4185e..92586de 100644 --- a/Tests/Public/Remove-TeamViewerContact.Tests.ps1 +++ b/Tests/Public/Remove-TeamViewerContact.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Remove-TeamViewerContact.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Remove-TeamViewerContact.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/Remove-TeamViewerCustomization.Tests.ps1 b/Tests/Public/Remove-TeamViewerCustomization.Tests.ps1 new file mode 100644 index 0000000..f09c30d --- /dev/null +++ b/Tests/Public/Remove-TeamViewerCustomization.Tests.ps1 @@ -0,0 +1,51 @@ +BeforeAll { + . "$PSScriptRoot/../../docs/Cmdlets/Public/Remove-TeamViewerCustomization.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Get-TeamViewerInstallationDirectory.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Test-TeamViewerInstallation.ps1" + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` + ForEach-Object { . $_.FullName } +} + +Describe 'Remove-TeamViewerCustomization' { + Context 'When TeamViewer is installed' { + BeforeAll { + Mock Test-TeamViewerInstallation { $true } + Mock Get-TeamViewerInstallationDirectory { 'testpath' } + Mock Set-Location + Mock Start-Process { + $process = New-Object PSObject -Property @{ + ExitCode = 0 + } + $process + } + Mock Resolve-CustomizationErrorCode {} + } + + It 'Should call TeamViewer.exe customize --remove' { + Mock Start-Process -ParameterFilter { $_.FilePath -eq 'TeamViewer.exe' -and $_.ArgumentList -eq 'customize --remove"' } + Remove-TeamViewerCustomization + Assert-MockCalled Start-Process -Scope It -Times 1 + } + + It 'Should resolve the customization error code' { + Mock Resolve-CustomizationErrorCode {} + Remove-TeamViewerCustomization + Assert-MockCalled Resolve-CustomizationErrorCode -Scope It -Times 1 + } + } + + Context 'When TeamViewer is not installed' { + BeforeAll { + Mock Test-TeamViewerInstallation { $false } + Mock Write-Error {} + Mock Start-Process {} + } + + It 'Should write an error message' { + Mock Write-Error -ParameterFilter { $_ -eq 'TeamViewer is not installed' } + Remove-TeamViewerCustomization + Assert-MockCalled Start-Process -Scope It -Times 0 + Assert-MockCalled Write-Error -Scope It -Times 1 + } + } +} diff --git a/Tests/Public/Remove-TeamViewerDevice.Tests.ps1 b/Tests/Public/Remove-TeamViewerDevice.Tests.ps1 index 4a24f6d..da9e90e 100644 --- a/Tests/Public/Remove-TeamViewerDevice.Tests.ps1 +++ b/Tests/Public/Remove-TeamViewerDevice.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Remove-TeamViewerDevice.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Remove-TeamViewerDevice.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/Remove-TeamViewerGroup.Tests.ps1 b/Tests/Public/Remove-TeamViewerGroup.Tests.ps1 index 54d171b..fa50ebd 100644 --- a/Tests/Public/Remove-TeamViewerGroup.Tests.ps1 +++ b/Tests/Public/Remove-TeamViewerGroup.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Remove-TeamViewerGroup.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Remove-TeamViewerGroup.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/Remove-TeamViewerManagedDevice.Tests.ps1 b/Tests/Public/Remove-TeamViewerManagedDevice.Tests.ps1 index 5781c84..ada1a56 100644 --- a/Tests/Public/Remove-TeamViewerManagedDevice.Tests.ps1 +++ b/Tests/Public/Remove-TeamViewerManagedDevice.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Remove-TeamViewerManagedDevice.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Remove-TeamViewerManagedDevice.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/Remove-TeamViewerManagedDeviceManagement.Tests.ps1 b/Tests/Public/Remove-TeamViewerManagedDeviceManagement.Tests.ps1 index 10571a2..424cd82 100644 --- a/Tests/Public/Remove-TeamViewerManagedDeviceManagement.Tests.ps1 +++ b/Tests/Public/Remove-TeamViewerManagedDeviceManagement.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Remove-TeamViewerManagedDeviceManagement.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Remove-TeamViewerManagedDeviceManagement.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/Remove-TeamViewerManagedGroup.Tests.ps1 b/Tests/Public/Remove-TeamViewerManagedGroup.Tests.ps1 index 487e2c8..078a111 100644 --- a/Tests/Public/Remove-TeamViewerManagedGroup.Tests.ps1 +++ b/Tests/Public/Remove-TeamViewerManagedGroup.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Remove-TeamViewerManagedGroup.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Remove-TeamViewerManagedGroup.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/Remove-TeamViewerManager.Tests.ps1 b/Tests/Public/Remove-TeamViewerManager.Tests.ps1 index 2b90adc..4fc7af4 100644 --- a/Tests/Public/Remove-TeamViewerManager.Tests.ps1 +++ b/Tests/Public/Remove-TeamViewerManager.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Remove-TeamViewerManager.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Remove-TeamViewerManager.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/Remove-TeamViewerPSProxy.Tests.ps1 b/Tests/Public/Remove-TeamViewerPSProxy.Tests.ps1 new file mode 100644 index 0000000..674b376 --- /dev/null +++ b/Tests/Public/Remove-TeamViewerPSProxy.Tests.ps1 @@ -0,0 +1,28 @@ + +BeforeAll { + . "$PSScriptRoot/../../docs/Cmdlets/Public/Remove-TeamViewerPSProxy.ps1" + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` + ForEach-Object { . $_.FullName } + + Mock -CommandName 'Remove-TeamViewerPSProxy' -MockWith { + $global:TeamViewerProxyUriSet = $null + $global:TeamViewerProxyUriSet | Out-Null + $global:TeamViewerProxyUriRemoved = $true + $global:TeamViewerProxyUriRemoved | Out-Null + [Environment]::SetEnvironmentVariable('TVProxyUri', '', 'User') + } +} + +Describe "Remove-TeamViewerPSProxy" { + Context "When removing the proxy URI" { + It "Should set the global variable TeamViewerProxyUriRemoved to true" { + Remove-TeamViewerPSProxy + $global:TeamViewerProxyUriRemoved | Should -Be $true + } + + It "Should remove the environment variable TeamViewerProxyUri" { + Remove-TeamViewerPSProxy + [Environment]::GetEnvironmentVariable("TVProxyUri", "User") | Should -BeNullOrEmpty + } + } +} diff --git a/Tests/Public/Remove-TeamViewerPolicy.Tests.ps1 b/Tests/Public/Remove-TeamViewerPolicy.Tests.ps1 index c01638b..722e4c2 100644 --- a/Tests/Public/Remove-TeamViewerPolicy.Tests.ps1 +++ b/Tests/Public/Remove-TeamViewerPolicy.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Remove-TeamViewerPolicy.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Remove-TeamViewerPolicy.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/Remove-TeamViewerPolicyFromManagedDevice.Tests.ps1 b/Tests/Public/Remove-TeamViewerPolicyFromManagedDevice.Tests.ps1 new file mode 100644 index 0000000..049729e --- /dev/null +++ b/Tests/Public/Remove-TeamViewerPolicyFromManagedDevice.Tests.ps1 @@ -0,0 +1,54 @@ +BeforeAll { + . "$PSScriptRoot/../../docs/Cmdlets/Public/Remove-TeamViewerPolicyFromManagedDevice.ps1" + . "$PSScriptRoot/../../docs/TeamViewerPS.Types.ps1" + + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` + ForEach-Object { . $_.FullName } + + $testApiToken = [securestring]@{} + $null = $testApiToken + $testDeviceId = '9e5617cb-2b20-4da2-bca4-c1bda85b29ab' + $null = $testDeviceId + + Mock Get-TeamViewerApiUri { '//unit.test' } + $mockArgs = @{} + Mock Invoke-TeamViewerRestMethod { $mockArgs.Body = $Body } +} + +Describe 'Remove-TeamViewerPolicyFromManagedDevice' { + + It 'Should call the correct API endpoint to remove a policy from the managed device' { + Remove-TeamViewerPolicyFromManagedDevice -ApiToken $testApiToken -Device $testDeviceId -PolicyType TeamViewer + Assert-MockCalled Invoke-TeamViewerRestMethod -Times 1 -Scope It -ParameterFilter { + $ApiToken -eq $testApiToken -And ` + $Uri -eq "//unit.test/managed/devices/$testDeviceId/policy/remove" -And ` + $Method -eq 'Put' } + } + + It 'should remove teamviewer policy from managed device' { + Remove-TeamViewerPolicyFromManagedDevice -apitoken $testapitoken -device $testdeviceid -Policytype TeamViewer + $mockargs.body | Should -Not -BeNullOrEmpty + $body = [system.text.encoding]::utf8.getstring($mockargs.body) | ConvertFrom-Json + $body.policy_type | Should -Be 1 + } + + It 'should remove monitoring policy from managed device' { + Remove-TeamViewerPolicyFromManagedDevice -apitoken $testapitoken -device $testdeviceid -PolicyType Monitoring + $mockargs.body | Should -Not -BeNullOrEmpty + $body = [system.text.encoding]::utf8.getstring($mockargs.body) | ConvertFrom-Json + $body.policy_type | Should -Be 4 + } + + It 'should remove patch management policy from managed device' { + Remove-TeamViewerPolicyFromManagedDevice -apitoken $testapitoken -device $testdeviceid -PolicyType PatchManagement + $mockargs.body | Should -Not -BeNullOrEmpty + $body = [system.text.encoding]::utf8.getstring($mockargs.body) | ConvertFrom-Json + $body.policy_type | Should -Be 5 + } + + It 'Should throw an error when called with invalid policy type' { + { Remove-TeamViewerPolicyFromManagedDevice ` + -ApiToken $testApiToken ` + -Device $testDeviceId -PolicyType 2 } | Should -Throw + } +} diff --git a/Tests/Public/Remove-TeamViewerRoleFromAccount.Tests.ps1 b/Tests/Public/Remove-TeamViewerRoleFromAccount.Tests.ps1 new file mode 100644 index 0000000..dbf9414 --- /dev/null +++ b/Tests/Public/Remove-TeamViewerRoleFromAccount.Tests.ps1 @@ -0,0 +1,60 @@ +BeforeAll { + . "$PSScriptRoot/../../docs/Cmdlets/Public/Remove-TeamViewerRoleFromAccount.ps1" + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` + ForEach-Object { . $_.FullName } + + $testApiToken = [securestring]@{} + $null = $testApiToken + $testAccount = @('u123', 'u124') + $null = $testAccount + $testUserRoleId = '9b465ea2-2f75-4101-a057-58a81ed0e57b' + $null = $testUserRoleId + + Mock Get-TeamViewerApiUri { '//unit.test' } + $mockArgs = @{} + Mock Invoke-TeamViewerRestMethod { $mockArgs.Body = $Body + @{ + UserIds = @($testAccount) + UserRoleId = $testUserRoleId + } + } +} +Describe 'Remove-TeamViewerRoleFromAccount' { + + It 'Should call the correct API endpoint' { + Remove-TeamViewerRoleFromAccount -ApiToken $testApiToken -UserRoleId $testUserRoleId -Accounts $testAccount + + Assert-MockCalled Invoke-TeamViewerRestMethod -Times 1 -Scope It -ParameterFilter { + $ApiToken -eq $testApiToken -And ` + $Uri -eq '//unit.test/userroles/unassign/account' -And ` + $Method -eq 'Post' + } + } + + It 'Should unassign the given account from the user role' { + Remove-TeamViewerRoleFromAccount ` + -ApiToken $testApiToken ` + -UserRoleId $testUserRoleId ` + -Accounts $testAccount + $mockArgs.Body | Should -Not -BeNullOrEmpty + $body = [System.Text.Encoding]::UTF8.GetString($mockArgs.Body) | ConvertFrom-Json + $body.UserIds | Should -HaveCount 2 + foreach ($id in $testAccount) { + $body.UserIds | Should -Contain $id + } + $body.UserRoleId | Should -Be $testUserRoleId + } + + It 'Should accept pipeline input' { + $testAccount | Remove-TeamViewerRoleFromAccount ` + -ApiToken $testApiToken ` + -UserRoleId $testUserRoleId + $mockArgs.Body | Should -Not -BeNullOrEmpty + $body = [System.Text.Encoding]::UTF8.GetString($mockArgs.Body) | ConvertFrom-Json + $body.UserIds | Should -HaveCount 2 + foreach ($id in $testAccount) { + $body.UserIds | Should -Contain $id + } + $body.UserRoleId | Should -Be $testUserRoleId + } +} diff --git a/Tests/Public/Remove-TeamViewerRoleFromUserGroup.Tests.ps1 b/Tests/Public/Remove-TeamViewerRoleFromUserGroup.Tests.ps1 new file mode 100644 index 0000000..750e747 --- /dev/null +++ b/Tests/Public/Remove-TeamViewerRoleFromUserGroup.Tests.ps1 @@ -0,0 +1,41 @@ +BeforeAll { + . "$PSScriptRoot/../../docs/Cmdlets/Public/Remove-TeamViewerRoleFromUserGroup.ps1" + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` + ForEach-Object { . $_.FullName } + + $testApiToken = [securestring]@{} + $null = $testApiToken + $testUserGroup = 1234 + $null = $testUserGroup + + + Mock Get-TeamViewerApiUri { '//unit.test' } + $mockArgs = @{} + Mock Invoke-TeamViewerRestMethod { $mockArgs.Body = $Body + @{ + UserGroupId = $testUserGroup + } + } +} +Describe 'Remove-TeamViewerRoleFromUserGroup' { + + It 'Should call the correct API endpoint' { + Remove-TeamViewerRoleFromUserGroup -ApiToken $testApiToken -UserGroup $testUserGroup + + Assert-MockCalled Invoke-TeamViewerRestMethod -Times 1 -Scope It -ParameterFilter { + $ApiToken -eq $testApiToken -And ` + $Uri -eq '//unit.test/userroles/unassign/usergroup' -And ` + $Method -eq 'Post' + } + } + + It 'Should unassign the given user group from the user role' { + Remove-TeamViewerRoleFromUserGroup ` + -ApiToken $testApiToken ` + -UserGroup $testUserGroup + $mockArgs.Body | Should -Not -BeNullOrEmpty + $body = [System.Text.Encoding]::UTF8.GetString($mockArgs.Body) | ConvertFrom-Json + $body.UserGroupId | Should -HaveCount 1 + $body.UserGroupId | Should -Be $testUserGroup + } +} diff --git a/Tests/Public/Remove-TeamViewerSsoExclusion.Tests.ps1 b/Tests/Public/Remove-TeamViewerSsoExclusion.Tests.ps1 index 17704b8..1054256 100644 --- a/Tests/Public/Remove-TeamViewerSsoExclusion.Tests.ps1 +++ b/Tests/Public/Remove-TeamViewerSsoExclusion.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Remove-TeamViewerSsoExclusion.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Remove-TeamViewerSsoExclusion.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/Remove-TeamViewerUser.Tests.ps1 b/Tests/Public/Remove-TeamViewerUser.Tests.ps1 index 78f6038..fc2ca78 100644 --- a/Tests/Public/Remove-TeamViewerUser.Tests.ps1 +++ b/Tests/Public/Remove-TeamViewerUser.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Remove-TeamViewerUser.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Remove-TeamViewerUser.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/Remove-TeamViewerUserGroup.Tests.ps1 b/Tests/Public/Remove-TeamViewerUserGroup.Tests.ps1 index 8dbe921..b282c0c 100644 --- a/Tests/Public/Remove-TeamViewerUserGroup.Tests.ps1 +++ b/Tests/Public/Remove-TeamViewerUserGroup.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Remove-TeamViewerUserGroup.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Remove-TeamViewerUserGroup.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/Remove-TeamViewerUserGroupMember.Tests.ps1 b/Tests/Public/Remove-TeamViewerUserGroupMember.Tests.ps1 index dfe1add..e0d28e4 100644 --- a/Tests/Public/Remove-TeamViewerUserGroupMember.Tests.ps1 +++ b/Tests/Public/Remove-TeamViewerUserGroupMember.Tests.ps1 @@ -1,9 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Remove-TeamViewerUserGroupMember.ps1" - - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + . "$PSScriptRoot/../../docs/Cmdlets/Public/Remove-TeamViewerUserGroupMember.ps1" + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } - $testApiToken = [securestring]@{} $null = $testApiToken $testMembers = @(123, 456, 789) diff --git a/Tests/Public/Remove-TeamViewerUserRole.Tests.ps1 b/Tests/Public/Remove-TeamViewerUserRole.Tests.ps1 new file mode 100644 index 0000000..3694839 --- /dev/null +++ b/Tests/Public/Remove-TeamViewerUserRole.Tests.ps1 @@ -0,0 +1,37 @@ + +BeforeAll { + . "$PSScriptRoot/../../docs/Cmdlets/Public/Remove-TeamViewerUserRole.ps1" + + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` + ForEach-Object { . $_.FullName } + + $testApiToken = [securestring]@{} + $null = $testApiToken + $testUserRoleId = '2bcf19dc-d5a9-4d25-952e-7cbb21762c9a' + $null = $testUserRoleId + + Mock Get-TeamViewerApiUri { '//unit.test' } + Mock Invoke-TeamViewerRestMethod {} +} +Describe 'Remove-TeamViewerUserRole' { + It 'Should call the correct API endpoint' { + Remove-TeamViewerUserRole -ApiToken $testApiToken -UserRoleId $testUserRoleId + + Assert-MockCalled Invoke-TeamViewerRestMethod -Times 1 -Scope It -ParameterFilter { + $ApiToken -eq $testApiToken -And ` + $Uri -eq "//unit.test/userroles?userRoleId=$testUserRoleId" -And ` + $Method -eq 'Delete' + } + } + + It 'Should handle domain object as input' { + $testUserRole = @{Id = $testUserRoleId; Name = 'test user role' } | ConvertTo-TeamViewerUserRole + Remove-TeamViewerUserRole -ApiToken $testApiToken -UserRoleId $testUserRole.RoleID + + Assert-MockCalled Invoke-TeamViewerRestMethod -Times 1 -Scope It -ParameterFilter { + $ApiToken -eq $testApiToken -And ` + $Uri -eq "//unit.test/userroles?userRoleId=$testUserRoleId" -And ` + $Method -eq 'Delete' + } + } +} diff --git a/Tests/Public/Restart-TeamViewerService.Tests.ps1 b/Tests/Public/Restart-TeamViewerService.Tests.ps1 index 65cd78e..8bc37b8 100644 --- a/Tests/Public/Restart-TeamViewerService.Tests.ps1 +++ b/Tests/Public/Restart-TeamViewerService.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Restart-TeamViewerService.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Restart-TeamViewerService.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } if (-Not (Get-Command -Name 'Restart-Service' -ErrorAction SilentlyContinue)) { diff --git a/Tests/Public/Set-TeamViewerAccount.Tests.ps1 b/Tests/Public/Set-TeamViewerAccount.Tests.ps1 index f86dfb6..78e7bc1 100644 --- a/Tests/Public/Set-TeamViewerAccount.Tests.ps1 +++ b/Tests/Public/Set-TeamViewerAccount.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Set-TeamViewerAccount.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Set-TeamViewerAccount.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/Set-TeamViewerDevice.Tests.ps1 b/Tests/Public/Set-TeamViewerDevice.Tests.ps1 index a291dae..8bdfadf 100644 --- a/Tests/Public/Set-TeamViewerDevice.Tests.ps1 +++ b/Tests/Public/Set-TeamViewerDevice.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Set-TeamViewerDevice.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Set-TeamViewerDevice.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/Set-TeamViewerGroup.Tests.ps1 b/Tests/Public/Set-TeamViewerGroup.Tests.ps1 index fc7496f..04c8b76 100644 --- a/Tests/Public/Set-TeamViewerGroup.Tests.ps1 +++ b/Tests/Public/Set-TeamViewerGroup.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Set-TeamViewerGroup.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Set-TeamViewerGroup.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/Set-TeamViewerManagedDevice.Tests.ps1 b/Tests/Public/Set-TeamViewerManagedDevice.Tests.ps1 index 870e536..f88bc56 100644 --- a/Tests/Public/Set-TeamViewerManagedDevice.Tests.ps1 +++ b/Tests/Public/Set-TeamViewerManagedDevice.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Set-TeamViewerManagedDevice.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Set-TeamViewerManagedDevice.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} @@ -38,19 +38,19 @@ Describe 'Set-TeamViewerManagedDevice' { $body.teamviewerPolicyId | Should -Be '2871c013-3040-4969-9ba4-ce970f4375e8' } - It 'Should remove the managed device policy' { - Set-TeamViewerManagedDevice -ApiToken $testApiToken -Device $testDeviceId -RemovePolicy + It 'Should update the managed device policy to the managed group' { + Set-TeamViewerManagedDevice -ApiToken $testApiToken -Device $testDeviceId -ManagedGroup 'e579cfeb-0b29-4d91-9e81-2d9507f53ff8' $mockArgs.Body | Should -Not -BeNullOrEmpty $body = [System.Text.Encoding]::UTF8.GetString($mockArgs.Body) | ConvertFrom-Json - $body.teamviewerPolicyId | Should -Be '' + $body.managedGroupId | Should -Be 'e579cfeb-0b29-4d91-9e81-2d9507f53ff8' } - It 'Should not be possible to set and remove the policy at the same time' { + It 'Should not be possible to inherit and set a policy at the same time' { { Set-TeamViewerManagedDevice ` -ApiToken $testApiToken ` -Device $testDeviceId ` -Policy '2871c013-3040-4969-9ba4-ce970f4375e8' ` - -RemovePolicy } | Should -Throw + -ManagedGroup '6808db5b-f3c1-4e42-8168-3ac96f5d456e' } | Should -Throw } It 'Should not be possible to use "none" or "inherit" as values for policy' { diff --git a/Tests/Public/Set-TeamViewerManagedGroup.Tests.ps1 b/Tests/Public/Set-TeamViewerManagedGroup.Tests.ps1 index 5f12d7f..df73864 100644 --- a/Tests/Public/Set-TeamViewerManagedGroup.Tests.ps1 +++ b/Tests/Public/Set-TeamViewerManagedGroup.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Set-TeamViewerManagedGroup.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Set-TeamViewerManagedGroup.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/Set-TeamViewerManager.Tests.ps1 b/Tests/Public/Set-TeamViewerManager.Tests.ps1 index b9e0d07..e600144 100644 --- a/Tests/Public/Set-TeamViewerManager.Tests.ps1 +++ b/Tests/Public/Set-TeamViewerManager.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Set-TeamViewerManager.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Set-TeamViewerManager.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/Set-TeamViewerPSProxy.Tests.ps1 b/Tests/Public/Set-TeamViewerPSProxy.Tests.ps1 new file mode 100644 index 0000000..9628118 --- /dev/null +++ b/Tests/Public/Set-TeamViewerPSProxy.Tests.ps1 @@ -0,0 +1,50 @@ +BeforeAll { + . "$PSScriptRoot/../../docs/Cmdlets/Public/Set-TeamViewerPSProxy.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Remove-TeamViewerPSProxy.ps1" + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ForEach-Object { . $_.FullName } + + Mock -CommandName 'Set-TeamViewerPSProxy' -MockWith { + param ( + [Parameter(Mandatory = $true)] + [Uri] + $ProxyUri + ) + + $global:TeamViewerProxyUriSet = $ProxyUri + $global:TeamViewerProxyUriRemoved = $false + $global:TeamViewerProxyUriRemoved | Out-Null + + [Environment]::SetEnvironmentVariable('TVProxyUri', $ProxyUri, 'User') + } + + Mock -CommandName 'Remove-TeamViewerPSProxy' -MockWith { + $global:TeamViewerProxyUriSet = $null + $global:TeamViewerProxyUriSet | Out-Null + $global:TeamViewerProxyUriRemoved = $true + $global:TeamViewerProxyUriRemoved | Out-Null + [Environment]::SetEnvironmentVariable('TVProxyUri', '', 'User') + } +} + +Describe 'Set-TeamViewerPSProxy' { + Context 'When setting the proxy URI' { + It 'Should set the global variable TeamViewerProxyUriSet' { + $expectedProxyUri = 'http://example.com/proxy' + Set-TeamViewerPSProxy -ProxyUri $expectedProxyUri + $global:TeamViewerProxyUriSet | Should -Be $expectedProxyUri + } + + It 'Should set the environment variable TeamViewerProxyUri' { + $expectedProxyUri = 'http://example.com/proxy' + Set-TeamViewerPSProxy -ProxyUri $expectedProxyUri + [Environment]::GetEnvironmentVariable('TVProxyUri', 'User') | Should -Be $expectedProxyUri + } + + It 'Should set the global variable TeamViewerProxyUriRemoved to false' { + $expectedProxyUri = 'http://example.com/proxy' + Set-TeamViewerPSProxy -ProxyUri $expectedProxyUri + $global:TeamViewerProxyUriRemoved | Should -Be $false + Remove-TeamViewerPSProxy + } + } +} diff --git a/Tests/Public/Set-TeamViewerPolicy.Tests.ps1 b/Tests/Public/Set-TeamViewerPolicy.Tests.ps1 index 2968773..d6d810b 100644 --- a/Tests/Public/Set-TeamViewerPolicy.Tests.ps1 +++ b/Tests/Public/Set-TeamViewerPolicy.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Set-TeamViewerPolicy.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Set-TeamViewerPolicy.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/Set-TeamViewerUser.Tests.ps1 b/Tests/Public/Set-TeamViewerUser.Tests.ps1 index 727a144..a1d4a95 100644 --- a/Tests/Public/Set-TeamViewerUser.Tests.ps1 +++ b/Tests/Public/Set-TeamViewerUser.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Set-TeamViewerUser.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Set-TeamViewerUser.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/Set-TeamViewerUserGroup.Tests.ps1 b/Tests/Public/Set-TeamViewerUserGroup.Tests.ps1 index 61e7dd0..868dfd7 100644 --- a/Tests/Public/Set-TeamViewerUserGroup.Tests.ps1 +++ b/Tests/Public/Set-TeamViewerUserGroup.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Set-TeamViewerUserGroup.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Set-TeamViewerUserGroup.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} diff --git a/Tests/Public/Set-TeamViewerUserRole.Tests.ps1 b/Tests/Public/Set-TeamViewerUserRole.Tests.ps1 new file mode 100644 index 0000000..de22d5b --- /dev/null +++ b/Tests/Public/Set-TeamViewerUserRole.Tests.ps1 @@ -0,0 +1,73 @@ +BeforeAll { + . "$PSScriptRoot/../../docs/Cmdlets/Public/Set-TeamViewerUserRole.ps1" + + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ForEach-Object { . $_.FullName } + + $testApiToken = [securestring]@{} + $null = $testApiToken + $mockArgs = @{} + $testUserRoleName = 'Test Role' + $null = $testUserRoleName + $testPermissions = 'AllowGroupSharing', 'AssignBackupPolicies' + $null = $testPermissions + $testUserRoleId = '9b465ea2-2f75-4101-a057-58a81ed0e57b' + $null = $testUserRoleId + + Mock Get-TeamViewerApiUri { '//unit.test' } + Mock Invoke-TeamViewerRestMethod { + $mockArgs.Body = $Body + @{ + Name = $testUserRoleName + Permissions = @($testPermissions) + UserRoleId = $testUserRoleId + + } + } +} + +Describe 'Set-TeamViewerUserRole' { + It 'Should call the correct API endpoint' { + Set-TeamViewerUserRole -ApiToken $testApiToken -Name $testUserRoleName -UserRoleId $testUserRoleId + + Assert-MockCalled Invoke-TeamViewerRestMethod -Times 1 -Scope It -ParameterFilter { + $ApiToken -eq $testApiToken -And ` + $Uri -eq '//unit.test/userroles' -And ` + $Method -eq 'Put' + } + } + + It 'Should include the given name in the request' { + Set-TeamViewerUserRole -ApiToken $testApiToken -Name $testUserRoleName -UserRoleId $testUserRoleId + + $mockArgs.Body | Should -Not -BeNullOrEmpty + $body = [System.Text.Encoding]::UTF8.GetString($mockArgs.Body) | ConvertFrom-Json + $body.Name | Should -Be $testUserRoleName + } + + It 'Should include the given permissions in the request' { + Set-TeamViewerUserRole -ApiToken $testApiToken -Name $testUserRoleName -Permissions $testPermissions -UserRoleId $testUserRoleId + + $mockArgs.Body | Should -Not -BeNullOrEmpty + $body = [System.Text.Encoding]::UTF8.GetString($mockArgs.Body) | ConvertFrom-Json + $body.Permissions | Should -Be $testPermissions + } + + # It 'Should return a UserRole object' { + #Request doesn't return a response body + # } + + It 'Should change user role properties' { + $TestNameChange = 'Test1234' + $testPermissionsChange = 'ModifyConnections' + Set-TeamViewerUserRole ` + -ApiToken $testApiToken ` + -Name $TestNameChange ` + -Permissions $testPermissionsChange ` + -UserRoleId $testUserRoleId + $mockArgs.Body | Should -Not -BeNullOrEmpty + $body = [System.Text.Encoding]::UTF8.GetString($mockArgs.Body) | ConvertFrom-Json + $body.Name | Should -Be 'Test1234' + $body.Permissions | Should -Be 'ModifyConnections' + + } +} diff --git a/Tests/Public/Start-TeamViewerService.Tests.ps1 b/Tests/Public/Start-TeamViewerService.Tests.ps1 index 84d747e..31d450e 100644 --- a/Tests/Public/Start-TeamViewerService.Tests.ps1 +++ b/Tests/Public/Start-TeamViewerService.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Start-TeamViewerService.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Start-TeamViewerService.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } if (-Not (Get-Command -Name 'Start-Service' -ErrorAction SilentlyContinue)) { diff --git a/Tests/Public/Stop-TeamViewerService.Tests.ps1 b/Tests/Public/Stop-TeamViewerService.Tests.ps1 index 31ba6f6..f13eb36 100644 --- a/Tests/Public/Stop-TeamViewerService.Tests.ps1 +++ b/Tests/Public/Stop-TeamViewerService.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Stop-TeamViewerService.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Stop-TeamViewerService.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } if (-Not (Get-Command -Name 'Stop-Service' -ErrorAction SilentlyContinue)) { diff --git a/Tests/Public/Test-TeamViewerConnectivity.Tests.ps1 b/Tests/Public/Test-TeamViewerConnectivity.Tests.ps1 index 8eb1071..8de6069 100644 --- a/Tests/Public/Test-TeamViewerConnectivity.Tests.ps1 +++ b/Tests/Public/Test-TeamViewerConnectivity.Tests.ps1 @@ -1,7 +1,7 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Test-TeamViewerConnectivity.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Test-TeamViewerConnectivity.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } Mock Test-TcpConnection { $true } @@ -75,4 +75,4 @@ Describe 'Test-TeamViewerConnectivity' { $result | Should -BeFalse $result | Should -BeOfType [bool] } -} \ No newline at end of file +} diff --git a/Tests/Public/Test-TeamViewerInstallation.Tests.ps1 b/Tests/Public/Test-TeamViewerInstallation.Tests.ps1 index 72c5a5b..59ddedb 100644 --- a/Tests/Public/Test-TeamViewerInstallation.Tests.ps1 +++ b/Tests/Public/Test-TeamViewerInstallation.Tests.ps1 @@ -1,56 +1,31 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Get-TeamViewerId.ps1" - - . "$PSScriptRoot/../../TeamViewerPS/Public/Test-TeamViewerInstallation.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + . "$PSScriptRoot/../../docs/Cmdlets/Public/Get-TeamViewerInstallationDirectory.ps1" + . "$PSScriptRoot/../../docs/Cmdlets/Public/Test-TeamViewerInstallation.ps1" + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } } Describe 'Test-TeamViewerInstallation' { - Context 'Windows' { + Context 'TeamViewer installed' { BeforeAll { - function Get-TestItemValue([object]$obj) {} - Mock Get-TestItemValue { 'testPath' } - $testItem = [PSCustomObject]@{} - $testItem | Add-Member ` - -MemberType ScriptMethod ` - -Name GetValue ` - -Value { param($obj) Get-TestItemValue @PSBoundParameters } - Mock Get-OperatingSystem { 'Windows' } - Mock Get-TeamViewerRegKeyPath { 'testRegistry' } - Mock Get-Item { $testItem } - Mock Test-Path { $true } + Mock Get-TeamViewerInstallationDirectory { 'C:\Program Files\TeamViewer' } } - It 'Should check the registry path and look for TeamViewer.exe' { - Test-TeamViewerInstallation | Should -BeTrue - Assert-MockCalled Test-Path -Scope It -Times 1 -ParameterFilter { - $Path -eq 'testRegistry' - } - Assert-MockCalled Test-Path -Scope It -Times 1 -ParameterFilter { - $Path -eq 'testPath/TeamViewer.exe' - } - Assert-MockCalled Get-Item -Scope It -Times 1 -ParameterFilter { - $Path -eq 'testRegistry' - } - Assert-MockCalled Get-TestItemValue -Scope It -Times 1 -ParameterFilter { - $obj -eq 'InstallationDirectory' - } + It 'Should return true if TeamViewer is installed' { + $result = Test-TeamViewerInstallation + $result | Should -Be $true } + } - It 'Should return false if registry path does not exist' { - Mock Test-Path -ParameterFilter { $Path -eq 'testRegistry' } { $false } - Test-TeamViewerInstallation | Should -BeFalse + Context 'TeamViewer not installed' { + BeforeAll { + Mock Get-TeamViewerInstallationDirectory { $null } } - It 'Should return false if TeamViewer.exe does not exist' { - Mock Test-Path -ParameterFilter { $Path -eq 'testPath/TeamViewer.exe' } { $false } - Test-TeamViewerInstallation | Should -BeFalse + It 'Should return false if TeamViewer is not installed' { + $result = Test-TeamViewerInstallation + $result | Should -Be $false } } - - It 'Should return false on unsupported platforms' { - Mock Get-OperatingSystem { 'SomeOtherPlatform' } - Test-TeamViewerInstallation | Should -BeFalse - } } + diff --git a/Tests/Public/Unpublish-TeamViewerGroup.Tests.ps1 b/Tests/Public/Unpublish-TeamViewerGroup.Tests.ps1 index 80eb438..b9a96b7 100644 --- a/Tests/Public/Unpublish-TeamViewerGroup.Tests.ps1 +++ b/Tests/Public/Unpublish-TeamViewerGroup.Tests.ps1 @@ -1,6 +1,6 @@ BeforeAll { - . "$PSScriptRoot/../../TeamViewerPS/Public/Unpublish-TeamViewerGroup.ps1" - @(Get-ChildItem -Path "$PSScriptRoot/../../TeamViewerPS/Private/*.ps1") | ` + . "$PSScriptRoot/../../docs/Cmdlets/Public/Unpublish-TeamViewerGroup.ps1" + @(Get-ChildItem -Path "$PSScriptRoot/../../docs/Cmdlets/Private/*.ps1") | ` ForEach-Object { . $_.FullName } $testApiToken = [securestring]@{} $null = $testApiToken diff --git a/docs/Cmdlets/Private/Add-Registry.ps1 b/docs/Cmdlets/Private/Add-Registry.ps1 new file mode 100644 index 0000000..bab75a6 --- /dev/null +++ b/docs/Cmdlets/Private/Add-Registry.ps1 @@ -0,0 +1,40 @@ +function Add-Registry { + param ( + [Microsoft.Win32.RegistryKey]$RegKey, + [string]$Program + ) + + #CustomObject including all information for each registry and sub keys + $retRegKey = [PSCustomObject]@{ + Program = $Program + RegistryPath = $RegKey.Name + Entries = @() + } + Write-Output "Collecting registry data $($retRegKey.RegistryPath)" + foreach ($valueName in $RegKey.GetValueNames()) { + $value = $RegKey.GetValue($valueName) + $type, $value = Get-TypeAndValueOfRegistryValue -RegKey $RegKey -ValueName $valueName + $blackList = @('BuddyLoginTokenAES', 'BuddyLoginTokenSecretAES', 'Certificate', 'CertificateKey', 'CertificateKeyProtected', + 'MultiPwdMgmtPwdData', 'PermanentPassword', 'PK', 'SecurityPasswordAES', 'SK', 'SRPPasswordMachineIdentifier') + foreach ($blackListValue in $blackList) { + if ($valueName -eq $blackListValue) { + $value = '___PRIVATE___' + } + } + $entry = [PSCustomObject]@{ + Name = $valueName + Value = $value + Type = $type + } + $retRegKey.Entries += $entry + } + + foreach ($subKeyName in $RegKey.GetSubKeyNames()) { + $subKey = $RegKey.OpenSubKey($subKeyName) + Add-Registry -RegKey $subKey -Program $subKeyName + } + #Adding CustomObject to array declared in Get-RegistryPaths + $AllTVRegistryData.Add($retRegKey) | Out-Null +} + + diff --git a/TeamViewerPS/Private/ConvertTo-DateTime.ps1 b/docs/Cmdlets/Private/ConvertTo-DateTime.ps1 similarity index 100% rename from TeamViewerPS/Private/ConvertTo-DateTime.ps1 rename to docs/Cmdlets/Private/ConvertTo-DateTime.ps1 diff --git a/TeamViewerPS/Private/ConvertTo-ErrorRecord.ps1 b/docs/Cmdlets/Private/ConvertTo-ErrorRecord.ps1 similarity index 100% rename from TeamViewerPS/Private/ConvertTo-ErrorRecord.ps1 rename to docs/Cmdlets/Private/ConvertTo-ErrorRecord.ps1 diff --git a/TeamViewerPS/Private/ConvertTo-TeamViewerAccount.ps1 b/docs/Cmdlets/Private/ConvertTo-TeamViewerAccount.ps1 similarity index 100% rename from TeamViewerPS/Private/ConvertTo-TeamViewerAccount.ps1 rename to docs/Cmdlets/Private/ConvertTo-TeamViewerAccount.ps1 diff --git a/TeamViewerPS/Private/ConvertTo-TeamViewerAuditEvent.ps1 b/docs/Cmdlets/Private/ConvertTo-TeamViewerAuditEvent.ps1 similarity index 100% rename from TeamViewerPS/Private/ConvertTo-TeamViewerAuditEvent.ps1 rename to docs/Cmdlets/Private/ConvertTo-TeamViewerAuditEvent.ps1 diff --git a/TeamViewerPS/Private/ConvertTo-TeamViewerConnectionReport.ps1 b/docs/Cmdlets/Private/ConvertTo-TeamViewerConnectionReport.ps1 similarity index 100% rename from TeamViewerPS/Private/ConvertTo-TeamViewerConnectionReport.ps1 rename to docs/Cmdlets/Private/ConvertTo-TeamViewerConnectionReport.ps1 diff --git a/TeamViewerPS/Private/ConvertTo-TeamViewerContact.ps1 b/docs/Cmdlets/Private/ConvertTo-TeamViewerContact.ps1 similarity index 100% rename from TeamViewerPS/Private/ConvertTo-TeamViewerContact.ps1 rename to docs/Cmdlets/Private/ConvertTo-TeamViewerContact.ps1 diff --git a/TeamViewerPS/Private/ConvertTo-TeamViewerDevice.ps1 b/docs/Cmdlets/Private/ConvertTo-TeamViewerDevice.ps1 similarity index 100% rename from TeamViewerPS/Private/ConvertTo-TeamViewerDevice.ps1 rename to docs/Cmdlets/Private/ConvertTo-TeamViewerDevice.ps1 diff --git a/TeamViewerPS/Private/ConvertTo-TeamViewerGroup.ps1 b/docs/Cmdlets/Private/ConvertTo-TeamViewerGroup.ps1 similarity index 100% rename from TeamViewerPS/Private/ConvertTo-TeamViewerGroup.ps1 rename to docs/Cmdlets/Private/ConvertTo-TeamViewerGroup.ps1 diff --git a/TeamViewerPS/Private/ConvertTo-TeamViewerGroupShare.ps1 b/docs/Cmdlets/Private/ConvertTo-TeamViewerGroupShare.ps1 similarity index 100% rename from TeamViewerPS/Private/ConvertTo-TeamViewerGroupShare.ps1 rename to docs/Cmdlets/Private/ConvertTo-TeamViewerGroupShare.ps1 diff --git a/TeamViewerPS/Private/ConvertTo-TeamViewerManagedDevice.ps1 b/docs/Cmdlets/Private/ConvertTo-TeamViewerManagedDevice.ps1 similarity index 100% rename from TeamViewerPS/Private/ConvertTo-TeamViewerManagedDevice.ps1 rename to docs/Cmdlets/Private/ConvertTo-TeamViewerManagedDevice.ps1 diff --git a/TeamViewerPS/Private/ConvertTo-TeamViewerManagedGroup.ps1 b/docs/Cmdlets/Private/ConvertTo-TeamViewerManagedGroup.ps1 similarity index 100% rename from TeamViewerPS/Private/ConvertTo-TeamViewerManagedGroup.ps1 rename to docs/Cmdlets/Private/ConvertTo-TeamViewerManagedGroup.ps1 diff --git a/TeamViewerPS/Private/ConvertTo-TeamViewerManager.ps1 b/docs/Cmdlets/Private/ConvertTo-TeamViewerManager.ps1 similarity index 100% rename from TeamViewerPS/Private/ConvertTo-TeamViewerManager.ps1 rename to docs/Cmdlets/Private/ConvertTo-TeamViewerManager.ps1 diff --git a/TeamViewerPS/Private/ConvertTo-TeamViewerPolicy.ps1 b/docs/Cmdlets/Private/ConvertTo-TeamViewerPolicy.ps1 similarity index 100% rename from TeamViewerPS/Private/ConvertTo-TeamViewerPolicy.ps1 rename to docs/Cmdlets/Private/ConvertTo-TeamViewerPolicy.ps1 diff --git a/TeamViewerPS/Private/ConvertTo-TeamViewerRestError.ps1 b/docs/Cmdlets/Private/ConvertTo-TeamViewerRestError.ps1 similarity index 100% rename from TeamViewerPS/Private/ConvertTo-TeamViewerRestError.ps1 rename to docs/Cmdlets/Private/ConvertTo-TeamViewerRestError.ps1 diff --git a/docs/Cmdlets/Private/ConvertTo-TeamViewerRoleAssignedUser.ps1 b/docs/Cmdlets/Private/ConvertTo-TeamViewerRoleAssignedUser.ps1 new file mode 100644 index 0000000..a0b7667 --- /dev/null +++ b/docs/Cmdlets/Private/ConvertTo-TeamViewerRoleAssignedUser.ps1 @@ -0,0 +1,13 @@ +function ConvertTo-TeamViewerRoleAssignedUser { + param( + [Parameter(ValueFromPipeline)] + [PSObject] + $InputObject + ) + process { + $properties = @{AssignedUsers = ($InputObject.trim('u'))} + $result = New-Object -TypeName PSObject -Property $properties + $result.PSObject.TypeNames.Insert(0, 'TeamViewerPS.RoleAssignedUser') + Write-Output $result + } +} diff --git a/docs/Cmdlets/Private/ConvertTo-TeamViewerRoleAssignedUserGroup.ps1 b/docs/Cmdlets/Private/ConvertTo-TeamViewerRoleAssignedUserGroup.ps1 new file mode 100644 index 0000000..06e0658 --- /dev/null +++ b/docs/Cmdlets/Private/ConvertTo-TeamViewerRoleAssignedUserGroup.ps1 @@ -0,0 +1,13 @@ +function ConvertTo-TeamViewerRoleAssignedUserGroup { + param( + [Parameter(ValueFromPipeline)] + [PSObject] + $InputObject + ) + process { + $properties = @{AssignedGroups = ($InputObject)} + $result = New-Object -TypeName PSObject -Property $properties + $result.PSObject.TypeNames.Insert(0, 'TeamViewerPS.RoleAssignedUserGroup') + Write-Output $result + } +} diff --git a/TeamViewerPS/Private/ConvertTo-TeamViewerSsoDomain.ps1 b/docs/Cmdlets/Private/ConvertTo-TeamViewerSsoDomain.ps1 similarity index 100% rename from TeamViewerPS/Private/ConvertTo-TeamViewerSsoDomain.ps1 rename to docs/Cmdlets/Private/ConvertTo-TeamViewerSsoDomain.ps1 diff --git a/TeamViewerPS/Private/ConvertTo-TeamViewerUser.ps1 b/docs/Cmdlets/Private/ConvertTo-TeamViewerUser.ps1 similarity index 100% rename from TeamViewerPS/Private/ConvertTo-TeamViewerUser.ps1 rename to docs/Cmdlets/Private/ConvertTo-TeamViewerUser.ps1 diff --git a/TeamViewerPS/Private/ConvertTo-TeamViewerUserGroup.ps1 b/docs/Cmdlets/Private/ConvertTo-TeamViewerUserGroup.ps1 similarity index 96% rename from TeamViewerPS/Private/ConvertTo-TeamViewerUserGroup.ps1 rename to docs/Cmdlets/Private/ConvertTo-TeamViewerUserGroup.ps1 index 7ed14d5..c2272d2 100644 --- a/TeamViewerPS/Private/ConvertTo-TeamViewerUserGroup.ps1 +++ b/docs/Cmdlets/Private/ConvertTo-TeamViewerUserGroup.ps1 @@ -1,16 +1,16 @@ -function ConvertTo-TeamViewerUserGroup { - param( - [Parameter(ValueFromPipeline)] - [PSObject] - $InputObject - ) - process { - $properties = @{ - Id = [UInt64]$InputObject.id - Name = $InputObject.name - } - $result = New-Object -TypeName PSObject -Property $properties - $result.PSObject.TypeNames.Insert(0, 'TeamViewerPS.UserGroup') - Write-Output $result - } -} +function ConvertTo-TeamViewerUserGroup { + param( + [Parameter(ValueFromPipeline)] + [PSObject] + $InputObject + ) + process { + $properties = @{ + Id = [UInt64]$InputObject.id + Name = $InputObject.name + } + $result = New-Object -TypeName PSObject -Property $properties + $result.PSObject.TypeNames.Insert(0, 'TeamViewerPS.UserGroup') + Write-Output $result + } +} diff --git a/TeamViewerPS/Private/ConvertTo-TeamViewerUserGroupMember.ps1 b/docs/Cmdlets/Private/ConvertTo-TeamViewerUserGroupMember.ps1 similarity index 96% rename from TeamViewerPS/Private/ConvertTo-TeamViewerUserGroupMember.ps1 rename to docs/Cmdlets/Private/ConvertTo-TeamViewerUserGroupMember.ps1 index e9d3ab2..8c16f11 100644 --- a/TeamViewerPS/Private/ConvertTo-TeamViewerUserGroupMember.ps1 +++ b/docs/Cmdlets/Private/ConvertTo-TeamViewerUserGroupMember.ps1 @@ -1,16 +1,16 @@ -function ConvertTo-TeamViewerUserGroupMember { - param( - [Parameter(ValueFromPipeline)] - [PSObject] - $InputObject - ) - process { - $properties = @{ - AccountId = [int]$InputObject.accountId - Name = $InputObject.name - } - $result = New-Object -TypeName PSObject -Property $properties - $result.PSObject.TypeNames.Insert(0, 'TeamViewerPS.UserGroupMember') - Write-Output $result - } -} +function ConvertTo-TeamViewerUserGroupMember { + param( + [Parameter(ValueFromPipeline)] + [PSObject] + $InputObject + ) + process { + $properties = @{ + AccountId = [int]$InputObject.accountId + Name = $InputObject.name + } + $result = New-Object -TypeName PSObject -Property $properties + $result.PSObject.TypeNames.Insert(0, 'TeamViewerPS.UserGroupMember') + Write-Output $result + } +} diff --git a/docs/Cmdlets/Private/ConvertTo-TeamViewerUserRole.ps1 b/docs/Cmdlets/Private/ConvertTo-TeamViewerUserRole.ps1 new file mode 100644 index 0000000..3ecf278 --- /dev/null +++ b/docs/Cmdlets/Private/ConvertTo-TeamViewerUserRole.ps1 @@ -0,0 +1,25 @@ +function ConvertTo-TeamViewerUserRole { + param( + [Parameter(ValueFromPipeline)] + [PSObject] + $InputObject + ) + process { + $properties = @{ + RoleName = $InputObject.Name + RoleID = $InputObject.Id + } + if ($InputObject.Permissions) { + foreach ($permission in $InputObject.Permissions.PSObject.Properties) { + $properties[$permission.Name] = $permission.Value + } + } + $result = New-Object -TypeName PSObject -Property $properties + $result.PSObject.TypeNames.Insert(0, 'TeamViewerPS.UserRole') + $result | Add-Member -MemberType ScriptMethod -Name 'ToString' -Force -Value { + Write-Output "[$($this.RoleName)] [$($this.RoleID)] $($this.Permissions))" + } + Write-Output $result + } +} + diff --git a/docs/Cmdlets/Private/Get-ClientId.ps1 b/docs/Cmdlets/Private/Get-ClientId.ps1 new file mode 100644 index 0000000..eedf9f6 --- /dev/null +++ b/docs/Cmdlets/Private/Get-ClientId.ps1 @@ -0,0 +1,11 @@ +function Get-ClientId { + if (Test-Path -Path 'HKLM:\SOFTWARE\Wow6432Node\TeamViewer') { + $mainKey = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\TeamViewer' + $id = [int]$mainKey.ClientID + } + elseif (Test-Path -Path 'HKLM:\Software\TeamViewer') { + $mainKey = Get-ItemProperty -Path 'HKLM:\Software\TeamViewer' + $id = [int]$mainKey.ClientID + } + return $id +} diff --git a/docs/Cmdlets/Private/Get-HostFile.ps1 b/docs/Cmdlets/Private/Get-HostFile.ps1 new file mode 100644 index 0000000..e36a499 --- /dev/null +++ b/docs/Cmdlets/Private/Get-HostFile.ps1 @@ -0,0 +1,15 @@ +function Get-HostFile { + param( + [Parameter(ValueFromPipeline = $true)] + [string] + $OutputPath + ) + process { + $regPath = 'HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters' + $regKey = Get-ItemProperty -Path $regPath + $hostsPath = Join-Path -Path $regKey.DataBasePath -ChildPath 'hosts' + $hostsFile = Get-Content -Path $hostsPath + $hostsFile | Out-File -FilePath "$OutputPath\Data\hosts.txt" + Write-Output "hosts file collected and saved to $OutputPath\Data\hosts.txt" + } +} diff --git a/docs/Cmdlets/Private/Get-InstalledSoftware.ps1 b/docs/Cmdlets/Private/Get-InstalledSoftware.ps1 new file mode 100644 index 0000000..604cd3a --- /dev/null +++ b/docs/Cmdlets/Private/Get-InstalledSoftware.ps1 @@ -0,0 +1,38 @@ +function Get-InstalledSoftware { + param( + [Parameter(ValueFromPipeline = $true)] + [string] + $OutputPath + ) + Begin { + $regUninstall = @{ + InstalledSoftware32 = 'HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall' + InstalledSoftware64 = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall' + } + } + Process { + foreach ($Name in $regUninstall.keys) { + $regKeys = $regUninstall[$Name] + $regKey = Get-ItemProperty -Path "$regKeys\*" + if ($null -ne $regKey) { + $subKeys = $regKey.PSChildName + if ($null -ne $subKeys) { + $installedPrograms = @() + foreach ($subKey in $subKeys) { + $tmpSubkey = Get-ItemProperty -Path "$regKeys\$subKey" + $programmName = $tmpSubkey.DisplayName + $displayVersion = $tmpSubkey.DisplayVersion + if ($null -ne $programmName) { + $tmpSoftwareData = "$programmName | $displayVersion" + $installedPrograms += $tmpSoftwareData + } + } + } + $installedPrograms | Sort-Object | Out-File -FilePath "$OutputPath\Data\$Name.txt" + Write-Output "$Name collected and saved to $OutputPath\Data\$Name.txt" + } + } + } +} + + diff --git a/docs/Cmdlets/Private/Get-IpConfig.ps1 b/docs/Cmdlets/Private/Get-IpConfig.ps1 new file mode 100644 index 0000000..4bd3bdf --- /dev/null +++ b/docs/Cmdlets/Private/Get-IpConfig.ps1 @@ -0,0 +1,16 @@ +function Get-IpConfig { + param( + [Parameter(ValueFromPipeline = $true)] + [string] + $OutputPath + ) + Process { + try { + ipconfig /all | Out-File -FilePath "$OutputPath\Data\ipconfig.txt" -Encoding utf8 + Write-Output "ipconfig data collected and saved to $OutputPath\Data\ipconfig.txt" + } + catch { + Write-Error "An error occurred while collecting ipconfig data: $_" + } + } +} diff --git a/docs/Cmdlets/Private/Get-MSInfo32.ps1 b/docs/Cmdlets/Private/Get-MSInfo32.ps1 new file mode 100644 index 0000000..29929c8 --- /dev/null +++ b/docs/Cmdlets/Private/Get-MSInfo32.ps1 @@ -0,0 +1,17 @@ +function Get-MSInfo32 { + param( + [Parameter(ValueFromPipeline = $true)] + [string] + $OutputPath + ) + Process { + try { + Start-Process -FilePath msinfo32.exe -ArgumentList "/nfo $OutputPath\Data\msinfo32.nfo" -Wait + + Write-Output "msinfo data collected and saved to $OutputPath\Data\msinfo32.nfo" + } + catch { + Write-Error "An error occurred while collecting msinfo data: $_" + } + } +} diff --git a/docs/Cmdlets/Private/Get-NSLookUpData.ps1 b/docs/Cmdlets/Private/Get-NSLookUpData.ps1 new file mode 100644 index 0000000..7838c7f --- /dev/null +++ b/docs/Cmdlets/Private/Get-NSLookUpData.ps1 @@ -0,0 +1,50 @@ +function Get-NSLookUpData { + param( + [Parameter(ValueFromPipeline = $true)] + [string] + $OutputPath + ) + Begin { + $Ipv4DnsServer = @($null, 'tv-ns1.teamviewer.com', 'tv-ns2.teamviewer.com', 'tv-ns3.teamviewer.com', + 'tv-ns4.teamviewer.com', 'tv-ns5.teamviewer.com', '8.8.8.8', '1.1.1.1') + $Ipv4DnsName = @( 'master1.teamviewer.com', 'router1.teamviewer.com', 'google.com', + 'login.teamviewer.com', 'www.teamviewer.com') + $output = $null + } + Process { + try { + foreach ($DnsName in $Ipv4DnsName ) { + foreach ($DnsServer in $Ipv4DnsServer) { + Write-Output "Collecting nslookup.exe information from $DnsName $DnsServer. This might take a while" + $output += "nslookup information for: $DnsName $DnsServer `r`n" + $arguments = "-debug ""$DnsName""" + if ($DnsServer) { + $arguments += " ""$DnsServer""" + } + $processInfo = New-Object System.Diagnostics.ProcessStartInfo + $processInfo.FileName = 'nslookup.exe' + $processInfo.Arguments = $arguments + $processInfo.WindowStyle = 'Hidden' + $processInfo.UseShellExecute = $false + $processInfo.RedirectStandardOutput = $true + + $process = [System.Diagnostics.Process]::Start($processInfo) + $output += $process.StandardOutput.ReadToEnd() + $process.WaitForExit(60000) + if (-not $process.HasExited) { + $process.Kill() + continue + } + $output += $process.StandardOutput.ReadToEnd() + } + } + $output | Out-File "$OutputPath\Data\nslookup.txt" + } + + catch { + Write-Error "Error collecting nslookup information: $_" + } + } +} + + diff --git a/TeamViewerPS/Private/Get-OperatingSystem.ps1 b/docs/Cmdlets/Private/Get-OperatingSystem.ps1 similarity index 100% rename from TeamViewerPS/Private/Get-OperatingSystem.ps1 rename to docs/Cmdlets/Private/Get-OperatingSystem.ps1 diff --git a/docs/Cmdlets/Private/Get-RegistryPath.ps1 b/docs/Cmdlets/Private/Get-RegistryPath.ps1 new file mode 100644 index 0000000..74c9782 --- /dev/null +++ b/docs/Cmdlets/Private/Get-RegistryPath.ps1 @@ -0,0 +1,47 @@ +function Get-RegistryPath { + param( + [Parameter(ValueFromPipeline = $true)] + [string] + $OutputPath + ) + Begin { + $SearchProgramms = @('TeamViewer', 'Blizz', 'TeamViewerMeeting') + $RegistrySearchPathsLocalMachine = @('SOFTWARE\Wow6432Node', 'SOFTWARE') + $RegistrySearchPathsCurrentUser = @('SOFTWARE') + $AllTVRegistryData = New-Object System.Collections.ArrayList + } + + Process { + foreach ($searchProgramm in $SearchProgramms) { + foreach ($registrySearchPath in $RegistrySearchPathsLocalMachine) { + $regKey = [Microsoft.Win32.Registry]::LocalMachine.OpenSubKey("$registrySearchPath\$searchProgramm", $false) + if ($regKey) { + Add-Registry -RegKey $regKey -Program $searchProgramm + } + } + + foreach ($registrySearchPath in $RegistrySearchPathsCurrentUser) { + $regKey = [Microsoft.Win32.Registry]::CurrentUser.OpenSubKey("$registrySearchPath\$searchProgramm", $false) + if ($searchProgramm -eq 'Blizz' -or $searchProgramm -eq 'TeamViewerMeeting') { + $regKey = [Microsoft.Win32.Registry]::CurrentUser.OpenSubKey("$registrySearchPath\$searchProgramm\MachineFallback", $false) + } + if ($regKey) { + Add-Registry -RegKey $regKey -Program $searchProgramm + } + } + + $output = "Windows Registry Editor Version 5.00 `r`n" + foreach ($data in $AllTVRegistryData) { + $output += "[$($data.RegistryPath)]`r`n" + foreach ($entry in $data.Entries) { + if ($null -ne $entry.name) { + $output += """$($entry.Name)""" + $entry.Type + $entry.Value + "`r`n" + } + } + $output += "`r`n" + } + $output | Out-File -FilePath "$OutputPath\Data\TeamViewer_Version15\Reg_Version15.txt" + } + } + +} diff --git a/docs/Cmdlets/Private/Get-RouteTable.ps1 b/docs/Cmdlets/Private/Get-RouteTable.ps1 new file mode 100644 index 0000000..caf68cd --- /dev/null +++ b/docs/Cmdlets/Private/Get-RouteTable.ps1 @@ -0,0 +1,24 @@ +function Get-RouteTable { + param( + [Parameter(ValueFromPipeline = $true)] + [string] + $OutputPath + ) +Process{ + try { + $processInfo = New-Object System.Diagnostics.ProcessStartInfo + $processInfo.FileName = 'route.exe' + $processInfo.Arguments = 'print' + $processInfo.WindowStyle = 'Hidden' + $processInfo.UseShellExecute = $false + $processInfo.RedirectStandardOutput = $true + + $process = [System.Diagnostics.Process]::Start($processInfo) + $output = $process.StandardOutput.ReadToEnd() + $output | Out-File "$OutputPath\Data\RouteTable.txt" + } + catch { + Write-Error "An error occurred while collecting RouteTable data: $_" + } +} +} diff --git a/docs/Cmdlets/Private/Get-TSCDirectoryFile.ps1 b/docs/Cmdlets/Private/Get-TSCDirectoryFile.ps1 new file mode 100644 index 0000000..401aaee --- /dev/null +++ b/docs/Cmdlets/Private/Get-TSCDirectoryFile.ps1 @@ -0,0 +1,35 @@ +function Get-TSCDirectoryFile { + param( + [Parameter(ValueFromPipeline = $true)] + [string] + $OutputPath + ) + + Process { + $SearchDirectories = Get-TSCSearchDirectory + $TempDirectory = New-Item -Path $OutputPath -Name 'Data' -ItemType Directory -Force + $Endings = @('.log', 'tvinfo.ini', '.mdmp', 'Connections.txt', 'Connections_incoming.txt') + $TmpLogFiles = @() + foreach ($Name in $SearchDirectories.Keys) { + $SearchDirectory = $SearchDirectories[$Name] + foreach ($Folder in $SearchDirectory) { + if (Test-Path -Path $Folder) { + $TempSubdirectory = Join-Path -Path $TempDirectory -ChildPath $Name + New-Item -Path $TempSubdirectory -ItemType Directory -Force | Out-Null + $files = Get-ChildItem -Path $Folder -File -Recurse + foreach ($file in $files) { + foreach ($ending in $Endings) { + if ($file.Name.EndsWith($ending)) { + $tmpLogfilePath = Join-Path -Path $TempSubdirectory -ChildPath $file.Name + Copy-Item -Path $file.FullName -Destination $tmpLogfilePath -Force + $TmpLogFiles += $tmpLogfilePath + Write-Output "Collected log file from $($file.FullName)" + } + } + } + } + } + } + Write-Output 'Files from TeamViewer directories have been collected.' + } +} diff --git a/docs/Cmdlets/Private/Get-TSCSearchDirectory.ps1 b/docs/Cmdlets/Private/Get-TSCSearchDirectory.ps1 new file mode 100644 index 0000000..b855884 --- /dev/null +++ b/docs/Cmdlets/Private/Get-TSCSearchDirectory.ps1 @@ -0,0 +1,14 @@ +function Get-TSCSearchDirectory { + $LocalAppData = [System.Environment]::GetFolderPath('LocalApplicationData') + $RoamingAppData = [System.Environment]::GetFolderPath('ApplicationData') + $TVAppData = Join-Path -Path $LocalAppData.ToString() -ChildPath 'TeamViewer/Logs' + $TVRoamingData = Join-Path -Path $RoamingAppData.ToString() -ChildPath 'TeamViewer' + $InstallationDirectory = Get-TeamViewerInstallationDirectory + + $TSCSearchDirectory = @{ + 'TeamViewer_Version15' = $InstallationDirectory + 'AppData\TeamViewer' = @($TVAppData; $TVRoamingData) + } + + return $TSCSearchDirectory +} diff --git a/docs/Cmdlets/Private/Get-TeamViewerApiUri.ps1 b/docs/Cmdlets/Private/Get-TeamViewerApiUri.ps1 new file mode 100644 index 0000000..6070e6d --- /dev/null +++ b/docs/Cmdlets/Private/Get-TeamViewerApiUri.ps1 @@ -0,0 +1,22 @@ + + +class TeamViewerConfiguration { + [string]$APIUri = 'https://webapi.teamviewer.com/api/v1' + + static [TeamViewerConfiguration] $Instance = $null + + static [TeamViewerConfiguration] GetInstance() { + if (-not [TeamViewerConfiguration]::Instance) { + [TeamViewerConfiguration]::Instance = [TeamViewerConfiguration]::new() + } + + return [TeamViewerConfiguration]::Instance + } +} + +function Get-TeamViewerAPIUri { + $config = [TeamViewerConfiguration]::GetInstance() + return $config.APIUri +} + + diff --git a/TeamViewerPS/Private/Get-TeamViewerLinuxGlobalConfig.ps1 b/docs/Cmdlets/Private/Get-TeamViewerLinuxGlobalConfig.ps1 similarity index 74% rename from TeamViewerPS/Private/Get-TeamViewerLinuxGlobalConfig.ps1 rename to docs/Cmdlets/Private/Get-TeamViewerLinuxGlobalConfig.ps1 index 86e32b0..199a0b6 100644 --- a/TeamViewerPS/Private/Get-TeamViewerLinuxGlobalConfig.ps1 +++ b/docs/Cmdlets/Private/Get-TeamViewerLinuxGlobalConfig.ps1 @@ -8,7 +8,7 @@ function Get-TeamViewerLinuxGlobalConfig { [string] $Name ) - $config = Get-Content $Path | ForEach-Object { + $config = & sudo pwsh -command Get-Content $Path | ForEach-Object { if ($_ -Match '\[(?\w+)\s*\]\s+(?[\w\\]+)\s+=\s*(?.*)$') { $Matches.Remove(0) $entry = [pscustomobject]$Matches @@ -23,7 +23,10 @@ function Get-TeamViewerLinuxGlobalConfig { $entry.EntryValue = [int32]($entry.EntryValue) } 'int64' { - $entry.EntryValue = [int64]($entry.EntryValue) + #In some cases the EntryName DeviceManagement/TransitionNonces is set to entryvalue '0 0 0 0 0' of type int64 + if ($entry.EntryValue -notmatch '0 0 0 0 0') { + $entry.EntryValue = [int64]($entry.EntryValue) + } } } $entry diff --git a/TeamViewerPS/Private/Get-TeamViewerRegKeyPath.ps1 b/docs/Cmdlets/Private/Get-TeamViewerRegKeyPath.ps1 similarity index 100% rename from TeamViewerPS/Private/Get-TeamViewerRegKeyPath.ps1 rename to docs/Cmdlets/Private/Get-TeamViewerRegKeyPath.ps1 diff --git a/TeamViewerPS/Private/Get-TeamViewerServiceName.ps1 b/docs/Cmdlets/Private/Get-TeamViewerServiceName.ps1 similarity index 100% rename from TeamViewerPS/Private/Get-TeamViewerServiceName.ps1 rename to docs/Cmdlets/Private/Get-TeamViewerServiceName.ps1 diff --git a/docs/Cmdlets/Private/Get-TypeAndValueOfRegistryValue.ps1 b/docs/Cmdlets/Private/Get-TypeAndValueOfRegistryValue.ps1 new file mode 100644 index 0000000..c8b70fe --- /dev/null +++ b/docs/Cmdlets/Private/Get-TypeAndValueOfRegistryValue.ps1 @@ -0,0 +1,39 @@ +function Get-TypeAndValueOfRegistryValue { + param ( + [Microsoft.Win32.RegistryKey]$RegKey, + [string]$ValueName + ) + + $valueKind = $RegKey.GetValueKind($ValueName) + $type = $valueKind + + if ($valueKind -eq 'DWord') { + $type = "=dword:" + $value = [Convert]::ToInt32($RegKey.GetValue($ValueName)).ToString('x') + } + elseif ($valueKind -eq 'Binary') { + $type = "=hex:" + $value = ($RegKey.GetValue($ValueName) | ForEach-Object { $_.ToString('x2') }) -join ',' + } + elseif ($valueKind -eq 'String') { + $type = "=" + $value = $RegKey.GetValue($ValueName).ToString() + } + elseif ($valueKind -eq 'MultiString') { + $type = "=hex(7):" + $value += ($RegKey.GetValue($ValueName) | ForEach-Object { + $_.ToCharArray() | ForEach-Object { [Convert]::ToInt32($_).ToString('X') + ',00' } + }) -join ',' + $value += ',00,00,' + if ($value.Length -gt 0) { + $value += '00,00' + } + } + else { + $type = "" + $value = $RegKey.GetValue($ValueName).ToString() + } + + return $type, $value +} + diff --git a/TeamViewerPS/Private/Invoke-ExternalCommand.ps1 b/docs/Cmdlets/Private/Invoke-ExternalCommand.ps1 similarity index 100% rename from TeamViewerPS/Private/Invoke-ExternalCommand.ps1 rename to docs/Cmdlets/Private/Invoke-ExternalCommand.ps1 diff --git a/TeamViewerPS/Private/Invoke-TeamViewerRestMethod.ps1 b/docs/Cmdlets/Private/Invoke-TeamViewerRestMethod.ps1 similarity index 75% rename from TeamViewerPS/Private/Invoke-TeamViewerRestMethod.ps1 rename to docs/Cmdlets/Private/Invoke-TeamViewerRestMethod.ps1 index 49f8061..ac3192e 100644 --- a/TeamViewerPS/Private/Invoke-TeamViewerRestMethod.ps1 +++ b/docs/Cmdlets/Private/Invoke-TeamViewerRestMethod.ps1 @@ -22,17 +22,31 @@ function Invoke-TeamViewerRestMethod { [System.Management.Automation.PSCmdlet] $WriteErrorTo + ) if (-Not $Headers) { $Headers = @{ } - $PSBoundParameters.Add("Headers", $Headers) | Out-Null + $PSBoundParameters.Add('Headers', $Headers) | Out-Null + } + + if ($global:TeamViewerProxyUriSet) { + $Proxy = $global:TeamViewerProxyUriSet + } + elseif ([Environment]::GetEnvironmentVariable('TeamViewerProxyUri') ) { + $Proxy = [Environment]::GetEnvironmentVariable('TeamViewerProxyUri') + if ($global:TeamViewerProxyUriRemoved) { + $Proxy = $null + } + } + If ($Proxy) { + $PSBoundParameters.Add('Proxy', $Proxy) | Out-Null } $bstr = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($ApiToken) - $Headers["Authorization"] = "Bearer $([System.Runtime.InteropServices.Marshal]::PtrToStringBSTR($bstr))" + $Headers['Authorization'] = "Bearer $([System.Runtime.InteropServices.Marshal]::PtrToStringBSTR($bstr))" [System.Runtime.InteropServices.Marshal]::ZeroFreeBSTR($bstr) | Out-Null - $PSBoundParameters.Remove("ApiToken") | Out-Null - $PSBoundParameters.Remove("WriteErrorTo") | Out-Null + $PSBoundParameters.Remove('ApiToken') | Out-Null + $PSBoundParameters.Remove('WriteErrorTo') | Out-Null $currentTlsSettings = [Net.ServicePointManager]::SecurityProtocol [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 @@ -40,9 +54,11 @@ function Invoke-TeamViewerRestMethod { $currentProgressPreference = $ProgressPreference $ProgressPreference = 'SilentlyContinue' + # Using `Invoke-WebRequest` instead of `Invoke-RestMethod`: # There is a known issue for PUT and DELETE operations to hang on Windows Server 2012. try { + return ((Invoke-WebRequest -UseBasicParsing @PSBoundParameters).Content | ConvertFrom-Json) } catch { diff --git a/docs/Cmdlets/Private/Resolve-AssignmentErrorCode.ps1 b/docs/Cmdlets/Private/Resolve-AssignmentErrorCode.ps1 new file mode 100644 index 0000000..ab50962 --- /dev/null +++ b/docs/Cmdlets/Private/Resolve-AssignmentErrorCode.ps1 @@ -0,0 +1,38 @@ +function Resolve-AssignmentErrorCode { + param( + [Parameter(ValueFromPipeline = $true, Mandatory = $true)] + [object] + $exitCode + ) + Begin { + $exitCodeMessages = @{ + 0 = 'Operation successful' + 1 = 'Misspelled or used a wrong command' + 2 = 'Signature verification error' + 3 = 'TeamViewer is not installed' + 4 = 'The assignment configuration could not be verified against the TeamViewer Cloud.Try again later.' + 400 = 'Invalid assignment ID' + 401 = 'TeamViewer service not running' + 402 = 'Service Incompatible Version' + 403 = 'Check your internet connection' + 404 = 'Another assignment process running' + 405 = 'Timeout' + 406 = 'Failed due to unknown reasons' + 407 = 'Access denied. Ensure local administrator rights' + 408 = 'Denied by policy' + } + } + Process { + if ($exitCode) { + if ($exitCodeMessages.ContainsKey($exitCode)) { + Write-Output $exitCodeMessages[$exitCode] + } + else { + Write-Output "Unexpected error code: $exitCode. Check TeamViewer documentation!" + } + } + elseif ($exitCode -eq 0) { + Write-Output $exitCodeMessages[$exitCode] + } + } +} diff --git a/docs/Cmdlets/Private/Resolve-CustomizationErrorCode.ps1 b/docs/Cmdlets/Private/Resolve-CustomizationErrorCode.ps1 new file mode 100644 index 0000000..d217694 --- /dev/null +++ b/docs/Cmdlets/Private/Resolve-CustomizationErrorCode.ps1 @@ -0,0 +1,33 @@ +function Resolve-CustomizationErrorCode { + param( + [Parameter(ValueFromPipeline = $true, Mandatory = $true)] + [object] + $exitCode + ) + Begin { + $exitCodeMessages = @{ + 0 = 'Operation successful' + 1 = 'Invalid command line arguments' + 500 = 'An internal error occurred. See TeamViewer log files for more details!' + 501 = 'The current user was denied access' + 502 = 'The download of the custom configuration timed out' + 503 = 'Invalid Module' + 504 = 'Restart of the GUI failed' + 505 = 'Custom configuration failed. See the TeamViewer log files for more details and check if the custom configuration id is still valid.' + 506 = 'Removal of custom configuration failed. See the TeamViewer log files for more details!' + } + } + Process { + if ($exitCode) { + if ($exitCodeMessages.ContainsKey($exitCode)) { + Write-Output $exitCodeMessages[$exitCode] + } + else { + Write-Output "Unexpected error code: $exitCode. Check TeamViewer documentation!" + } + } + elseif ($exitCode -eq 0) { + Write-Output $exitCodeMessages[$exitCode] + } + } +} diff --git a/TeamViewerPS/Private/Resolve-TeamViewerContactId.ps1 b/docs/Cmdlets/Private/Resolve-TeamViewerContactId.ps1 similarity index 100% rename from TeamViewerPS/Private/Resolve-TeamViewerContactId.ps1 rename to docs/Cmdlets/Private/Resolve-TeamViewerContactId.ps1 diff --git a/TeamViewerPS/Private/Resolve-TeamViewerDeviceId.ps1 b/docs/Cmdlets/Private/Resolve-TeamViewerDeviceId.ps1 similarity index 100% rename from TeamViewerPS/Private/Resolve-TeamViewerDeviceId.ps1 rename to docs/Cmdlets/Private/Resolve-TeamViewerDeviceId.ps1 diff --git a/TeamViewerPS/Private/Resolve-TeamViewerGroupId.ps1 b/docs/Cmdlets/Private/Resolve-TeamViewerGroupId.ps1 similarity index 100% rename from TeamViewerPS/Private/Resolve-TeamViewerGroupId.ps1 rename to docs/Cmdlets/Private/Resolve-TeamViewerGroupId.ps1 diff --git a/TeamViewerPS/Private/Resolve-TeamViewerLanguage.ps1 b/docs/Cmdlets/Private/Resolve-TeamViewerLanguage.ps1 similarity index 100% rename from TeamViewerPS/Private/Resolve-TeamViewerLanguage.ps1 rename to docs/Cmdlets/Private/Resolve-TeamViewerLanguage.ps1 diff --git a/TeamViewerPS/Private/Resolve-TeamViewerManagedDeviceId.ps1 b/docs/Cmdlets/Private/Resolve-TeamViewerManagedDeviceId.ps1 similarity index 100% rename from TeamViewerPS/Private/Resolve-TeamViewerManagedDeviceId.ps1 rename to docs/Cmdlets/Private/Resolve-TeamViewerManagedDeviceId.ps1 diff --git a/TeamViewerPS/Private/Resolve-TeamViewerManagedGroupId.ps1 b/docs/Cmdlets/Private/Resolve-TeamViewerManagedGroupId.ps1 similarity index 100% rename from TeamViewerPS/Private/Resolve-TeamViewerManagedGroupId.ps1 rename to docs/Cmdlets/Private/Resolve-TeamViewerManagedGroupId.ps1 diff --git a/TeamViewerPS/Private/Resolve-TeamViewerManagerId.ps1 b/docs/Cmdlets/Private/Resolve-TeamViewerManagerId.ps1 similarity index 100% rename from TeamViewerPS/Private/Resolve-TeamViewerManagerId.ps1 rename to docs/Cmdlets/Private/Resolve-TeamViewerManagerId.ps1 diff --git a/TeamViewerPS/Private/Resolve-TeamViewerPolicyId.ps1 b/docs/Cmdlets/Private/Resolve-TeamViewerPolicyId.ps1 similarity index 100% rename from TeamViewerPS/Private/Resolve-TeamViewerPolicyId.ps1 rename to docs/Cmdlets/Private/Resolve-TeamViewerPolicyId.ps1 diff --git a/TeamViewerPS/Private/Resolve-TeamViewerSsoDomainId.ps1 b/docs/Cmdlets/Private/Resolve-TeamViewerSsoDomainId.ps1 similarity index 100% rename from TeamViewerPS/Private/Resolve-TeamViewerSsoDomainId.ps1 rename to docs/Cmdlets/Private/Resolve-TeamViewerSsoDomainId.ps1 diff --git a/TeamViewerPS/Private/Resolve-TeamViewerUserEmail.ps1 b/docs/Cmdlets/Private/Resolve-TeamViewerUserEmail.ps1 similarity index 100% rename from TeamViewerPS/Private/Resolve-TeamViewerUserEmail.ps1 rename to docs/Cmdlets/Private/Resolve-TeamViewerUserEmail.ps1 diff --git a/TeamViewerPS/Private/Resolve-TeamViewerUserGroupId.ps1 b/docs/Cmdlets/Private/Resolve-TeamViewerUserGroupId.ps1 similarity index 97% rename from TeamViewerPS/Private/Resolve-TeamViewerUserGroupId.ps1 rename to docs/Cmdlets/Private/Resolve-TeamViewerUserGroupId.ps1 index 065662d..0662b96 100644 --- a/TeamViewerPS/Private/Resolve-TeamViewerUserGroupId.ps1 +++ b/docs/Cmdlets/Private/Resolve-TeamViewerUserGroupId.ps1 @@ -1,21 +1,21 @@ -function Resolve-TeamViewerUserGroupId { - param( - [Parameter(ValueFromPipeline = $true, Mandatory = $true)] - [object] - $UserGroup - ) - Process { - if ($UserGroup.PSObject.TypeNames -contains 'TeamViewerPS.UserGroup') { - return [UInt64]$UserGroup.Id - } - elseif ($UserGroup -is [string]) { - return [UInt64]$UserGroup - } - elseif ($UserGroup -is [UInt64] -or $UserGroup -is [Int64] -or $UserGroup -is [int]) { - return [UInt64]$UserGroup - } - else { - throw "Invalid user group identifier '$UserGroup'. Must be either a [TeamViewerPS.UserGroup], [UInt64], [Int64] or [string]." - } - } -} +function Resolve-TeamViewerUserGroupId { + param( + [Parameter(ValueFromPipeline = $true, Mandatory = $true)] + [object] + $UserGroup + ) + Process { + if ($UserGroup.PSObject.TypeNames -contains 'TeamViewerPS.UserGroup') { + return [UInt64]$UserGroup.Id + } + elseif ($UserGroup -is [string]) { + return [UInt64]$UserGroup + } + elseif ($UserGroup -is [UInt64] -or $UserGroup -is [Int64] -or $UserGroup -is [int]) { + return [UInt64]$UserGroup + } + else { + throw "Invalid user group identifier '$UserGroup'. Must be either a [TeamViewerPS.UserGroup], [UInt64], [Int64] or [string]." + } + } +} diff --git a/TeamViewerPS/Private/Resolve-TeamViewerUserGroupMemberId.ps1 b/docs/Cmdlets/Private/Resolve-TeamViewerUserGroupMemberId.ps1 similarity index 97% rename from TeamViewerPS/Private/Resolve-TeamViewerUserGroupMemberId.ps1 rename to docs/Cmdlets/Private/Resolve-TeamViewerUserGroupMemberId.ps1 index 4d75627..dc3868c 100644 --- a/TeamViewerPS/Private/Resolve-TeamViewerUserGroupMemberId.ps1 +++ b/docs/Cmdlets/Private/Resolve-TeamViewerUserGroupMemberId.ps1 @@ -1,24 +1,24 @@ -function Resolve-TeamViewerUserGroupMemberMemberId { - param( - [Parameter(ValueFromPipeline = $true, Mandatory = $true)] - [object] - $UserGroupMember - ) - Process { - if ($UserGroupMember.PSObject.TypeNames -contains 'TeamViewerPS.UserGroupMember') { - return $UserGroupMember.AccountId - } - elseif ($UserGroupMember -match 'u[0-9]+') { - return $UserGroupMember - } - elseif ($UserGroupMember -is [string]) { - return [int]$UserGroupMember - } - elseif ($UserGroupMember -is [int]) { - return $UserGroupMember - } - else { - throw "Invalid user group identifier '$UserGroupMember'. Must be either a [TeamViewerPS.UserGroupMember],[TeamViewerPS.User] or [int] ." - } - } -} +function Resolve-TeamViewerUserGroupMemberMemberId { + param( + [Parameter(ValueFromPipeline = $true, Mandatory = $true)] + [object] + $UserGroupMember + ) + Process { + if ($UserGroupMember.PSObject.TypeNames -contains 'TeamViewerPS.UserGroupMember') { + return $UserGroupMember.AccountId + } + elseif ($UserGroupMember -match 'u[0-9]+') { + return $UserGroupMember + } + elseif ($UserGroupMember -is [string]) { + return [int]$UserGroupMember + } + elseif ($UserGroupMember -is [int]) { + return $UserGroupMember + } + else { + throw "Invalid user group identifier '$UserGroupMember'. Must be either a [TeamViewerPS.UserGroupMember],[TeamViewerPS.User] or [int] ." + } + } +} diff --git a/TeamViewerPS/Private/Resolve-TeamViewerUserId.ps1 b/docs/Cmdlets/Private/Resolve-TeamViewerUserId.ps1 similarity index 100% rename from TeamViewerPS/Private/Resolve-TeamViewerUserId.ps1 rename to docs/Cmdlets/Private/Resolve-TeamViewerUserId.ps1 diff --git a/docs/Cmdlets/Private/Resolve-TeamViewerUserRoleId.ps1 b/docs/Cmdlets/Private/Resolve-TeamViewerUserRoleId.ps1 new file mode 100644 index 0000000..7ed22bc --- /dev/null +++ b/docs/Cmdlets/Private/Resolve-TeamViewerUserRoleId.ps1 @@ -0,0 +1,19 @@ + +function Resolve-TeamViewerUserRoleId { + param( + [Parameter(ValueFromPipeline = $true, Mandatory = $true)] + [object] + $UserRole + ) + Process { + if ($UserRole.PSObject.TypeNames -contains 'TeamViewerPS.UserRole') { + return [string]$UserRole.RoleID + } + elseif ($UserRole -match '^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$') { + return [string]$UserRole + } + else { + throw "Invalid role group identifier '$UserRole'. Must be either a [TeamViewerPS.UserRole] or [UUID] " + } + } +} diff --git a/TeamViewerPS/Private/Test-TcpConnection.ps1 b/docs/Cmdlets/Private/Test-TcpConnection.ps1 similarity index 100% rename from TeamViewerPS/Private/Test-TcpConnection.ps1 rename to docs/Cmdlets/Private/Test-TcpConnection.ps1 diff --git a/TeamViewerPS/Private/Test-TeamViewer32on64.ps1 b/docs/Cmdlets/Private/Test-TeamViewer32on64.ps1 similarity index 100% rename from TeamViewerPS/Private/Test-TeamViewer32on64.ps1 rename to docs/Cmdlets/Private/Test-TeamViewer32on64.ps1 diff --git a/docs/Cmdlets/Public/Add-TeamViewerAssignment.ps1 b/docs/Cmdlets/Public/Add-TeamViewerAssignment.ps1 new file mode 100644 index 0000000..fa6460f --- /dev/null +++ b/docs/Cmdlets/Public/Add-TeamViewerAssignment.ps1 @@ -0,0 +1,53 @@ +function Add-TeamViewerAssignment { + param( + [Parameter(Mandatory = $true)] + [object] + $AssignmentId, + + [string] + $DeviceAlias, + + [int] + $Retries + ) + + + if (Test-TeamViewerInstallation) { + $OS = Get-OperatingSystem + $CurrentDirectory = Get-Location + $installationDirectory = Get-TeamViewerInstallationDirectory + Set-Location $installationDirectory + $CurrentVersion = Get-TeamViewerVersion + $VersionTable = $CurrentVersion.split('.') + if ($OS -eq 'Windows') { + $cmd = "assignment --id $AssignmentId" + $FilePath = 'TeamViewer.exe' + } + elseif ($OS -eq 'Linux') { + $cmd = "teamviewer assignment --id $AssignmentId" + $FilePath = 'sudo' + } + + if ($DeviceAlias) { + if (($VersionTable[0] -eq 15 -and $VersionTable[1] -ge 44) -or $VersionTable[0] -gt 15) { + $cmd += " --device-alias=$DeviceAlias" + } + else { + Write-Error "Current TeamViewer Version: $CurrentVersion does not support the usage of alias. Please update to the latest version." + Set-Location $CurrentDirectory + exit + } + } + if ($Retries) { + $cmd += " --retries=$Retries" + } + $process = Start-Process -FilePath $FilePath -ArgumentList $cmd -Wait -PassThru + $process.ExitCode | Resolve-AssignmentErrorCode + Set-Location $CurrentDirectory + } + else { + Write-Output 'TeamViewer is not installed.' + } +} + + diff --git a/docs/Cmdlets/Public/Add-TeamViewerCustomization.ps1 b/docs/Cmdlets/Public/Add-TeamViewerCustomization.ps1 new file mode 100644 index 0000000..d7f174c --- /dev/null +++ b/docs/Cmdlets/Public/Add-TeamViewerCustomization.ps1 @@ -0,0 +1,48 @@ +Function Add-TeamViewerCustomization { + [CmdletBinding()] + param ( + [Parameter(Mandatory = $true, ParameterSetName = 'ById')] + [object] + $Id, + + [Parameter(Mandatory = $true, ParameterSetName = 'ByPath')] + [object] + $Path, + + [switch] + $RestartGUI, + + [switch] + $RemoveExisting + ) + + if (Get-OperatingSystem -eq 'Windows') { + if (Test-TeamViewerInstallation) { + $installationDirectory = Get-TeamViewerInstallationDirectory + $currentDirectory = Get-Location + Set-Location $installationDirectory + $cmd = 'customize' + if ($Id) { + $cmd += " --id $Id" + } + elseif ($Path) { + $cmd += " --path $Path" + } + if ($RemoveExisting) { + $cmd += ' --remove' + } + if ($RestartGUI) { + $cmd += ' --restart-gui' + } + $process = Start-Process -FilePath TeamViewer.exe -ArgumentList $cmd -Wait -PassThru + $process.ExitCode | Resolve-CustomizationErrorCode + Set-Location $currentDirectory + } + else { + Write-Error 'TeamViewer is not installed' + } + } + else { + Write-Error 'Customization is currently supported only on Windows.' + } +} diff --git a/TeamViewerPS/Public/Add-TeamViewerManagedDevice.ps1 b/docs/Cmdlets/Public/Add-TeamViewerManagedDevice.ps1 similarity index 100% rename from TeamViewerPS/Public/Add-TeamViewerManagedDevice.ps1 rename to docs/Cmdlets/Public/Add-TeamViewerManagedDevice.ps1 diff --git a/TeamViewerPS/Public/Add-TeamViewerManager.ps1 b/docs/Cmdlets/Public/Add-TeamViewerManager.ps1 similarity index 100% rename from TeamViewerPS/Public/Add-TeamViewerManager.ps1 rename to docs/Cmdlets/Public/Add-TeamViewerManager.ps1 diff --git a/docs/Cmdlets/Public/Add-TeamViewerRoleToAccount.ps1 b/docs/Cmdlets/Public/Add-TeamViewerRoleToAccount.ps1 new file mode 100644 index 0000000..cec810b --- /dev/null +++ b/docs/Cmdlets/Public/Add-TeamViewerRoleToAccount.ps1 @@ -0,0 +1,64 @@ +function Add-TeamViewerRoleToAccount { + [CmdletBinding(SupportsShouldProcess = $true)] + param( + [Parameter(Mandatory = $true)] + [securestring] + $ApiToken, + + [Parameter(Mandatory = $true)] + [ValidateScript( { $_ | Resolve-TeamViewerUserRoleId } )] + [Alias('UserRole')] + [object] + $UserRoleId, + + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [Alias('Id', 'UserIds')] + [string[]] + $Accounts + ) + + Begin { + $id = $UserRoleId | Resolve-TeamViewerUserRoleId + $null = $ApiToken + $resourceUri = "$(Get-TeamViewerApiUri)/userroles/assign/account" + $AccountsToAdd = @() + $body = @{ + UserIds = @() + UserRoleId = $id + } + function Invoke-TeamViewerRestMethodInternal { + $result = Invoke-TeamViewerRestMethod ` + -ApiToken $ApiToken ` + -Uri $resourceUri ` + -Method Post ` + -ContentType 'application/json; charset=utf-8' ` + -Body ([System.Text.Encoding]::UTF8.GetBytes(($body | ConvertTo-Json))) ` + -WriteErrorTo $PSCmdlet ` + -ErrorAction Stop + Write-Output ($result) + } + } + + + Process { + if ($PSCmdlet.ShouldProcess($Accounts, 'Assign Account to Role')) { + if (($Accounts -notmatch 'u[0-9]+') -and ($Accounts -match '[0-9]+')) { + $Accounts = $Accounts | ForEach-Object { $_.Insert(0, 'u') } + } + foreach ($Account in $Accounts) { + $AccountsToAdd += $Account + $body.UserIds = @($AccountsToAdd) + } + } + if ($AccountsToAdd.Length -eq 100) { + Invoke-TeamViewerRestMethodInternal + $AccountsToAdd = @() + } + } + End { + if ($AccountsToAdd.Length -gt 0) { + Invoke-TeamViewerRestMethodInternal + } + } +} + diff --git a/docs/Cmdlets/Public/Add-TeamViewerRoleToUserGroup.ps1 b/docs/Cmdlets/Public/Add-TeamViewerRoleToUserGroup.ps1 new file mode 100644 index 0000000..e560a5a --- /dev/null +++ b/docs/Cmdlets/Public/Add-TeamViewerRoleToUserGroup.ps1 @@ -0,0 +1,47 @@ +function Add-TeamViewerRoleToUserGroup { + [CmdletBinding(SupportsShouldProcess = $true)] + param( + [Parameter(Mandatory = $true)] + [securestring] + $ApiToken, + + [Parameter(Mandatory = $true)] + [ValidateScript( { $_ | Resolve-TeamViewerUserRoleId } )] + [Alias('UserRoleId')] + [object] + $UserRole, + + [Parameter(Mandatory = $true)] + [ValidateScript( { $_ | Resolve-TeamViewerUserGroupId } )] + [Alias('UserGroupId')] + [Alias('Id')] + [object] + $UserGroup + ) + + Begin { + $RoleId = $UserRole | Resolve-TeamViewerUserRoleId + $null = $ApiToken + $resourceUri = "$(Get-TeamViewerApiUri)/userroles/assign/usergroup" + $body = @{ + UserRoleId = $RoleId + UserGroupId = $UserGroup + + } + } + + + Process { + if ($PSCmdlet.ShouldProcess($UserGroup, 'Assign Role to User Group')) { + $result = Invoke-TeamViewerRestMethod ` + -ApiToken $ApiToken ` + -Uri $resourceUri ` + -Method Post ` + -ContentType 'application/json; charset=utf-8' ` + -Body ([System.Text.Encoding]::UTF8.GetBytes(($body | ConvertTo-Json))) ` + -WriteErrorTo $PSCmdlet ` + -ErrorAction Stop + Write-Output ($result) + } + } +} diff --git a/TeamViewerPS/Public/Add-TeamViewerSsoExclusion.ps1 b/docs/Cmdlets/Public/Add-TeamViewerSsoExclusion.ps1 similarity index 100% rename from TeamViewerPS/Public/Add-TeamViewerSsoExclusion.ps1 rename to docs/Cmdlets/Public/Add-TeamViewerSsoExclusion.ps1 diff --git a/TeamViewerPS/Public/Add-TeamViewerUserGroupMember.ps1 b/docs/Cmdlets/Public/Add-TeamViewerUserGroupMember.ps1 similarity index 97% rename from TeamViewerPS/Public/Add-TeamViewerUserGroupMember.ps1 rename to docs/Cmdlets/Public/Add-TeamViewerUserGroupMember.ps1 index 9d5d576..6a8acdc 100644 --- a/TeamViewerPS/Public/Add-TeamViewerUserGroupMember.ps1 +++ b/docs/Cmdlets/Public/Add-TeamViewerUserGroupMember.ps1 @@ -1,84 +1,84 @@ -function Add-TeamViewerUserGroupMember { - [CmdletBinding(SupportsShouldProcess = $true)] - param( - [Parameter(Mandatory = $true)] - [securestring] - $ApiToken, - - [Parameter(Mandatory = $true)] - [ValidateScript( { $_ | Resolve-TeamViewerUserGroupId } )] - [Alias('UserGroupId')] - [Alias('Id')] - [object] - $UserGroup, - - [Parameter(Mandatory = $true, ValueFromPipeline = $true)] - [object[]] - [Alias('UserGroupMemberId')] - [Alias('UserGroupMember')] - [Alias('MemberId')] - [Alias('UserId')] - [Alias('User')] - $Member - ) - - Begin { - $id = $UserGroup | Resolve-TeamViewerUserGroupId - $resourceUri = "$(Get-TeamViewerApiUri)/usergroups/$id/members" - $membersToAdd = @() - $body = @() - $null = $ApiToken # https://github.com/PowerShell/PSScriptAnalyzer/issues/1472 - - function Invoke-TeamViewerRestMethodInternal { - $result = Invoke-TeamViewerRestMethod ` - -ApiToken $ApiToken ` - -Uri $resourceUri ` - -Method Post ` - -ContentType 'application/json; charset=utf-8' ` - -Body ([System.Text.Encoding]::UTF8.GetBytes(($body))) ` - -WriteErrorTo $PSCmdlet ` - -ErrorAction Stop - - Write-Output ($result | ConvertTo-TeamViewerUserGroupMember) - } - } - - Process { - # when members are provided as pipeline input, each member is provided as a separate statement, - # thus the members should be combined into one array in order to send a single request. - if ($PSCmdlet.ShouldProcess($Member, 'Add user groups member')) { - if ($Member -notmatch 'u[0-9]+') { - ForEach-Object { - $Member = [int[]]$Member - } - } - else { - ForEach-Object { - $Member = [int[]]$Member.trim('u') - } - } - if ($Member -isnot [array]) { - $membersToAdd = @([UInt32]$Member) - } - else { - $membersToAdd += [UInt32[]]$Member - } - $payload = $membersToAdd -join ', ' - $body = "[$payload]" - } - - # WebAPI accepts a maximum of 100 accounts. Thus we send a request and reset the `membersToAdd` - # in order to accept more members - if ($membersToAdd.Length -eq 100) { - Invoke-TeamViewerRestMethodInternal - $membersToAdd = @() - } - } - - End { - # A request needs to be sent if there were less than 100 members - if ($membersToAdd.Length -gt 0) { - Invoke-TeamViewerRestMethodInternal - } - } -} +function Add-TeamViewerUserGroupMember { + [CmdletBinding(SupportsShouldProcess = $true)] + param( + [Parameter(Mandatory = $true)] + [securestring] + $ApiToken, + + [Parameter(Mandatory = $true)] + [ValidateScript( { $_ | Resolve-TeamViewerUserGroupId } )] + [Alias('UserGroupId')] + [Alias('Id')] + [object] + $UserGroup, + + [Parameter(Mandatory = $true, ValueFromPipeline = $true)] + [object[]] + [Alias('UserGroupMemberId')] + [Alias('UserGroupMember')] + [Alias('MemberId')] + [Alias('UserId')] + [Alias('User')] + $Member + ) + + Begin { + $id = $UserGroup | Resolve-TeamViewerUserGroupId + $resourceUri = "$(Get-TeamViewerApiUri)/usergroups/$id/members" + $membersToAdd = @() + $body = @() + $null = $ApiToken # https://github.com/PowerShell/PSScriptAnalyzer/issues/1472 + + function Invoke-TeamViewerRestMethodInternal { + $result = Invoke-TeamViewerRestMethod ` + -ApiToken $ApiToken ` + -Uri $resourceUri ` + -Method Post ` + -ContentType 'application/json; charset=utf-8' ` + -Body ([System.Text.Encoding]::UTF8.GetBytes(($body))) ` + -WriteErrorTo $PSCmdlet ` + -ErrorAction Stop + + Write-Output ($result | ConvertTo-TeamViewerUserGroupMember) + } + } + + Process { + # when members are provided as pipeline input, each member is provided as a separate statement, + # thus the members should be combined into one array in order to send a single request. + if ($PSCmdlet.ShouldProcess($Member, 'Add user groups member')) { + if ($Member -notmatch 'u[0-9]+') { + ForEach-Object { + $Member = [int[]]$Member + } + } + else { + ForEach-Object { + $Member = [int[]]$Member.trim('u') + } + } + if ($Member -isnot [array]) { + $membersToAdd = @([UInt32]$Member) + } + else { + $membersToAdd += [UInt32[]]$Member + } + $payload = $membersToAdd -join ', ' + $body = "[$payload]" + } + + # WebAPI accepts a maximum of 100 accounts. Thus we send a request and reset the `membersToAdd` + # in order to accept more members + if ($membersToAdd.Length -eq 100) { + Invoke-TeamViewerRestMethodInternal + $membersToAdd = @() + } + } + + End { + # A request needs to be sent if there were less than 100 members + if ($membersToAdd.Length -gt 0) { + Invoke-TeamViewerRestMethodInternal + } + } +} diff --git a/TeamViewerPS/Public/Connect-TeamViewerApi.ps1 b/docs/Cmdlets/Public/Connect-TeamViewerApi.ps1 similarity index 100% rename from TeamViewerPS/Public/Connect-TeamViewerApi.ps1 rename to docs/Cmdlets/Public/Connect-TeamViewerApi.ps1 diff --git a/TeamViewerPS/Public/Disconnect-TeamViewerApi.ps1 b/docs/Cmdlets/Public/Disconnect-TeamViewerApi.ps1 similarity index 100% rename from TeamViewerPS/Public/Disconnect-TeamViewerApi.ps1 rename to docs/Cmdlets/Public/Disconnect-TeamViewerApi.ps1 diff --git a/docs/Cmdlets/Public/Export-TeamViewerSystemInformation.ps1 b/docs/Cmdlets/Public/Export-TeamViewerSystemInformation.ps1 new file mode 100644 index 0000000..3c40695 --- /dev/null +++ b/docs/Cmdlets/Public/Export-TeamViewerSystemInformation.ps1 @@ -0,0 +1,39 @@ +function Export-TeamViewerSystemInformation { + param( + [Parameter(ValueFromPipeline = $true)] + [string] + $TargetDirectory + ) + Process { + if (Test-TeamViewerInstallation ) { + if (Get-OperatingSystem -eq 'Windows') { + $Temp = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(), [System.Guid]::NewGuid().ToString()) + $CurrentDirectory = Get-Location + $Temp | Get-TSCDirectoryFile + $Temp | Get-InstalledSoftware + $Temp | Get-IpConfig + $Temp | Get-MSInfo32 + $Temp | Get-HostFile + $Temp | Get-NSLookUpData + $Temp | Get-RouteTable + $Temp | Get-RegistryPath + $ClientID = Get-ClientId + $ZipFileName = 'TV_SC_' + $ClientID + '_WINPS.zip' + $ZipPath = Join-Path -Path "$Temp\Data" -ChildPath $ZipFileName + Compress-Archive -Path $Temp\* -DestinationPath $ZipPath -Force + if ($TargetDirectory -and (Test-Path $TargetDirectory)) { + Copy-Item -Path $ZipPath -Destination $TargetDirectory -Force + } + else { + Copy-Item -Path $ZipPath -Destination $CurrentDirectory -Force + } + } + else { + Write-Error 'Currently this functionality is supported only on Windows.' + } + } + else { + Write-Error 'TeamViewer is not installed.' + } + } +} diff --git a/TeamViewerPS/Public/Get-TeamViewerAccount.ps1 b/docs/Cmdlets/Public/Get-TeamViewerAccount.ps1 similarity index 100% rename from TeamViewerPS/Public/Get-TeamViewerAccount.ps1 rename to docs/Cmdlets/Public/Get-TeamViewerAccount.ps1 diff --git a/TeamViewerPS/Public/Get-TeamViewerConnectionReport.ps1 b/docs/Cmdlets/Public/Get-TeamViewerConnectionReport.ps1 similarity index 100% rename from TeamViewerPS/Public/Get-TeamViewerConnectionReport.ps1 rename to docs/Cmdlets/Public/Get-TeamViewerConnectionReport.ps1 diff --git a/TeamViewerPS/Public/Get-TeamViewerContact.ps1 b/docs/Cmdlets/Public/Get-TeamViewerContact.ps1 similarity index 100% rename from TeamViewerPS/Public/Get-TeamViewerContact.ps1 rename to docs/Cmdlets/Public/Get-TeamViewerContact.ps1 diff --git a/docs/Cmdlets/Public/Get-TeamViewerCustomModuleId.ps1 b/docs/Cmdlets/Public/Get-TeamViewerCustomModuleId.ps1 new file mode 100644 index 0000000..5c50ca4 --- /dev/null +++ b/docs/Cmdlets/Public/Get-TeamViewerCustomModuleId.ps1 @@ -0,0 +1,22 @@ +function Get-TeamViewerCustomModuleId { + + if (Test-TeamViewerinstallation) { + $fileName = 'TeamViewer.json' + $installationDirectory = Get-TeamViewerInstallationDirectory + $filePath = Join-Path -Path $installationDirectory -ChildPath $fileName + if (Test-Path -Path $filePath) { + $jsonContent = Get-Content -Path $FilePath -Raw + $jsonObject = ConvertFrom-Json $jsonContent + if ($jsonObject.id) { + return $jsonObject.id + } + } + else { + Write-Error 'Custom module Id cannot be found. Check if customization is applied.' + } + } + else { + Write-Error 'TeamViewer is not installed' + } + +} diff --git a/TeamViewerPS/Public/Get-TeamViewerDevice.ps1 b/docs/Cmdlets/Public/Get-TeamViewerDevice.ps1 similarity index 100% rename from TeamViewerPS/Public/Get-TeamViewerDevice.ps1 rename to docs/Cmdlets/Public/Get-TeamViewerDevice.ps1 diff --git a/TeamViewerPS/Public/Get-TeamViewerEventLog.ps1 b/docs/Cmdlets/Public/Get-TeamViewerEventLog.ps1 similarity index 100% rename from TeamViewerPS/Public/Get-TeamViewerEventLog.ps1 rename to docs/Cmdlets/Public/Get-TeamViewerEventLog.ps1 diff --git a/TeamViewerPS/Public/Get-TeamViewerGroup.ps1 b/docs/Cmdlets/Public/Get-TeamViewerGroup.ps1 similarity index 100% rename from TeamViewerPS/Public/Get-TeamViewerGroup.ps1 rename to docs/Cmdlets/Public/Get-TeamViewerGroup.ps1 diff --git a/TeamViewerPS/Public/Get-TeamViewerId.ps1 b/docs/Cmdlets/Public/Get-TeamViewerId.ps1 similarity index 100% rename from TeamViewerPS/Public/Get-TeamViewerId.ps1 rename to docs/Cmdlets/Public/Get-TeamViewerId.ps1 diff --git a/docs/Cmdlets/Public/Get-TeamViewerInstallationDirectory.ps1 b/docs/Cmdlets/Public/Get-TeamViewerInstallationDirectory.ps1 new file mode 100644 index 0000000..09748b7 --- /dev/null +++ b/docs/Cmdlets/Public/Get-TeamViewerInstallationDirectory.ps1 @@ -0,0 +1,27 @@ +function Get-TeamViewerInstallationDirectory { + switch (Get-OperatingSystem) { + 'Windows' { + $regKey = Get-TeamViewerRegKeyPath + $installationDirectory = if (Test-Path $regKey) { + (Get-Item $regKey).GetValue('InstallationDirectory') + } + if ( + $installationDirectory -And ` + (Test-Path "$installationDirectory/TeamViewer.exe") + ) { + return $installationDirectory + } + } + 'Linux' { + if ( + (Test-Path '/opt/teamviewer/tv_bin/TeamViewer') + ) { + return '/opt/teamviewer/tv_bin/' + } + } + default { + Write-Error 'TeamViewer not installed' + } + } +} + diff --git a/docs/Cmdlets/Public/Get-TeamViewerLogFilePath.ps1 b/docs/Cmdlets/Public/Get-TeamViewerLogFilePath.ps1 new file mode 100644 index 0000000..cda13c8 --- /dev/null +++ b/docs/Cmdlets/Public/Get-TeamViewerLogFilePath.ps1 @@ -0,0 +1,38 @@ +function Get-TeamViewerLogFilePath { + param( + [switch] + $OpenFile + ) + + if (Test-TeamViewerInstallation) { + if (Get-OperatingSystem -eq 'Windows') { + $SearchDirectories = Get-TSCSearchDirectory + $LogFiles = New-Object System.Collections.ArrayList + foreach ($Name in $SearchDirectories.Keys) { + $SearchDirectory = $SearchDirectories[$Name] + foreach ($Folder in $SearchDirectory) { + if (Test-Path -Path $Folder) { + $files = Get-ChildItem -Path $Folder -File -Recurse + foreach ($file in $files) { + if ($file.Name.EndsWith('.log')) { + $LogFiles.add($file.FullName) | Out-Null + } + } + } + } + } + + if ($OpenFile) { + $LogFile = $host.ui.PromptForChoice('Select file', 'Choose file:', ` + @($LogFiles), 0) + Invoke-Item -Path $LogFiles[$LogFile] + } + else { + return $LogFiles + } + } + } + else { + Write-Error 'TeamViewer is not installed.' + } +} diff --git a/TeamViewerPS/Public/Get-TeamViewerManagedDevice.ps1 b/docs/Cmdlets/Public/Get-TeamViewerManagedDevice.ps1 similarity index 100% rename from TeamViewerPS/Public/Get-TeamViewerManagedDevice.ps1 rename to docs/Cmdlets/Public/Get-TeamViewerManagedDevice.ps1 diff --git a/TeamViewerPS/Public/Get-TeamViewerManagedGroup.ps1 b/docs/Cmdlets/Public/Get-TeamViewerManagedGroup.ps1 similarity index 100% rename from TeamViewerPS/Public/Get-TeamViewerManagedGroup.ps1 rename to docs/Cmdlets/Public/Get-TeamViewerManagedGroup.ps1 diff --git a/TeamViewerPS/Public/Get-TeamViewerManagementId.ps1 b/docs/Cmdlets/Public/Get-TeamViewerManagementId.ps1 similarity index 100% rename from TeamViewerPS/Public/Get-TeamViewerManagementId.ps1 rename to docs/Cmdlets/Public/Get-TeamViewerManagementId.ps1 diff --git a/TeamViewerPS/Public/Get-TeamViewerManager.ps1 b/docs/Cmdlets/Public/Get-TeamViewerManager.ps1 similarity index 100% rename from TeamViewerPS/Public/Get-TeamViewerManager.ps1 rename to docs/Cmdlets/Public/Get-TeamViewerManager.ps1 diff --git a/TeamViewerPS/Public/Get-TeamViewerPolicy.ps1 b/docs/Cmdlets/Public/Get-TeamViewerPolicy.ps1 similarity index 100% rename from TeamViewerPS/Public/Get-TeamViewerPolicy.ps1 rename to docs/Cmdlets/Public/Get-TeamViewerPolicy.ps1 diff --git a/docs/Cmdlets/Public/Get-TeamViewerRoleAssignmentToAccount.ps1 b/docs/Cmdlets/Public/Get-TeamViewerRoleAssignmentToAccount.ps1 new file mode 100644 index 0000000..ed89a07 --- /dev/null +++ b/docs/Cmdlets/Public/Get-TeamViewerRoleAssignmentToAccount.ps1 @@ -0,0 +1,30 @@ +function Get-TeamViewerRoleAssignmentToAccount { + param( + [Parameter(Mandatory = $true)] + [securestring] + $ApiToken, + + [Parameter(Mandatory = $true)] + [ValidateScript( { $_ | Resolve-TeamViewerUserRoleId } )] + [Alias('UserRole')] + [string] + $UserRoleId + ) + + + $resourceUri = "$(Get-TeamViewerApiUri)/userroles/assignments/account?userRoleId=$UserRoleId" + $parameters = $null + do { + $response = Invoke-TeamViewerRestMethod ` + -ApiToken $ApiToken ` + -Uri $resourceUri ` + -Method Get ` + -Body $parameters ` + -WriteErrorTo $PSCmdlet ` + -ErrorAction Stop + if ($response.ContinuationToken) { + $resourceUri += '&continuationToken=' + $response.ContinuationToken + } + Write-Output ($response.AssignedToUsers | ConvertTo-TeamViewerRoleAssignedUser ) + }while ($response.ContinuationToken) +} diff --git a/docs/Cmdlets/Public/Get-TeamViewerRoleAssignmentToUserGroup.ps1 b/docs/Cmdlets/Public/Get-TeamViewerRoleAssignmentToUserGroup.ps1 new file mode 100644 index 0000000..3b369c2 --- /dev/null +++ b/docs/Cmdlets/Public/Get-TeamViewerRoleAssignmentToUserGroup.ps1 @@ -0,0 +1,33 @@ +function Get-TeamViewerRoleAssignmentToUserGroup { + param( + [Parameter(Mandatory = $true)] + [securestring] + $ApiToken, + + [Parameter(Mandatory = $true)] + [ValidateScript({ $_ | Resolve-TeamviewerUserRoleId })] + [Alias('UserRole')] + [string] + $UserRoleId + ) + + Begin { + $resourceUri = "$(Get-TeamViewerApiUri)/userroles/assignments/usergroups?userRoleId=$UserRoleId" + $parameters = $null + } + Process { + do { + $response = Invoke-TeamViewerRestMethod ` + -ApiToken $ApiToken ` + -Uri $resourceUri ` + -Method Get ` + -Body $parameters ` + -WriteErrorTo $PSCmdlet ` + -ErrorAction Stop + if ($response.ContinuationToken) { + $resourceUri += "&continuationToken=" + $response.ContinuationToken + } + Write-Output ($response.AssignedToGroups | ConvertTo-TeamViewerRoleAssignedUserGroup ) + }while ($response.ContinuationToken) + } +} diff --git a/TeamViewerPS/Public/Get-TeamViewerService.ps1 b/docs/Cmdlets/Public/Get-TeamViewerService.ps1 similarity index 100% rename from TeamViewerPS/Public/Get-TeamViewerService.ps1 rename to docs/Cmdlets/Public/Get-TeamViewerService.ps1 diff --git a/TeamViewerPS/Public/Get-TeamViewerSsoDomain.ps1 b/docs/Cmdlets/Public/Get-TeamViewerSsoDomain.ps1 similarity index 100% rename from TeamViewerPS/Public/Get-TeamViewerSsoDomain.ps1 rename to docs/Cmdlets/Public/Get-TeamViewerSsoDomain.ps1 diff --git a/TeamViewerPS/Public/Get-TeamViewerSsoExclusion.ps1 b/docs/Cmdlets/Public/Get-TeamViewerSsoExclusion.ps1 similarity index 100% rename from TeamViewerPS/Public/Get-TeamViewerSsoExclusion.ps1 rename to docs/Cmdlets/Public/Get-TeamViewerSsoExclusion.ps1 diff --git a/TeamViewerPS/Public/Get-TeamViewerUser.ps1 b/docs/Cmdlets/Public/Get-TeamViewerUser.ps1 similarity index 100% rename from TeamViewerPS/Public/Get-TeamViewerUser.ps1 rename to docs/Cmdlets/Public/Get-TeamViewerUser.ps1 diff --git a/TeamViewerPS/Public/Get-TeamViewerUserGroup.ps1 b/docs/Cmdlets/Public/Get-TeamViewerUserGroup.ps1 similarity index 96% rename from TeamViewerPS/Public/Get-TeamViewerUserGroup.ps1 rename to docs/Cmdlets/Public/Get-TeamViewerUserGroup.ps1 index 4778755..8a6e7c1 100644 --- a/TeamViewerPS/Public/Get-TeamViewerUserGroup.ps1 +++ b/docs/Cmdlets/Public/Get-TeamViewerUserGroup.ps1 @@ -1,46 +1,46 @@ -function Get-TeamViewerUserGroup { - param( - [Parameter(Mandatory = $true)] - [securestring] - $ApiToken, - - [Parameter()] - [ValidateScript( { $_ | Resolve-TeamViewerUserGroupId } )] - [Alias("UserGroupId")] - [Alias("Id")] - [object] - $UserGroup - ) - - Begin { - $resourceUri = "$(Get-TeamViewerApiUri)/usergroups" - $parameters = @{ } - $isListOperation = $true - - if ($UserGroup) { - $GroupId = $UserGroup | Resolve-TeamViewerUserGroupId - $resourceUri += "/$GroupId" - $parameters = $null - $isListOperation = $false - } - } - - Process { - do { - $response = Invoke-TeamViewerRestMethod ` - -ApiToken $ApiToken ` - -Uri $resourceUri ` - -Method Get ` - -Body $parameters ` - -WriteErrorTo $PSCmdlet ` - -ErrorAction Stop - if ($UserGroup) { - Write-Output ($response | ConvertTo-TeamViewerUserGroup) - } - else { - $parameters.paginationToken = $response.nextPaginationToken - Write-Output ($response.resources | ConvertTo-TeamViewerUserGroup) - } - } while ($isListOperation -And $parameters.paginationToken) - } -} +function Get-TeamViewerUserGroup { + param( + [Parameter(Mandatory = $true)] + [securestring] + $ApiToken, + + [Parameter()] + [ValidateScript( { $_ | Resolve-TeamViewerUserGroupId } )] + [Alias("UserGroupId")] + [Alias("Id")] + [object] + $UserGroup + ) + + Begin { + $resourceUri = "$(Get-TeamViewerApiUri)/usergroups" + $parameters = @{ } + $isListOperation = $true + + if ($UserGroup) { + $GroupId = $UserGroup | Resolve-TeamViewerUserGroupId + $resourceUri += "/$GroupId" + $parameters = $null + $isListOperation = $false + } + } + + Process { + do { + $response = Invoke-TeamViewerRestMethod ` + -ApiToken $ApiToken ` + -Uri $resourceUri ` + -Method Get ` + -Body $parameters ` + -WriteErrorTo $PSCmdlet ` + -ErrorAction Stop + if ($UserGroup) { + Write-Output ($response | ConvertTo-TeamViewerUserGroup) + } + else { + $parameters.paginationToken = $response.nextPaginationToken + Write-Output ($response.resources | ConvertTo-TeamViewerUserGroup) + } + } while ($isListOperation -And $parameters.paginationToken) + } +} diff --git a/TeamViewerPS/Public/Get-TeamViewerUserGroupMember.ps1 b/docs/Cmdlets/Public/Get-TeamViewerUserGroupMember.ps1 similarity index 96% rename from TeamViewerPS/Public/Get-TeamViewerUserGroupMember.ps1 rename to docs/Cmdlets/Public/Get-TeamViewerUserGroupMember.ps1 index 48389c0..a3cfdc8 100644 --- a/TeamViewerPS/Public/Get-TeamViewerUserGroupMember.ps1 +++ b/docs/Cmdlets/Public/Get-TeamViewerUserGroupMember.ps1 @@ -1,35 +1,35 @@ -function Get-TeamViewerUserGroupMember { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [securestring] - $ApiToken, - - [Parameter(Mandatory = $true)] - [ValidateScript( { $_ | Resolve-TeamViewerUserGroupId } )] - [Alias("UserGroupId")] - [Alias("Id")] - [object] - $UserGroup - ) - - Begin { - $id = $UserGroup | Resolve-TeamViewerUserGroupId - $resourceUri = "$(Get-TeamViewerApiUri)/usergroups/$id/members" - $parameters = @{ } - } - - Process { - do { - $response = Invoke-TeamViewerRestMethod ` - -ApiToken $ApiToken ` - -Uri $resourceUri ` - -Method Get ` - -Body $parameters ` - -WriteErrorTo $PSCmdlet ` - -ErrorAction Stop - $parameters.paginationToken = $response.nextPaginationToken - Write-Output ($response.resources | ConvertTo-TeamViewerUserGroupMember) - } while ($parameters.paginationToken) - } -} +function Get-TeamViewerUserGroupMember { + [CmdletBinding()] + param( + [Parameter(Mandatory = $true)] + [securestring] + $ApiToken, + + [Parameter(Mandatory = $true)] + [ValidateScript( { $_ | Resolve-TeamViewerUserGroupId } )] + [Alias("UserGroupId")] + [Alias("Id")] + [object] + $UserGroup + ) + + Begin { + $id = $UserGroup | Resolve-TeamViewerUserGroupId + $resourceUri = "$(Get-TeamViewerApiUri)/usergroups/$id/members" + $parameters = @{ } + } + + Process { + do { + $response = Invoke-TeamViewerRestMethod ` + -ApiToken $ApiToken ` + -Uri $resourceUri ` + -Method Get ` + -Body $parameters ` + -WriteErrorTo $PSCmdlet ` + -ErrorAction Stop + $parameters.paginationToken = $response.nextPaginationToken + Write-Output ($response.resources | ConvertTo-TeamViewerUserGroupMember) + } while ($parameters.paginationToken) + } +} diff --git a/docs/Cmdlets/Public/Get-TeamViewerUserRole.ps1 b/docs/Cmdlets/Public/Get-TeamViewerUserRole.ps1 new file mode 100644 index 0000000..3de2ecb --- /dev/null +++ b/docs/Cmdlets/Public/Get-TeamViewerUserRole.ps1 @@ -0,0 +1,24 @@ +function Get-TeamViewerUserRole { + [CmdletBinding(DefaultParameterSetName = '')] + param( + [Parameter(Mandatory = $true)] + [securestring] + $ApiToken + ) + + Begin{ + $parameters = @{ } + $resourceUri = "$(Get-TeamViewerApiUri)/userroles" + } + +Process{ + $response = Invoke-TeamViewerRestMethod ` + -ApiToken $ApiToken ` + -Uri $resourceUri ` + -Method Get ` + -Body $parameters ` + -WriteErrorTo $PSCmdlet ` + -ErrorAction Stop + Write-Output ($response.Roles | ConvertTo-TeamViewerUserRole ) +} +} diff --git a/TeamViewerPS/Public/Get-TeamViewerVersion.ps1 b/docs/Cmdlets/Public/Get-TeamViewerVersion.ps1 similarity index 52% rename from TeamViewerPS/Public/Get-TeamViewerVersion.ps1 rename to docs/Cmdlets/Public/Get-TeamViewerVersion.ps1 index 2e27836..925d3e1 100644 --- a/TeamViewerPS/Public/Get-TeamViewerVersion.ps1 +++ b/docs/Cmdlets/Public/Get-TeamViewerVersion.ps1 @@ -2,10 +2,10 @@ function Get-TeamViewerVersion { if (Test-TeamViewerInstallation) { switch (Get-OperatingSystem) { 'Windows' { - Write-Output (Get-ItemPropertyValue -Path (Get-TeamViewerRegKeyPath) -Name 'Version') + return (Get-ItemPropertyValue -Path (Get-TeamViewerRegKeyPath) -Name 'Version') } 'Linux' { - Write-Output (Get-TeamViewerLinuxGlobalConfig -Name 'Version') + return (Get-TeamViewerLinuxGlobalConfig -Name 'Version') } } } diff --git a/TeamViewerPS/Public/Invoke-TeamViewerPackageDownload.ps1 b/docs/Cmdlets/Public/Invoke-TeamViewerPackageDownload.ps1 similarity index 73% rename from TeamViewerPS/Public/Invoke-TeamViewerPackageDownload.ps1 rename to docs/Cmdlets/Public/Invoke-TeamViewerPackageDownload.ps1 index b344a17..8532ed2 100644 --- a/TeamViewerPS/Public/Invoke-TeamViewerPackageDownload.ps1 +++ b/docs/Cmdlets/Public/Invoke-TeamViewerPackageDownload.ps1 @@ -1,7 +1,7 @@ function Invoke-TeamViewerPackageDownload { Param( [Parameter()] - [ValidateSet('Full', 'Host', 'Portable', 'QuickJoin', 'QuickSupport', 'Full64Bit')] + [ValidateSet('Full', 'Host', 'MSI32', 'MSI64', 'Portable', 'QuickJoin', 'QuickSupport', 'Full64Bit')] [ValidateScript( { if (($_ -ne 'Full') -And ((Get-OperatingSystem) -ne 'Windows')) { $PSCmdlet.ThrowTerminatingError( @@ -11,7 +11,7 @@ function Invoke-TeamViewerPackageDownload { $true })] [string] - $PackageType = 'Full', + $PackageType, [Parameter()] [ValidateScript( { @@ -20,6 +20,11 @@ function Invoke-TeamViewerPackageDownload { ("MajorVersion parameter is only supported on Windows platforms" | ` ConvertTo-ErrorRecord -ErrorCategory InvalidArgument)) } + if($PackageType -eq 'MSI32' -or 'MSI64' ){ + $PSCmdlet.ThrowTerminatingError( + ("MajorVersion parameter is not supported for MSI packages" | ` + ConvertTo-ErrorRecord -ErrorCategory InvalidArgument)) + } if ($_ -lt 14) { $PSCmdlet.ThrowTerminatingError( ("Unsupported TeamViewer version $_" | ` @@ -39,11 +44,19 @@ function Invoke-TeamViewerPackageDownload { $Force ) + if ((-not $PackageType) -And ((Get-OperatingSystem) -eq 'Windows')) { + $Package = $host.ui.PromptForChoice('Select Package Type', 'Choose a package type:', ` + @('Full', 'Host', 'MSI32', 'MSI64', 'Portable', 'QuickJoin', 'QuickSupport', 'Full64Bit'), 0) + $PackageType = @('Full', 'Host', 'MSI32', 'MSI64', 'Portable', 'QuickJoin', 'QuickSupport', 'Full64Bit')[$Package] + } + $additionalPath = '' switch (Get-OperatingSystem) { 'Windows' { $filename = switch ($PackageType) { 'Full' { 'TeamViewer_Setup.exe' } + 'MSI32' { 'TeamViewer_MSI32.zip' } + 'MSI64' { 'TeamViewer_MSI64.zip' } 'Host' { 'TeamViewer_Host_Setup.exe' } 'Portable' { 'TeamViewerPortable.zip' } 'QuickJoin' { 'TeamViewerQJ.exe' } @@ -53,6 +66,9 @@ function Invoke-TeamViewerPackageDownload { if ($MajorVersion) { $additionalPath = "/version_$($MajorVersion)x" } + if(($PackageType -eq 'MSI32' -or 'MSI64' )){ + $additionalPath = '/version_15x' + } } 'Linux' { $releaseInfo = (Get-Content /etc/*-release) @@ -75,7 +91,7 @@ function Invoke-TeamViewerPackageDownload { } } - $downloadUrl = "https://download.teamviewer.com/download$additionalPath/$filename" + $downloadUrl = "https://dl.teamviewer.com/download$additionalPath/$filename" $targetFile = Join-Path $TargetDirectory $filename if ((Test-Path $targetFile) -And -Not $Force -And ` diff --git a/TeamViewerPS/Public/Invoke-TeamViewerPing.ps1 b/docs/Cmdlets/Public/Invoke-TeamViewerPing.ps1 similarity index 100% rename from TeamViewerPS/Public/Invoke-TeamViewerPing.ps1 rename to docs/Cmdlets/Public/Invoke-TeamViewerPing.ps1 diff --git a/TeamViewerPS/Public/New-TeamViewerContact.ps1 b/docs/Cmdlets/Public/New-TeamViewerContact.ps1 similarity index 100% rename from TeamViewerPS/Public/New-TeamViewerContact.ps1 rename to docs/Cmdlets/Public/New-TeamViewerContact.ps1 diff --git a/TeamViewerPS/Public/New-TeamViewerDevice.ps1 b/docs/Cmdlets/Public/New-TeamViewerDevice.ps1 similarity index 100% rename from TeamViewerPS/Public/New-TeamViewerDevice.ps1 rename to docs/Cmdlets/Public/New-TeamViewerDevice.ps1 diff --git a/TeamViewerPS/Public/New-TeamViewerGroup.ps1 b/docs/Cmdlets/Public/New-TeamViewerGroup.ps1 similarity index 100% rename from TeamViewerPS/Public/New-TeamViewerGroup.ps1 rename to docs/Cmdlets/Public/New-TeamViewerGroup.ps1 diff --git a/TeamViewerPS/Public/New-TeamViewerManagedGroup.ps1 b/docs/Cmdlets/Public/New-TeamViewerManagedGroup.ps1 similarity index 100% rename from TeamViewerPS/Public/New-TeamViewerManagedGroup.ps1 rename to docs/Cmdlets/Public/New-TeamViewerManagedGroup.ps1 diff --git a/TeamViewerPS/Public/New-TeamViewerPolicy.ps1 b/docs/Cmdlets/Public/New-TeamViewerPolicy.ps1 similarity index 100% rename from TeamViewerPS/Public/New-TeamViewerPolicy.ps1 rename to docs/Cmdlets/Public/New-TeamViewerPolicy.ps1 diff --git a/TeamViewerPS/Public/New-TeamViewerUser.ps1 b/docs/Cmdlets/Public/New-TeamViewerUser.ps1 similarity index 100% rename from TeamViewerPS/Public/New-TeamViewerUser.ps1 rename to docs/Cmdlets/Public/New-TeamViewerUser.ps1 diff --git a/TeamViewerPS/Public/New-TeamViewerUserGroup.ps1 b/docs/Cmdlets/Public/New-TeamViewerUserGroup.ps1 similarity index 96% rename from TeamViewerPS/Public/New-TeamViewerUserGroup.ps1 rename to docs/Cmdlets/Public/New-TeamViewerUserGroup.ps1 index 64dc78a..7d9c5f4 100644 --- a/TeamViewerPS/Public/New-TeamViewerUserGroup.ps1 +++ b/docs/Cmdlets/Public/New-TeamViewerUserGroup.ps1 @@ -1,31 +1,31 @@ -function New-TeamViewerUserGroup { - [CmdletBinding(SupportsShouldProcess = $true)] - param( - [Parameter(Mandatory = $true)] - [securestring] - $ApiToken, - - [Parameter(Mandatory = $true)] - [string] - $Name - ) - - Begin { - $resourceUri = "$(Get-TeamViewerApiUri)/usergroups" - $body = @{ name = $Name } - } - - Process { - if ($PSCmdlet.ShouldProcess($Name, "Create user group")) { - $response = Invoke-TeamViewerRestMethod ` - -ApiToken $ApiToken ` - -Uri $resourceUri ` - -Method Post ` - -ContentType "application/json; charset=utf-8" ` - -Body ([System.Text.Encoding]::UTF8.GetBytes(($body | ConvertTo-Json))) ` - -WriteErrorTo $PSCmdlet ` - -ErrorAction Stop - Write-Output ($response | ConvertTo-TeamViewerUserGroup) - } - } -} +function New-TeamViewerUserGroup { + [CmdletBinding(SupportsShouldProcess = $true)] + param( + [Parameter(Mandatory = $true)] + [securestring] + $ApiToken, + + [Parameter(Mandatory = $true)] + [string] + $Name + ) + + Begin { + $resourceUri = "$(Get-TeamViewerApiUri)/usergroups" + $body = @{ name = $Name } + } + + Process { + if ($PSCmdlet.ShouldProcess($Name, "Create user group")) { + $response = Invoke-TeamViewerRestMethod ` + -ApiToken $ApiToken ` + -Uri $resourceUri ` + -Method Post ` + -ContentType "application/json; charset=utf-8" ` + -Body ([System.Text.Encoding]::UTF8.GetBytes(($body | ConvertTo-Json))) ` + -WriteErrorTo $PSCmdlet ` + -ErrorAction Stop + Write-Output ($response | ConvertTo-TeamViewerUserGroup) + } + } +} diff --git a/docs/Cmdlets/Public/New-TeamViewerUserRole.ps1 b/docs/Cmdlets/Public/New-TeamViewerUserRole.ps1 new file mode 100644 index 0000000..27a93b3 --- /dev/null +++ b/docs/Cmdlets/Public/New-TeamViewerUserRole.ps1 @@ -0,0 +1,47 @@ + +function New-TeamViewerUserRole { + [CmdletBinding(SupportsShouldProcess = $true)] + param( + [Parameter(Mandatory = $true )] + [securestring] + $ApiToken, + + [Parameter(Mandatory = $true)] + [Alias('UserRoleName')] + [string] + $Name, + + [Parameter(Mandatory = $false)] + [AllowEmptyCollection()] + [object[]] + $Permissions + ) + Begin { + $resourceUri = "$(Get-TeamViewerApiUri)/userroles" + $body = @{ + Name = $Name + Permissions = @() + } + + if ($Permissions) { + $body.Permissions = @($Permissions) + } + } + + Process { + if ($PSCmdlet.ShouldProcess($Name, 'Create User Role')) { + $response = Invoke-TeamViewerRestMethod ` + -ApiToken $ApiToken ` + -Uri $resourceUri ` + -Method Post ` + -ContentType 'application/json; charset=utf-8' ` + -Body ([System.Text.Encoding]::UTF8.GetBytes(($body | ConvertTo-Json))) ` + -WriteErrorTo $PSCmdlet ` + -ErrorAction Stop + + $result = ($response.Role | ConvertTo-TeamViewerUserRole) + Write-Output $result + } + } + +} diff --git a/TeamViewerPS/Public/Publish-TeamViewerGroup.ps1 b/docs/Cmdlets/Public/Publish-TeamViewerGroup.ps1 similarity index 100% rename from TeamViewerPS/Public/Publish-TeamViewerGroup.ps1 rename to docs/Cmdlets/Public/Publish-TeamViewerGroup.ps1 diff --git a/docs/Cmdlets/Public/Remove-TeamViewerAssignment.ps1 b/docs/Cmdlets/Public/Remove-TeamViewerAssignment.ps1 new file mode 100644 index 0000000..ac2a59c --- /dev/null +++ b/docs/Cmdlets/Public/Remove-TeamViewerAssignment.ps1 @@ -0,0 +1,28 @@ +function Remove-TeamViewerAssignment { + [CmdletBinding(SupportsShouldProcess = $true)] + param() + + + if (Test-TeamViewerInstallation) { + $OS = Get-OperatingSystem + $CurrentDirectory = Get-Location + $installationDirectory = Get-TeamViewerInstallationDirectory + Set-Location $installationDirectory + if ($OS -eq 'Windows') { + $cmd = 'unassign' + $FilePath = 'TeamViewer.exe' + } + elseif ($OS -eq 'Linux') { + $cmd = 'teamviewer unassign' + $FilePath = 'sudo' + } + $process = Start-Process -FilePath $FilePath -ArgumentList $cmd -Wait -PassThru + $process.ExitCode | Resolve-AssignmentErrorCode + Set-Location $CurrentDirectory + } + else { + Write-Output 'TeamViewer is not installed.' + } +} + + diff --git a/TeamViewerPS/Public/Remove-TeamViewerContact.ps1 b/docs/Cmdlets/Public/Remove-TeamViewerContact.ps1 similarity index 100% rename from TeamViewerPS/Public/Remove-TeamViewerContact.ps1 rename to docs/Cmdlets/Public/Remove-TeamViewerContact.ps1 diff --git a/docs/Cmdlets/Public/Remove-TeamViewerCustomization.ps1 b/docs/Cmdlets/Public/Remove-TeamViewerCustomization.ps1 new file mode 100644 index 0000000..0bc1fdc --- /dev/null +++ b/docs/Cmdlets/Public/Remove-TeamViewerCustomization.ps1 @@ -0,0 +1,22 @@ +function Remove-TeamViewerCustomization { + [CmdletBinding(SupportsShouldProcess = $true)] + param() + + if (Get-OperatingSystem -eq 'Windows') { + if (Test-TeamViewerInstallation) { + $installationDirectory = Get-TeamViewerInstallationDirectory + $currentDirectory = Get-Location + Set-Location $installationDirectory + $cmd = 'customize --remove' + $process = Start-Process -FilePath TeamViewer.exe -ArgumentList $cmd -Wait -PassThru + $process.ExitCode | Resolve-CustomizationErrorCode + Set-Location $currentDirectory + } + else { + Write-Error 'TeamViewer is not installed' + } + } + else { + Write-Error 'Customization is currently supported only on Windows.' + } +} diff --git a/TeamViewerPS/Public/Remove-TeamViewerDevice.ps1 b/docs/Cmdlets/Public/Remove-TeamViewerDevice.ps1 similarity index 100% rename from TeamViewerPS/Public/Remove-TeamViewerDevice.ps1 rename to docs/Cmdlets/Public/Remove-TeamViewerDevice.ps1 diff --git a/TeamViewerPS/Public/Remove-TeamViewerGroup.ps1 b/docs/Cmdlets/Public/Remove-TeamViewerGroup.ps1 similarity index 100% rename from TeamViewerPS/Public/Remove-TeamViewerGroup.ps1 rename to docs/Cmdlets/Public/Remove-TeamViewerGroup.ps1 diff --git a/TeamViewerPS/Public/Remove-TeamViewerManagedDevice.ps1 b/docs/Cmdlets/Public/Remove-TeamViewerManagedDevice.ps1 similarity index 100% rename from TeamViewerPS/Public/Remove-TeamViewerManagedDevice.ps1 rename to docs/Cmdlets/Public/Remove-TeamViewerManagedDevice.ps1 diff --git a/TeamViewerPS/Public/Remove-TeamViewerManagedDeviceManagement.ps1 b/docs/Cmdlets/Public/Remove-TeamViewerManagedDeviceManagement.ps1 similarity index 100% rename from TeamViewerPS/Public/Remove-TeamViewerManagedDeviceManagement.ps1 rename to docs/Cmdlets/Public/Remove-TeamViewerManagedDeviceManagement.ps1 diff --git a/TeamViewerPS/Public/Remove-TeamViewerManagedGroup.ps1 b/docs/Cmdlets/Public/Remove-TeamViewerManagedGroup.ps1 similarity index 100% rename from TeamViewerPS/Public/Remove-TeamViewerManagedGroup.ps1 rename to docs/Cmdlets/Public/Remove-TeamViewerManagedGroup.ps1 diff --git a/TeamViewerPS/Public/Remove-TeamViewerManager.ps1 b/docs/Cmdlets/Public/Remove-TeamViewerManager.ps1 similarity index 100% rename from TeamViewerPS/Public/Remove-TeamViewerManager.ps1 rename to docs/Cmdlets/Public/Remove-TeamViewerManager.ps1 diff --git a/docs/Cmdlets/Public/Remove-TeamViewerPSProxy.ps1 b/docs/Cmdlets/Public/Remove-TeamViewerPSProxy.ps1 new file mode 100644 index 0000000..f053140 --- /dev/null +++ b/docs/Cmdlets/Public/Remove-TeamViewerPSProxy.ps1 @@ -0,0 +1,12 @@ +function Remove-TeamViewerPSProxy { + [CmdletBinding(SupportsShouldProcess = $true)] + param() + + $global:TeamViewerProxyUriRemoved = $true + $global:TeamViewerProxyUriRemoved | Out-Null # https://github.com/PowerShell/PSScriptAnalyzer/issues/1472 + if($PSCmdlet.ShouldProcess($TeamViewerProxyUriRemoved,"Remove proxy for WebAPI")){ + $global:TeamViewerProxyUriSet = $null + $global:TeamViewerProxyUriSet | Out-Null # https://github.com/PowerShell/PSScriptAnalyzer/issues/1472 + [Environment]::SetEnvironmentVariable('TeamViewerProxyUri','', 'User') + } +} diff --git a/TeamViewerPS/Public/Remove-TeamViewerPolicy.ps1 b/docs/Cmdlets/Public/Remove-TeamViewerPolicy.ps1 similarity index 100% rename from TeamViewerPS/Public/Remove-TeamViewerPolicy.ps1 rename to docs/Cmdlets/Public/Remove-TeamViewerPolicy.ps1 diff --git a/docs/Cmdlets/Public/Remove-TeamViewerPolicyFromManagedDevice.ps1 b/docs/Cmdlets/Public/Remove-TeamViewerPolicyFromManagedDevice.ps1 new file mode 100644 index 0000000..61d7fa2 --- /dev/null +++ b/docs/Cmdlets/Public/Remove-TeamViewerPolicyFromManagedDevice.ps1 @@ -0,0 +1,39 @@ +function Remove-TeamviewerPolicyFromManagedDevice { + [CmdletBinding(SupportsShouldProcess = $true)] + param( + [Parameter(Mandatory = $true)] + [securestring] + $ApiToken, + + [Parameter(Mandatory = $true, ValueFromPipeline = $true)] + [ValidateScript( { $_ | Resolve-TeamViewerManagedDeviceId } )] + [Alias("DeviceId")] + [object] + $Device, + + [Parameter(Mandatory = $true)] + [PolicyType] + $PolicyType + ) + Begin { + $body = @{ + 'policy_type' = [int]$PolicyType + } + } + Process { + $deviceId = $Device | Resolve-TeamViewerManagedDeviceId + $resourceUri = "$(Get-TeamViewerApiUri)/managed/devices/$deviceId/policy/remove" + + if ($PSCmdlet.ShouldProcess($Device.ToString(), "Change managed device entry")) { + Invoke-TeamViewerRestMethod ` + -ApiToken $ApiToken ` + -Uri $resourceUri ` + -Method Put ` + -ContentType "application/json; charset=utf-8" ` + -Body ([System.Text.Encoding]::UTF8.GetBytes(($body | ConvertTo-Json))) ` + -WriteErrorTo $PSCmdlet ` + -ErrorAction Stop | ` + Out-Null + } + } +} diff --git a/docs/Cmdlets/Public/Remove-TeamViewerRoleFromAccount.ps1 b/docs/Cmdlets/Public/Remove-TeamViewerRoleFromAccount.ps1 new file mode 100644 index 0000000..d92e430 --- /dev/null +++ b/docs/Cmdlets/Public/Remove-TeamViewerRoleFromAccount.ps1 @@ -0,0 +1,63 @@ +function Remove-TeamViewerRoleFromAccount { + [CmdletBinding(SupportsShouldProcess = $true)] + param( + [Parameter(Mandatory = $true)] + [securestring] + $ApiToken, + + [Parameter(Mandatory = $true)] + [ValidateScript( { $_ | Resolve-TeamViewerUserRoleId } )] + [Alias('UserRole')] + [object] + $UserRoleId, + + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [Alias('Id', 'UserIds')] + [string[]] + $Accounts + ) + + Begin { + $id = $UserRoleId | Resolve-TeamViewerUserRoleId + $null = $ApiToken + $resourceUri = "$(Get-TeamViewerApiUri)/userroles/unassign/account" + $AccountsToRemove = @() + $body = @{ + UserIds = @() + UserRoleId = $id + } + function Invoke-TeamViewerRestMethodInternal { + $result = Invoke-TeamViewerRestMethod ` + -ApiToken $ApiToken ` + -Uri $resourceUri ` + -Method Post ` + -ContentType 'application/json; charset=utf-8' ` + -Body ([System.Text.Encoding]::UTF8.GetBytes(($body | ConvertTo-Json))) ` + -WriteErrorTo $PSCmdlet ` + -ErrorAction Stop + Write-Output ($result) + } + + } + + Process { + if ($PSCmdlet.ShouldProcess($Accounts, 'Unassign Account from Role')) { + if (($Accounts -notmatch 'u[0-9]+') -and ($Accounts -match '[0-9]+')) { + $Accounts = $Accounts | ForEach-Object { $_.Insert(0, 'u') } + } + foreach ($Account in $Accounts) { + $AccountsToRemove += $Account + $body.UserIds = @($AccountsToRemove) + } + } + if ($AccountsToRemove.Length -eq 100) { + Invoke-TeamViewerRestMethodInternal + $AccountsToRemove = @() + } + } + End { + if ($AccountsToRemove.Length -gt 0) { + Invoke-TeamViewerRestMethodInternal + } + } +} diff --git a/docs/Cmdlets/Public/Remove-TeamViewerRoleFromUserGroup.ps1 b/docs/Cmdlets/Public/Remove-TeamViewerRoleFromUserGroup.ps1 new file mode 100644 index 0000000..1f53745 --- /dev/null +++ b/docs/Cmdlets/Public/Remove-TeamViewerRoleFromUserGroup.ps1 @@ -0,0 +1,38 @@ +function Remove-TeamViewerRoleFromUserGroup { + [CmdletBinding(SupportsShouldProcess = $true)] + param( + [Parameter(Mandatory = $true)] + [securestring] + $ApiToken, + + [Parameter(Mandatory = $true)] + [ValidateScript( { $_ | Resolve-TeamViewerUserGroupId } )] + [Alias('UserGroupId')] + [Alias('Id')] + [object] + $UserGroup + ) + + Begin { + $null = $ApiToken + $resourceUri = "$(Get-TeamViewerApiUri)/userroles/unassign/usergroup" + $body = @{ + UserGroupId = $UserGroup + } + } + + + Process { + if ($PSCmdlet.ShouldProcess($UserGroupId, 'Unassign Role from User Group')) { + $result = Invoke-TeamViewerRestMethod ` + -ApiToken $ApiToken ` + -Uri $resourceUri ` + -Method Post ` + -ContentType 'application/json; charset=utf-8' ` + -Body ([System.Text.Encoding]::UTF8.GetBytes(($body | ConvertTo-Json))) ` + -WriteErrorTo $PSCmdlet ` + -ErrorAction Stop + Write-Output ($result) + } + } +} diff --git a/TeamViewerPS/Public/Remove-TeamViewerSsoExclusion.ps1 b/docs/Cmdlets/Public/Remove-TeamViewerSsoExclusion.ps1 similarity index 100% rename from TeamViewerPS/Public/Remove-TeamViewerSsoExclusion.ps1 rename to docs/Cmdlets/Public/Remove-TeamViewerSsoExclusion.ps1 diff --git a/TeamViewerPS/Public/Remove-TeamViewerUser.ps1 b/docs/Cmdlets/Public/Remove-TeamViewerUser.ps1 similarity index 100% rename from TeamViewerPS/Public/Remove-TeamViewerUser.ps1 rename to docs/Cmdlets/Public/Remove-TeamViewerUser.ps1 diff --git a/TeamViewerPS/Public/Remove-TeamViewerUserGroup.ps1 b/docs/Cmdlets/Public/Remove-TeamViewerUserGroup.ps1 similarity index 96% rename from TeamViewerPS/Public/Remove-TeamViewerUserGroup.ps1 rename to docs/Cmdlets/Public/Remove-TeamViewerUserGroup.ps1 index 972b068..6085d9d 100644 --- a/TeamViewerPS/Public/Remove-TeamViewerUserGroup.ps1 +++ b/docs/Cmdlets/Public/Remove-TeamViewerUserGroup.ps1 @@ -1,32 +1,32 @@ -function Remove-TeamViewerUserGroup { - [CmdletBinding(SupportsShouldProcess = $true)] - param( - [Parameter(Mandatory = $true)] - [securestring] - $ApiToken, - - [Parameter(Mandatory = $true)] - [ValidateScript( { $_ | Resolve-TeamViewerUserGroupId } )] - [Alias("UserGroupId")] - [Alias("Id")] - [object] - $UserGroup - ) - - Begin { - $id = $UserGroup | Resolve-TeamViewerUserGroupId - $resourceUri = "$(Get-TeamViewerApiUri)/usergroups/$id" - } - - Process { - if ($PSCmdlet.ShouldProcess($UserGroup.ToString(), "Remove user group")) { - Invoke-TeamViewerRestMethod ` - -ApiToken $ApiToken ` - -Uri $resourceUri ` - -Method Delete ` - -WriteErrorTo $PSCmdlet ` - -ErrorAction Stop | ` - Out-Null - } - } -} +function Remove-TeamViewerUserGroup { + [CmdletBinding(SupportsShouldProcess = $true)] + param( + [Parameter(Mandatory = $true)] + [securestring] + $ApiToken, + + [Parameter(Mandatory = $true)] + [ValidateScript( { $_ | Resolve-TeamViewerUserGroupId } )] + [Alias("UserGroupId")] + [Alias("Id")] + [object] + $UserGroup + ) + + Begin { + $id = $UserGroup | Resolve-TeamViewerUserGroupId + $resourceUri = "$(Get-TeamViewerApiUri)/usergroups/$id" + } + + Process { + if ($PSCmdlet.ShouldProcess($UserGroup.ToString(), "Remove user group")) { + Invoke-TeamViewerRestMethod ` + -ApiToken $ApiToken ` + -Uri $resourceUri ` + -Method Delete ` + -WriteErrorTo $PSCmdlet ` + -ErrorAction Stop | ` + Out-Null + } + } +} diff --git a/TeamViewerPS/Public/Remove-TeamViewerUserGroupMember.ps1 b/docs/Cmdlets/Public/Remove-TeamViewerUserGroupMember.ps1 similarity index 97% rename from TeamViewerPS/Public/Remove-TeamViewerUserGroupMember.ps1 rename to docs/Cmdlets/Public/Remove-TeamViewerUserGroupMember.ps1 index 24cc8bb..07f5424 100644 --- a/TeamViewerPS/Public/Remove-TeamViewerUserGroupMember.ps1 +++ b/docs/Cmdlets/Public/Remove-TeamViewerUserGroupMember.ps1 @@ -1,95 +1,95 @@ -function Remove-TeamViewerUserGroupMember { - [CmdletBinding(SupportsShouldProcess = $true, DefaultParameterSetName = 'ByUserGroupMemberId')] - param( - [Parameter(Mandatory = $true)] - [securestring] - $ApiToken, - - [Parameter(Mandatory = $true)] - [ValidateScript( { $_ | Resolve-TeamViewerUserGroupId } )] - [Alias('UserGroupId')] - [Alias('Id')] - [object] - $UserGroup, - - - [Parameter(Mandatory = $true, ValueFromPipeline = $true)] - [ValidateScript( { $_ | Resolve-TeamViewerUserGroupMemberMemberId } )] - [Alias('UserGroupMemberId')] - [Alias('MemberId')] - [Alias('UserId')] - [Alias('User')] - [object[]] - $UserGroupMember - ) - - Begin { - $id = $UserGroup | Resolve-TeamViewerUserGroupId - $resourceUri = "$(Get-TeamViewerApiUri)/usergroups/$id/members" - $membersToRemove = @() - $null = $ApiToken # https://github.com/PowerShell/PSScriptAnalyzer/issues/1472 - $null = $UserGroupMember - function Invoke-TeamViewerRestMethodInternal { - Invoke-TeamViewerRestMethod ` - -ApiToken $ApiToken ` - -Uri $resourceUri ` - -Method Delete ` - -ContentType 'application/json; charset=utf-8' ` - -Body ([System.Text.Encoding]::UTF8.GetBytes(($body))) ` - -WriteErrorTo $PSCmdlet ` - -ErrorAction Stop | ` - Out-Null - } - - function Get-MemberId { - switch ($UserGroupMember) { - { $UserGroupMember[0].PSObject.TypeNames -contains 'TeamViewerPS.UserGroupMember' } { - $UserGroupMember = $UserGroupMember | Resolve-TeamViewerUserGroupMemberMemberId - return $UserGroupMember - } - Default { - if ($UserGroupMember -notmatch 'u[0-9]+') { - ForEach-Object { - $UserGroupMember = [int[]]$UserGroupMember - } - } - else { - ForEach-Object { - $UserGroupMember = [int[]]$UserGroupMember.trim('u') - } - } - return $UserGroupMember - } - } - } - } - - Process { - # when members are provided as pipeline input, each member is provided as separate statement, - # thus the members should be combined to one array in order to send a single request - if ($PSCmdlet.ShouldProcess((Get-MemberId), 'Remove user group member')) { - if (Get-MemberId -isnot [array]) { - $membersToRemove += @(Get-MemberId) - } - else { - $membersToRemove += Get-MemberId - } - $payload = $membersToRemove -join ', ' - $body = "[$payload]" - } - - # WebAPI accepts max 100 accounts. Thus we send a request, and reset the `membersToRemove` - # in order to accept more members - if ($membersToRemove.Length -eq 100) { - Invoke-TeamViewerRestMethodInternal - $membersToRemove = @() - } - } - - End { - # A request needs to be send if there were less than 100 members - if ($membersToRemove.Length -gt 0) { - Invoke-TeamViewerRestMethodInternal - } - } -} +function Remove-TeamViewerUserGroupMember { + [CmdletBinding(SupportsShouldProcess = $true, DefaultParameterSetName = 'ByUserGroupMemberId')] + param( + [Parameter(Mandatory = $true)] + [securestring] + $ApiToken, + + [Parameter(Mandatory = $true)] + [ValidateScript( { $_ | Resolve-TeamViewerUserGroupId } )] + [Alias('UserGroupId')] + [Alias('Id')] + [object] + $UserGroup, + + + [Parameter(Mandatory = $true, ValueFromPipeline = $true)] + [ValidateScript( { $_ | Resolve-TeamViewerUserGroupMemberMemberId } )] + [Alias('UserGroupMemberId')] + [Alias('MemberId')] + [Alias('UserId')] + [Alias('User')] + [object[]] + $UserGroupMember + ) + + Begin { + $id = $UserGroup | Resolve-TeamViewerUserGroupId + $resourceUri = "$(Get-TeamViewerApiUri)/usergroups/$id/members" + $membersToRemove = @() + $null = $ApiToken # https://github.com/PowerShell/PSScriptAnalyzer/issues/1472 + $null = $UserGroupMember + function Invoke-TeamViewerRestMethodInternal { + Invoke-TeamViewerRestMethod ` + -ApiToken $ApiToken ` + -Uri $resourceUri ` + -Method Delete ` + -ContentType 'application/json; charset=utf-8' ` + -Body ([System.Text.Encoding]::UTF8.GetBytes(($body))) ` + -WriteErrorTo $PSCmdlet ` + -ErrorAction Stop | ` + Out-Null + } + + function Get-MemberId { + switch ($UserGroupMember) { + { $UserGroupMember[0].PSObject.TypeNames -contains 'TeamViewerPS.UserGroupMember' } { + $UserGroupMember = $UserGroupMember | Resolve-TeamViewerUserGroupMemberMemberId + return $UserGroupMember + } + Default { + if ($UserGroupMember -notmatch 'u[0-9]+') { + ForEach-Object { + $UserGroupMember = [int[]]$UserGroupMember + } + } + else { + ForEach-Object { + $UserGroupMember = [int[]]$UserGroupMember.trim('u') + } + } + return $UserGroupMember + } + } + } + } + + Process { + # when members are provided as pipeline input, each member is provided as separate statement, + # thus the members should be combined to one array in order to send a single request + if ($PSCmdlet.ShouldProcess((Get-MemberId), 'Remove user group member')) { + if (Get-MemberId -isnot [array]) { + $membersToRemove += @(Get-MemberId) + } + else { + $membersToRemove += Get-MemberId + } + $payload = $membersToRemove -join ', ' + $body = "[$payload]" + } + + # WebAPI accepts max 100 accounts. Thus we send a request, and reset the `membersToRemove` + # in order to accept more members + if ($membersToRemove.Length -eq 100) { + Invoke-TeamViewerRestMethodInternal + $membersToRemove = @() + } + } + + End { + # A request needs to be send if there were less than 100 members + if ($membersToRemove.Length -gt 0) { + Invoke-TeamViewerRestMethodInternal + } + } +} diff --git a/docs/Cmdlets/Public/Remove-TeamViewerUserRole.ps1 b/docs/Cmdlets/Public/Remove-TeamViewerUserRole.ps1 new file mode 100644 index 0000000..e83577e --- /dev/null +++ b/docs/Cmdlets/Public/Remove-TeamViewerUserRole.ps1 @@ -0,0 +1,31 @@ +function Remove-TeamViewerUserRole { + [CmdletBinding(SupportsShouldProcess = $true)] + param( + [Parameter(Mandatory = $true)] + [securestring] + $ApiToken, + + [Parameter(Mandatory = $true)] + [ValidateScript( { $_ | Resolve-TeamViewerUserRoleId } )] + [Alias('UserRole')] + [Alias('Id')] + [object] + $UserRoleId + ) + + Begin { + $resourceUri = "$(Get-TeamViewerApiUri)/userroles?userRoleId=$UserRoleId" + } + + Process { + if ($PSCmdlet.ShouldProcess($UserRoleId.ToString(), 'Remove User Role')) { + Invoke-TeamViewerRestMethod ` + -ApiToken $ApiToken ` + -Uri $resourceUri ` + -Method Delete ` + -WriteErrorTo $PSCmdlet ` + -ErrorAction Stop | ` + Out-Null + } + } +} diff --git a/TeamViewerPS/Public/Restart-TeamViewerService.ps1 b/docs/Cmdlets/Public/Restart-TeamViewerService.ps1 similarity index 87% rename from TeamViewerPS/Public/Restart-TeamViewerService.ps1 rename to docs/Cmdlets/Public/Restart-TeamViewerService.ps1 index 965e6ac..0790234 100644 --- a/TeamViewerPS/Public/Restart-TeamViewerService.ps1 +++ b/docs/Cmdlets/Public/Restart-TeamViewerService.ps1 @@ -2,7 +2,7 @@ function Restart-TeamViewerService { [CmdletBinding(SupportsShouldProcess = $true)] param() - if ($PSCmdlet.ShouldProcess("TeamViewer service")) { + if ($PSCmdlet.ShouldProcess('TeamViewer service')) { switch (Get-OperatingSystem) { 'Windows' { Restart-Service -Name (Get-TeamViewerServiceName) diff --git a/docs/Cmdlets/Public/Set-TeamViewerAPIUri.ps1 b/docs/Cmdlets/Public/Set-TeamViewerAPIUri.ps1 new file mode 100644 index 0000000..6737d11 --- /dev/null +++ b/docs/Cmdlets/Public/Set-TeamViewerAPIUri.ps1 @@ -0,0 +1,24 @@ +function Set-TeamViewerAPIUri { + [CmdletBinding(SupportsShouldProcess = $true)] + param ( + [Parameter(Mandatory = $false)] + [string]$NewUri, + [Parameter(Mandatory = $false)] + [bool]$Default + ) + + $config = [TeamViewerConfiguration]::GetInstance() + $PSDefaultParameterValues = @{'CmdletName:Default' = $true } + + if ($PSCmdlet.ShouldProcess('TeamViewer account')) { + if ($NewUri) { + $config.APIUri = $NewUri + Write-Output "TeamViewer API URL set to: $($config.APIUri)" + } + elseif ($Default) { + $config.APIUri = 'https://webapi.teamviewer.com/api/v1' + Write-Output "TeamViewer API URL set to: $($config.APIUri)" + } + } + +} diff --git a/TeamViewerPS/Public/Set-TeamViewerAccount.ps1 b/docs/Cmdlets/Public/Set-TeamViewerAccount.ps1 similarity index 100% rename from TeamViewerPS/Public/Set-TeamViewerAccount.ps1 rename to docs/Cmdlets/Public/Set-TeamViewerAccount.ps1 diff --git a/TeamViewerPS/Public/Set-TeamViewerDevice.ps1 b/docs/Cmdlets/Public/Set-TeamViewerDevice.ps1 similarity index 100% rename from TeamViewerPS/Public/Set-TeamViewerDevice.ps1 rename to docs/Cmdlets/Public/Set-TeamViewerDevice.ps1 diff --git a/TeamViewerPS/Public/Set-TeamViewerGroup.ps1 b/docs/Cmdlets/Public/Set-TeamViewerGroup.ps1 similarity index 100% rename from TeamViewerPS/Public/Set-TeamViewerGroup.ps1 rename to docs/Cmdlets/Public/Set-TeamViewerGroup.ps1 diff --git a/TeamViewerPS/Public/Set-TeamViewerManagedDevice.ps1 b/docs/Cmdlets/Public/Set-TeamViewerManagedDevice.ps1 similarity index 82% rename from TeamViewerPS/Public/Set-TeamViewerManagedDevice.ps1 rename to docs/Cmdlets/Public/Set-TeamViewerManagedDevice.ps1 index ec99fef..4370385 100644 --- a/TeamViewerPS/Public/Set-TeamViewerManagedDevice.ps1 +++ b/docs/Cmdlets/Public/Set-TeamViewerManagedDevice.ps1 @@ -20,8 +20,10 @@ function Set-TeamViewerManagedDevice { [object] $Policy, - [switch] - $RemovePolicy + [ValidateScript( { $_ | Resolve-TeamViewerManagedGroupId } )] + [Alias("ManagedGroupId")] + [object] + $ManagedGroup ) Begin { $body = @{} @@ -32,13 +34,13 @@ function Set-TeamViewerManagedDevice { if ($Policy) { $body['teamviewerPolicyId'] = $Policy | Resolve-TeamViewerPolicyId } - elseif ($RemovePolicy) { - $body['teamviewerPolicyId'] = "" + elseif ($ManagedGroup) { + $body['managedGroupId'] = $ManagedGroup | Resolve-TeamViewerManagedGroupId } - if ($Policy -And $RemovePolicy) { + if ($Policy -And $ManagedGroup) { $PSCmdlet.ThrowTerminatingError( - ("Parameters -Policy and -RemovePolicy cannot be used together." | ` + ("The combination of parameters -Policy and -ManagedGroup is not allowed." | ` ConvertTo-ErrorRecord -ErrorCategory InvalidArgument)) } diff --git a/TeamViewerPS/Public/Set-TeamViewerManagedGroup.ps1 b/docs/Cmdlets/Public/Set-TeamViewerManagedGroup.ps1 similarity index 100% rename from TeamViewerPS/Public/Set-TeamViewerManagedGroup.ps1 rename to docs/Cmdlets/Public/Set-TeamViewerManagedGroup.ps1 diff --git a/TeamViewerPS/Public/Set-TeamViewerManager.ps1 b/docs/Cmdlets/Public/Set-TeamViewerManager.ps1 similarity index 100% rename from TeamViewerPS/Public/Set-TeamViewerManager.ps1 rename to docs/Cmdlets/Public/Set-TeamViewerManager.ps1 diff --git a/docs/Cmdlets/Public/Set-TeamViewerPSProxy.ps1 b/docs/Cmdlets/Public/Set-TeamViewerPSProxy.ps1 new file mode 100644 index 0000000..be9f49f --- /dev/null +++ b/docs/Cmdlets/Public/Set-TeamViewerPSProxy.ps1 @@ -0,0 +1,21 @@ +$global:TeamViewerProxyUriSet = $null + +function Set-TeamViewerPSProxy { + [CmdletBinding(SupportsShouldProcess =$true)] + param ( + [Parameter(Mandatory=$true)] + [Uri] + $ProxyUri + ) + + if($PSCmdlet.ShouldProcess($ProxyUri,"Sets proxy for WebAPI")){ + $global:TeamViewerProxyUriSet = $ProxyUri + $global:TeamViewerProxyUriRemoved = $false + $global:TeamViewerProxyUriRemoved | Out-Null + + [Environment]::SetEnvironmentVariable("TeamViewerProxyUri", $ProxyUri, "User") + + Write-Output "Proxy set to $TeamViewerProxyUriSet" + } +} + diff --git a/TeamViewerPS/Public/Set-TeamViewerPolicy.ps1 b/docs/Cmdlets/Public/Set-TeamViewerPolicy.ps1 similarity index 100% rename from TeamViewerPS/Public/Set-TeamViewerPolicy.ps1 rename to docs/Cmdlets/Public/Set-TeamViewerPolicy.ps1 diff --git a/TeamViewerPS/Public/Set-TeamViewerUser.ps1 b/docs/Cmdlets/Public/Set-TeamViewerUser.ps1 similarity index 100% rename from TeamViewerPS/Public/Set-TeamViewerUser.ps1 rename to docs/Cmdlets/Public/Set-TeamViewerUser.ps1 diff --git a/TeamViewerPS/Public/Set-TeamViewerUserGroup.ps1 b/docs/Cmdlets/Public/Set-TeamViewerUserGroup.ps1 similarity index 97% rename from TeamViewerPS/Public/Set-TeamViewerUserGroup.ps1 rename to docs/Cmdlets/Public/Set-TeamViewerUserGroup.ps1 index 1fb389a..8cd7d5a 100644 --- a/TeamViewerPS/Public/Set-TeamViewerUserGroup.ps1 +++ b/docs/Cmdlets/Public/Set-TeamViewerUserGroup.ps1 @@ -1,38 +1,38 @@ -function Set-TeamViewerUserGroup { - [CmdletBinding(SupportsShouldProcess = $true)] - param( - [Parameter(Mandatory = $true)] - [securestring] - $ApiToken, - - [Parameter(Mandatory = $true)] - [ValidateScript( { $_ | Resolve-TeamViewerUserGroupId } )] - [Alias("UserGroupId")] - [Alias("Id")] - [object] - $UserGroup, - - [Parameter(Mandatory = $true)] - [Alias("UserGroupName")] - [string] - $Name - ) - Begin { - $id = $UserGroup | Resolve-TeamViewerUserGroupId - $resourceUri = "$(Get-TeamViewerApiUri)/usergroups/$id" - $body = @{ name = $Name } - } - Process { - if ($PSCmdlet.ShouldProcess($UserGroup.ToString(), "Change user group")) { - $response = Invoke-TeamViewerRestMethod ` - -ApiToken $ApiToken ` - -Uri $resourceUri ` - -Method Put ` - -ContentType "application/json; charset=utf-8" ` - -Body ([System.Text.Encoding]::UTF8.GetBytes(($body | ConvertTo-Json))) ` - -WriteErrorTo $PSCmdlet ` - -ErrorAction Stop - Write-Output ($response | ConvertTo-TeamViewerUserGroup) - } - } -} +function Set-TeamViewerUserGroup { + [CmdletBinding(SupportsShouldProcess = $true)] + param( + [Parameter(Mandatory = $true)] + [securestring] + $ApiToken, + + [Parameter(Mandatory = $true)] + [ValidateScript( { $_ | Resolve-TeamViewerUserGroupId } )] + [Alias("UserGroupId")] + [Alias("Id")] + [object] + $UserGroup, + + [Parameter(Mandatory = $true)] + [Alias("UserGroupName")] + [string] + $Name + ) + Begin { + $id = $UserGroup | Resolve-TeamViewerUserGroupId + $resourceUri = "$(Get-TeamViewerApiUri)/usergroups/$id" + $body = @{ name = $Name } + } + Process { + if ($PSCmdlet.ShouldProcess($UserGroup.ToString(), "Change user group")) { + $response = Invoke-TeamViewerRestMethod ` + -ApiToken $ApiToken ` + -Uri $resourceUri ` + -Method Put ` + -ContentType "application/json; charset=utf-8" ` + -Body ([System.Text.Encoding]::UTF8.GetBytes(($body | ConvertTo-Json))) ` + -WriteErrorTo $PSCmdlet ` + -ErrorAction Stop + Write-Output ($response | ConvertTo-TeamViewerUserGroup) + } + } +} diff --git a/docs/Cmdlets/Public/Set-TeamViewerUserRole.ps1 b/docs/Cmdlets/Public/Set-TeamViewerUserRole.ps1 new file mode 100644 index 0000000..d8dbae1 --- /dev/null +++ b/docs/Cmdlets/Public/Set-TeamViewerUserRole.ps1 @@ -0,0 +1,53 @@ + +function Set-TeamViewerUserRole { + [CmdletBinding(SupportsShouldProcess = $true)] + param( + [Parameter(Mandatory = $true )] + [securestring] + $ApiToken, + + [Parameter(Mandatory = $true)] + [Alias('UserRoleName')] + [string] + $Name, + + [Parameter(Mandatory = $false)] + [AllowEmptyCollection()] + [object[]] + $Permissions, + + [Parameter(Mandatory = $true)] + [ValidateScript( { $_ | Resolve-TeamViewerUserRoleId } )] + [Alias('UserRole')] + [object] + $UserRoleId + ) + Begin { + $resourceUri = "$(Get-TeamViewerApiUri)/userroles" + $body = @{ + Name = $Name + Permissions = @() + UserRoleId = $UserRoleId + + } + if ($Permissions) { + $body.Permissions = @($Permissions) + } + } + Process { + if ($PSCmdlet.ShouldProcess($Name, 'Update User Role')) { + $response = Invoke-TeamViewerRestMethod ` + -ApiToken $ApiToken ` + -Uri $resourceUri ` + -Method Put ` + -ContentType 'application/json; charset=utf-8' ` + -Body ([System.Text.Encoding]::UTF8.GetBytes(($body | ConvertTo-Json))) ` + -WriteErrorTo $PSCmdlet ` + -ErrorAction Stop + + $result = $response + Write-Output $result + } + } + +} diff --git a/TeamViewerPS/Public/Start-TeamViewerService.ps1 b/docs/Cmdlets/Public/Start-TeamViewerService.ps1 similarity index 100% rename from TeamViewerPS/Public/Start-TeamViewerService.ps1 rename to docs/Cmdlets/Public/Start-TeamViewerService.ps1 diff --git a/TeamViewerPS/Public/Stop-TeamViewerService.ps1 b/docs/Cmdlets/Public/Stop-TeamViewerService.ps1 similarity index 100% rename from TeamViewerPS/Public/Stop-TeamViewerService.ps1 rename to docs/Cmdlets/Public/Stop-TeamViewerService.ps1 diff --git a/TeamViewerPS/Public/Test-TeamViewerConnectivity.ps1 b/docs/Cmdlets/Public/Test-TeamViewerConnectivity.ps1 similarity index 100% rename from TeamViewerPS/Public/Test-TeamViewerConnectivity.ps1 rename to docs/Cmdlets/Public/Test-TeamViewerConnectivity.ps1 diff --git a/docs/Cmdlets/Public/Test-TeamViewerInstallation.ps1 b/docs/Cmdlets/Public/Test-TeamViewerInstallation.ps1 new file mode 100644 index 0000000..8cdcf30 --- /dev/null +++ b/docs/Cmdlets/Public/Test-TeamViewerInstallation.ps1 @@ -0,0 +1,8 @@ +function Test-TeamViewerInstallation { + if (Get-TeamViewerInstallationDirectory) { + return $true + } + else { + return $false + } +} diff --git a/TeamViewerPS/Public/Unpublish-TeamViewerGroup.ps1 b/docs/Cmdlets/Public/Unpublish-TeamViewerGroup.ps1 similarity index 100% rename from TeamViewerPS/Public/Unpublish-TeamViewerGroup.ps1 rename to docs/Cmdlets/Public/Unpublish-TeamViewerGroup.ps1 diff --git a/docs/Cmdlets_help/Add-TeamViewerAssignment.md b/docs/Cmdlets_help/Add-TeamViewerAssignment.md new file mode 100644 index 0000000..873289f --- /dev/null +++ b/docs/Cmdlets_help/Add-TeamViewerAssignment.md @@ -0,0 +1,98 @@ +--- +external help file: TeamViewerPS-help.xml +Module Name: TeamViewerPS +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Add-TeamViewerAssignment.md +schema: 2.0.0 +--- + +# Add-TeamViewerAssignment + +## SYNOPSIS + +Assigns the device to a company. + +## SYNTAX + +```powershell +Add-TeamViewerAssignment [-AssignmentId] [-DeviceAlias] [-Retries] +``` + +## DESCRIPTION + +Assigns the particular device to a company listed in managed devices. +Assignment ID can be obtained from Management console under Design & Deploy. + +## EXAMPLES + +### Example 1 + +```powershell +PS /> Add-TeamViewerAssignment -AssignmentId '0001CoABChCiJnyAKf0R7r6' +PS /> Add-TeamViewerAssignment -AssignmentId '0001CoABChCiJnyAKf0R7r6' -DeviceAlias 'Test Device 1' +PS /> Add-TeamViewerAssignment -AssignmentId '0001CoABChD3RCXwL6IR7pS' -DeviceAlias 'Test Device 2' -Retries 3 + +``` + +Assigns the devices with default Hostname or with names `Test Device 1` and `Test Device 2` to a Company with the given assignment id. + +## PARAMETERS + +### -AssignmentId + +Object that is required to assign the device to a Company. + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: None + +Required: True +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DeviceAlias + +The alias for a device that is set. If omitted the host-name is used. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: None + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Retries + +The assignment is retried in case of temporary errors. There is a waiting time of 1 second between each try. + +```yaml +Type: int +Parameter Sets: (All) +Aliases: None + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters + +### None + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS diff --git a/docs/Cmdlets_help/Add-TeamViewerCustomization.md b/docs/Cmdlets_help/Add-TeamViewerCustomization.md new file mode 100644 index 0000000..876c4dc --- /dev/null +++ b/docs/Cmdlets_help/Add-TeamViewerCustomization.md @@ -0,0 +1,129 @@ +--- +external help file: TeamViewerPS-help.xml +Module Name: TeamViewerPS +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Add-TeamViewerCustomization.md +schema: 2.0.0 +--- + +# Add-TeamViewerCustomization + +## SYNOPSIS + +Customizes a TeamViewer Installation. + +## SYNTAX + +```powershell +Add-TeamViewerCustomization [[-Id] || [-Path]] [-RestartGUI][-RemoveExisting] +``` + +## DESCRIPTION + +Customizes a TeamViewer Installation and includes assignment of the particular device to a company if included. +Customization can be perfomed in Management console under Design & Deploy. + +## EXAMPLES + +### Example 1 + +```powershell +PS /> Add-TeamViewerCustomization -Id '1234567' +PS /> Add-TeamViewerCustomization -Id '1234567' -RestartGUI +PS /> Add-TeamViewerCustomization -Id '1234567' -RestartGUI -RemoveExisting + +``` + +Customizes the TeamViewer installation with Id. +The next customization to be applied can already be specified after the existing customization removal is performed. +The RestartGUI restarts the running TeamViewer client and the visual changes are applied. + +### Example 2 + +```powershell +PS /> Add-TeamViewerCustomization -Path "X:\67byysp.zip" +PS /> Add-TeamViewerCustomization -Path "X:\67byysp.zip" -RestartGUI +PS /> Add-TeamViewerCustomization -Path "X:\67byysp.zip" -RestartGUI -RemoveExisting + +``` + +Customizes the TeamViewer installation with zip file. +The next customization to be applied can already be specified after the existing customization removal is performed. +The RestartGUI restarts the running TeamViewer client and the visual changes are applied. + +## PARAMETERS + +### -Id + +Object that is required to customize the TeamViewerInstallation. + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: None + +Required: True +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Path + +Object to the path of the customization zip file can be specified instead of Id. + +```yaml +Type: object +Parameter Sets: (All) +Aliases: None + +Required: True +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RestartGUI + +Switch to restart the running TeamViewer client to visualize changes. + +```yaml +Type: switch +Parameter Sets: (All) +Aliases: None + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RemoveExisting + +Switch to specify the next customization to be applied after the existing customization is removed. + +```yaml +Type: switch +Parameter Sets: (All) +Aliases: None + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters + +### None + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS diff --git a/docs/commands/Add-TeamViewerManagedDevice.md b/docs/Cmdlets_help/Add-TeamViewerManagedDevice.md similarity index 98% rename from docs/commands/Add-TeamViewerManagedDevice.md rename to docs/Cmdlets_help/Add-TeamViewerManagedDevice.md index 3ed7ba4..6d32343 100644 --- a/docs/commands/Add-TeamViewerManagedDevice.md +++ b/docs/Cmdlets_help/Add-TeamViewerManagedDevice.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Add-TeamViewerManagedDevice.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Add-TeamViewerManagedDevice.md schema: 2.0.0 --- diff --git a/docs/commands/Add-TeamViewerManager.md b/docs/Cmdlets_help/Add-TeamViewerManager.md similarity index 99% rename from docs/commands/Add-TeamViewerManager.md rename to docs/Cmdlets_help/Add-TeamViewerManager.md index e3dddd2..2bbbeb0 100644 --- a/docs/commands/Add-TeamViewerManager.md +++ b/docs/Cmdlets_help/Add-TeamViewerManager.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Add-TeamViewerManager.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Add-TeamViewerManager.md schema: 2.0.0 --- @@ -14,48 +14,56 @@ Add a manager to a managed device or managed group. ## SYNTAX ### Device_ByAccountId (Default) + ``` Add-TeamViewerManager -ApiToken -AccountId -Device [-Permissions ] [-WhatIf] [-Confirm] [] ``` ### Group_ByAccountId + ``` Add-TeamViewerManager -ApiToken -AccountId -Group [-Permissions ] [-WhatIf] [-Confirm] [] ``` ### Group_ByManagerId + ``` Add-TeamViewerManager -ApiToken -Manager -Group [-Permissions ] [-WhatIf] [-Confirm] [] ``` ### Device_ByManagerId + ``` Add-TeamViewerManager -ApiToken -Manager -Device [-Permissions ] [-WhatIf] [-Confirm] [] ``` ### Group_ByUserObject + ``` Add-TeamViewerManager -ApiToken -User -Group [-Permissions ] [-WhatIf] [-Confirm] [] ``` ### Device_ByUserObject + ``` Add-TeamViewerManager -ApiToken -User -Device [-Permissions ] [-WhatIf] [-Confirm] [] ``` ### Device_ByUserGroupId + ``` Add-TeamViewerManager -ApiToken -UserGroup -Device [-Permissions ] [-WhatIf] [-Confirm] [] ``` ### Group_ByUserGroupId + ``` Add-TeamViewerManager -ApiToken -UserGroup -Group [-Permissions ] [-WhatIf] [-Confirm] [] @@ -255,6 +263,7 @@ Accept wildcard characters: False ``` ### -UserGroup + UserGroup object as returned from `Get-TeamViewerUserGroup` or Id of the UserGroup which should be added as manager of the targeted managed group or managed device. ```yaml @@ -287,6 +296,7 @@ Accept wildcard characters: False ``` ### CommonParameters + This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/docs/Cmdlets_help/Add-TeamViewerRoleToAccount.md b/docs/Cmdlets_help/Add-TeamViewerRoleToAccount.md new file mode 100644 index 0000000..6eaa3ef --- /dev/null +++ b/docs/Cmdlets_help/Add-TeamViewerRoleToAccount.md @@ -0,0 +1,141 @@ +--- +external help file: TeamViewerPS-help.xml +Module Name: TeamViewerPS +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Add-TeamViewerRoleToAccount.md +schema: 2.0.0 +--- + +# Add-TeamViewerRoleToAccount + +## SYNOPSIS + +Assign user role to a list of accountIds. + +## SYNTAX + +```powershell +Add-TeamViewerRoleToAccount [-ApiToken] [-UserRoleId] [-Account] [-WhatIf] + [-Confirm] [] +``` + +## DESCRIPTION + +Assigns user role to one or many users. User role should belong to the TeamViewer company associated with the API access token. + +## EXAMPLES + +### Example 1 + +```powershell +PS /> Add-TeamViewerRoleToAccount -UserRoleId '9b465ea2-2f75-4101-a057-58a81ed0e57b' -Account @('123', '456', '789') +``` + +Assigns role with id `9b465ea2-2f75-4101-a057-58a81ed0e57b` to users with id `123`, `456`, `789`. + +### Example 2 + +```powershell +PS /> @('123', '456', '789') | Add-TeamViewerRoleToAccount -UserRole '9b465ea2-2f75-4101-a057-58a81ed0e57b' +``` + +Assigns role with id `9b465ea2-2f75-4101-a057-58a81ed0e57b` to users with id `123`, `456`, `789`. +Ids are passed as pipeline input. + +## PARAMETERS + +### -ApiToken + +The TeamViewer API access token. + +```yaml +Type: SecureString +Parameter Sets: (All) +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm + +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UserRoleId + +The role to which users will be assigned to. + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: UserRole + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Account + +Users to be assigned to a user role. + +```yaml +Type: string[] +Parameter Sets: (All) +Aliases: + +Required: True +Position: 2 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -WhatIf + +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters + +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### System.string[] + +An array of account Ids. + +## OUTPUTS + +## NOTES + +## RELATED LINKS diff --git a/docs/Cmdlets_help/Add-TeamViewerRoleToUserGroup.md b/docs/Cmdlets_help/Add-TeamViewerRoleToUserGroup.md new file mode 100644 index 0000000..ce3dfa6 --- /dev/null +++ b/docs/Cmdlets_help/Add-TeamViewerRoleToUserGroup.md @@ -0,0 +1,128 @@ +--- +external help file: TeamViewerPS-help.xml +Module Name: TeamViewerPS +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Add-TeamViewerRoleToUserGroup.md +schema: 2.0.0 +--- + +# Add-TeamViewerRoleToUserGroup + +## SYNOPSIS + +Assign user role to a user group. + +## SYNTAX + +```powershell +Add-TeamViewerRoleToUserGroup [-ApiToken] [-UserRole] [-UserGroup] [-WhatIf] + [-Confirm] [] +``` + +## DESCRIPTION + +Assigns user role to a user group of the TeamViewer company associated with the API access token. + +## EXAMPLES + +### Example 1 + +```powershell +PS /> Add-TeamViewerRoleToUserGroup -UserRole '9b465ea2-2f75-4101-a057-58a81ed0e57b' -UserGroup 1001 +``` + +The given user group `1001` gets assigned to the user role with Id `9b465ea2-2f75-4101-a057-58a81ed0e57b`. + +## PARAMETERS + +### -ApiToken + +The TeamViewer API access token. + +```yaml +Type: SecureString +Parameter Sets: (All) +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm + +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UserRole + +The role to be assigned to the accountIds + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: UserRole + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UserGroup + +The user group to which the role should be assigned. + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: Id, UserGroupId + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf + +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters + +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS diff --git a/docs/commands/Add-TeamViewerSsoExclusion.md b/docs/Cmdlets_help/Add-TeamViewerSsoExclusion.md similarity index 96% rename from docs/commands/Add-TeamViewerSsoExclusion.md rename to docs/Cmdlets_help/Add-TeamViewerSsoExclusion.md index e6c0197..29f9a0b 100644 --- a/docs/commands/Add-TeamViewerSsoExclusion.md +++ b/docs/Cmdlets_help/Add-TeamViewerSsoExclusion.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Add-TeamViewerSsoExclusion.md schema: 2.0.0 --- diff --git a/docs/commands/Add-TeamViewerUserGroupMember.md b/docs/Cmdlets_help/Add-TeamViewerUserGroupMember.md similarity index 93% rename from docs/commands/Add-TeamViewerUserGroupMember.md rename to docs/Cmdlets_help/Add-TeamViewerUserGroupMember.md index 86da423..227136f 100644 --- a/docs/commands/Add-TeamViewerUserGroupMember.md +++ b/docs/Cmdlets_help/Add-TeamViewerUserGroupMember.md @@ -1,146 +1,146 @@ ---- -external help file: TeamViewerPS-help.xml -Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Add-TeamViewerUserGroupMember.md -schema: 2.0.0 ---- - -# Add-TeamViewerUserGroupMember - -## SYNOPSIS - -Add a list of accountIds to a user group. - -## SYNTAX - -```powershell -Add-TeamViewerUserGroupMember [-ApiToken] [-UserGroup] [-Member] [-WhatIf] - [-Confirm] [] -``` - -## DESCRIPTION - -Adds a list of accountIds to a user groups of the TeamViewer company associated with the API access token. - -## EXAMPLES - -### Example 1 - -```powershell -PS /> Add-TeamViewerUserGroupMember -Id 1001 -Member @(123, 456, 789) -PS /> Add-TeamViewerUserGroupMember -Id 1001 -Member 123, 456, 789 -``` - -Adds the given accountIds (123, 456, 789) to the user group with Id 1001. - -### Example 2 - -```powershell -PS /> @(123, 456, 789) | Add-TeamViewerUserGroupMember -Id 1001 -``` - -Adds the given accountIds (123, 456, 789) to the user group with Id 1001. -Ids are passed as pipeline input. - -## PARAMETERS - -### -ApiToken - -The TeamViewer API access token. - -```yaml -Type: SecureString -Parameter Sets: (All) -Aliases: - -Required: True -Position: 0 -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -Confirm - -Prompts you for confirmation before running the cmdlet. - -```yaml -Type: SwitchParameter -Parameter Sets: (All) -Aliases: cf - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -Member - -The list of accounts Ids to be added as member of the group. - -```yaml -Type: Int32[] -Parameter Sets: (All) -Aliases: - -Required: True -Position: 2 -Default value: None -Accept pipeline input: True (ByValue) -Accept wildcard characters: False -``` - -### -UserGroup - -The groups where accounts will be added as members - -```yaml -Type: Object -Parameter Sets: (All) -Aliases: Id, UserGroupId - -Required: True -Position: 1 -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -WhatIf - -Shows what would happen if the cmdlet runs. -The cmdlet is not run. - -```yaml -Type: SwitchParameter -Parameter Sets: (All) -Aliases: wi - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### CommonParameters - -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### System.Int32[] - -An array of account Ids. - -## OUTPUTS - -### System.Object - -An array of `TeamViewerPS.UserGroupMember` objects. - -## NOTES - -## RELATED LINKS +--- +external help file: TeamViewerPS-help.xml +Module Name: TeamViewerPS +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Add-TeamViewerUserGroupMember.md +schema: 2.0.0 +--- + +# Add-TeamViewerUserGroupMember + +## SYNOPSIS + +Add a list of accountIds to a user group. + +## SYNTAX + +```powershell +Add-TeamViewerUserGroupMember [-ApiToken] [-UserGroup] [-Member] [-WhatIf] + [-Confirm] [] +``` + +## DESCRIPTION + +Adds a list of accountIds to a user groups of the TeamViewer company associated with the API access token. + +## EXAMPLES + +### Example 1 + +```powershell +PS /> Add-TeamViewerUserGroupMember -Id 1001 -Member @(123, 456, 789) +PS /> Add-TeamViewerUserGroupMember -Id 1001 -Member 123, 456, 789 +``` + +Adds the given accountIds (123, 456, 789) to the user group with Id 1001. + +### Example 2 + +```powershell +PS /> @(123, 456, 789) | Add-TeamViewerUserGroupMember -Id 1001 +``` + +Adds the given accountIds (123, 456, 789) to the user group with Id 1001. +Ids are passed as pipeline input. + +## PARAMETERS + +### -ApiToken + +The TeamViewer API access token. + +```yaml +Type: SecureString +Parameter Sets: (All) +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm + +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Member + +The list of accounts Ids to be added as member of the group. + +```yaml +Type: Int32[] +Parameter Sets: (All) +Aliases: + +Required: True +Position: 2 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -UserGroup + +The groups where accounts will be added as members + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: Id, UserGroupId + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf + +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters + +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### System.Int32[] + +An array of account Ids. + +## OUTPUTS + +### System.Object + +An array of `TeamViewerPS.UserGroupMember` objects. + +## NOTES + +## RELATED LINKS diff --git a/docs/commands/Connect-TeamViewerApi.md b/docs/Cmdlets_help/Connect-TeamViewerApi.md similarity index 96% rename from docs/commands/Connect-TeamViewerApi.md rename to docs/Cmdlets_help/Connect-TeamViewerApi.md index fd09af6..015a8be 100644 --- a/docs/commands/Connect-TeamViewerApi.md +++ b/docs/Cmdlets_help/Connect-TeamViewerApi.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Connect-TeamViewerApi.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Connect-TeamViewerApi.md schema: 2.0.0 --- diff --git a/docs/commands/Disconnect-TeamViewerApi.md b/docs/Cmdlets_help/Disconnect-TeamViewerApi.md similarity index 95% rename from docs/commands/Disconnect-TeamViewerApi.md rename to docs/Cmdlets_help/Disconnect-TeamViewerApi.md index 350c6d8..6c5f1e6 100644 --- a/docs/commands/Disconnect-TeamViewerApi.md +++ b/docs/Cmdlets_help/Disconnect-TeamViewerApi.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Disconnect-TeamViewerApi.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Disconnect-TeamViewerApi.md schema: 2.0.0 --- diff --git a/docs/Cmdlets_help/Export-TeamViewerSystemInformation.md b/docs/Cmdlets_help/Export-TeamViewerSystemInformation.md new file mode 100644 index 0000000..1eacf6e --- /dev/null +++ b/docs/Cmdlets_help/Export-TeamViewerSystemInformation.md @@ -0,0 +1,72 @@ +--- +external help file: TeamViewerPS-help.xml +Module Name: TeamViewerPS +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Export-TeamViewerSystemInformation.md +schema: 2.0.0 +--- + +# Export-TeamViewerSystemInformation + +## SYNOPSIS + +Collect the files required by TeamViewer support and zip them. + +## SYNTAX + +```powershell +Export-TeamViewerSystemInformation [[-TargetDirectory] ] [] +``` + +## DESCRIPTION + +Collects the files required by TeamViewer support and creates a zip file with clientID in its name. + +## EXAMPLES + +### Example 1 + +```powershell +PS /> Export-TeamViewerSystemInformation +``` + +The zip file is created and stored in the working directory. + +### Example 2 + +```powershell +PS C:\> Export-TeamViewerSystemInformation -TargetDirectory "C:\" +``` + +The zip file is created and stored in the target directory + +## PARAMETERS + +### -TargetDirectory + +Specify the target directory to store TeamViewer support file. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters + +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### None + +## OUTPUTS + +## NOTES + +## RELATED LINKS diff --git a/docs/commands/Get-TeamViewerAccount.md b/docs/Cmdlets_help/Get-TeamViewerAccount.md similarity index 96% rename from docs/commands/Get-TeamViewerAccount.md rename to docs/Cmdlets_help/Get-TeamViewerAccount.md index d470b76..2052426 100644 --- a/docs/commands/Get-TeamViewerAccount.md +++ b/docs/Cmdlets_help/Get-TeamViewerAccount.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Get-TeamViewerAccount.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Get-TeamViewerAccount.md schema: 2.0.0 --- diff --git a/docs/commands/Get-TeamViewerConnectionReport.md b/docs/Cmdlets_help/Get-TeamViewerConnectionReport.md similarity index 99% rename from docs/commands/Get-TeamViewerConnectionReport.md rename to docs/Cmdlets_help/Get-TeamViewerConnectionReport.md index fd820a0..6e5923f 100644 --- a/docs/commands/Get-TeamViewerConnectionReport.md +++ b/docs/Cmdlets_help/Get-TeamViewerConnectionReport.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Get-TeamViewerConnectionReport.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Get-TeamViewerConnectionReport.md schema: 2.0.0 --- diff --git a/docs/commands/Get-TeamViewerContact.md b/docs/Cmdlets_help/Get-TeamViewerContact.md similarity index 98% rename from docs/commands/Get-TeamViewerContact.md rename to docs/Cmdlets_help/Get-TeamViewerContact.md index 5a80fb1..233ca74 100644 --- a/docs/commands/Get-TeamViewerContact.md +++ b/docs/Cmdlets_help/Get-TeamViewerContact.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Get-TeamViewerContact.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Get-TeamViewerContact.md schema: 2.0.0 --- diff --git a/docs/Cmdlets_help/Get-TeamViewerCustomModuleId.md b/docs/Cmdlets_help/Get-TeamViewerCustomModuleId.md new file mode 100644 index 0000000..efe5c9e --- /dev/null +++ b/docs/Cmdlets_help/Get-TeamViewerCustomModuleId.md @@ -0,0 +1,48 @@ +--- +external help file: TeamViewerPS-help.xml +Module Name: TeamViewerPS +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Get-TeamViewerCustomModuleId.md +schema: 2.0.0 +--- + +# Get-TeamViewerCustomModuleId + +## SYNOPSIS + +Retrieves the currently applied TeamViewer custom module's ID. + +## SYNTAX + +```powershell +Get-TeamViewerCustomModuleId +``` + +## DESCRIPTION + +The command checks the TeamViewer Installation and returns the custom module ID. + +## EXAMPLES + +### Example 1 + +```powershell +PS /> Get-TeamViewerCustomModuleId +``` + +Returns the custom module id. + +## PARAMETERS + +### CommonParameters + +### None + +## INPUTS + +### None + +## OUTPUTS + +## NOTES + +## RELATED LINKS diff --git a/docs/commands/Get-TeamViewerDevice.md b/docs/Cmdlets_help/Get-TeamViewerDevice.md similarity index 98% rename from docs/commands/Get-TeamViewerDevice.md rename to docs/Cmdlets_help/Get-TeamViewerDevice.md index ca34be8..cf40053 100644 --- a/docs/commands/Get-TeamViewerDevice.md +++ b/docs/Cmdlets_help/Get-TeamViewerDevice.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Get-TeamViewerDevice.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Get-TeamViewerDevice.md schema: 2.0.0 --- diff --git a/docs/commands/Get-TeamViewerEventLog.md b/docs/Cmdlets_help/Get-TeamViewerEventLog.md similarity index 99% rename from docs/commands/Get-TeamViewerEventLog.md rename to docs/Cmdlets_help/Get-TeamViewerEventLog.md index 0e975d4..072a2fd 100644 --- a/docs/commands/Get-TeamViewerEventLog.md +++ b/docs/Cmdlets_help/Get-TeamViewerEventLog.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Get-TeamViewerEventLog.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Get-TeamViewerEventLog.md schema: 2.0.0 --- diff --git a/docs/commands/Get-TeamViewerGroup.md b/docs/Cmdlets_help/Get-TeamViewerGroup.md similarity index 98% rename from docs/commands/Get-TeamViewerGroup.md rename to docs/Cmdlets_help/Get-TeamViewerGroup.md index 5b583bf..1f248a9 100644 --- a/docs/commands/Get-TeamViewerGroup.md +++ b/docs/Cmdlets_help/Get-TeamViewerGroup.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Get-TeamViewerGroup.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Get-TeamViewerGroup.md schema: 2.0.0 --- diff --git a/docs/commands/Get-TeamViewerId.md b/docs/Cmdlets_help/Get-TeamViewerId.md similarity index 95% rename from docs/commands/Get-TeamViewerId.md rename to docs/Cmdlets_help/Get-TeamViewerId.md index df4a471..912b0f5 100644 --- a/docs/commands/Get-TeamViewerId.md +++ b/docs/Cmdlets_help/Get-TeamViewerId.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Get-TeamViewerId.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Get-TeamViewerId.md schema: 2.0.0 --- diff --git a/docs/Cmdlets_help/Get-TeamViewerInstallationDirectory.md b/docs/Cmdlets_help/Get-TeamViewerInstallationDirectory.md new file mode 100644 index 0000000..4ada3b1 --- /dev/null +++ b/docs/Cmdlets_help/Get-TeamViewerInstallationDirectory.md @@ -0,0 +1,48 @@ +--- +external help file: TeamViewerPS-help.xml +Module Name: TeamViewerPS +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Get-TeamViewerInstallationDirectory.md +schema: 2.0.0 +--- + +# Get-TeamViewerInstallationDirectory + +## SYNOPSIS + +Retrieves the TeamViewer installation directory. + +## SYNTAX + +```powershell +Get-TeamViewerInstallationDirectory +``` + +## DESCRIPTION + +The command checks the TeamViewer Installation and returns the installation directory. + +## EXAMPLES + +### Example 1 + +```powershell +PS /> Get-TeamViewerInstallationDirectory +``` + +Returns the installation directory. + +## PARAMETERS + +### CommonParameters + +### None + +## INPUTS + +### None + +## OUTPUTS + +## NOTES + +## RELATED LINKS diff --git a/docs/Cmdlets_help/Get-TeamViewerLogFilePath.md b/docs/Cmdlets_help/Get-TeamViewerLogFilePath.md new file mode 100644 index 0000000..33396a8 --- /dev/null +++ b/docs/Cmdlets_help/Get-TeamViewerLogFilePath.md @@ -0,0 +1,70 @@ +--- +external help file: TeamViewerPS-help.xml +Module Name: TeamViewerPS +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Get-TeamViewerLogFilePath +schema: 2.0.0 +--- + +# Get-TeamViewerLogFilePath + +## SYNOPSIS + +Retrieves TeamViewer log files. + +## SYNTAX + +```powershell +Get-TeamViewerLogFilePath -OpenFile +``` + +## DESCRIPTION + +The command checks the required directories and returns the paths for log files. + +## EXAMPLES + +### Example 1 + +```powershell +PS /> Get-TeamViewerLogFilePath +``` + +Returns the paths for log files. + +### Example 2 + +```powershell +PS /> Get-TeamViewerLogFilePath -OpenFile +``` + +Provides a prompt with choice to open the located files. + +## PARAMETERS + +### -OpenFile + +Switch to open a log file. + +```yaml +Type: switch +Parameter Sets: (All) +Aliases: None + +Required: False +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters + +### None + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS diff --git a/docs/commands/Get-TeamViewerManagedDevice.md b/docs/Cmdlets_help/Get-TeamViewerManagedDevice.md similarity index 98% rename from docs/commands/Get-TeamViewerManagedDevice.md rename to docs/Cmdlets_help/Get-TeamViewerManagedDevice.md index 574ffff..d214115 100644 --- a/docs/commands/Get-TeamViewerManagedDevice.md +++ b/docs/Cmdlets_help/Get-TeamViewerManagedDevice.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Get-TeamViewerManagedDevice.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Get-TeamViewerManagedDevice.md schema: 2.0.0 --- diff --git a/docs/commands/Get-TeamViewerManagedGroup.md b/docs/Cmdlets_help/Get-TeamViewerManagedGroup.md similarity index 97% rename from docs/commands/Get-TeamViewerManagedGroup.md rename to docs/Cmdlets_help/Get-TeamViewerManagedGroup.md index d598571..c4d44b3 100644 --- a/docs/commands/Get-TeamViewerManagedGroup.md +++ b/docs/Cmdlets_help/Get-TeamViewerManagedGroup.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Get-TeamViewerManagedGroup.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Get-TeamViewerManagedGroup.md schema: 2.0.0 --- diff --git a/docs/commands/Get-TeamViewerManagementId.md b/docs/Cmdlets_help/Get-TeamViewerManagementId.md similarity index 94% rename from docs/commands/Get-TeamViewerManagementId.md rename to docs/Cmdlets_help/Get-TeamViewerManagementId.md index d461eb4..f7629be 100644 --- a/docs/commands/Get-TeamViewerManagementId.md +++ b/docs/Cmdlets_help/Get-TeamViewerManagementId.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Get-TeamViewerManagementId.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Get-TeamViewerManagementId.md schema: 2.0.0 --- diff --git a/docs/commands/Get-TeamViewerManager.md b/docs/Cmdlets_help/Get-TeamViewerManager.md similarity index 97% rename from docs/commands/Get-TeamViewerManager.md rename to docs/Cmdlets_help/Get-TeamViewerManager.md index 67a3298..2f608fa 100644 --- a/docs/commands/Get-TeamViewerManager.md +++ b/docs/Cmdlets_help/Get-TeamViewerManager.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Get-TeamViewerManager.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Get-TeamViewerManager.md schema: 2.0.0 --- diff --git a/docs/commands/Get-TeamViewerPolicy.md b/docs/Cmdlets_help/Get-TeamViewerPolicy.md similarity index 97% rename from docs/commands/Get-TeamViewerPolicy.md rename to docs/Cmdlets_help/Get-TeamViewerPolicy.md index 8873109..143b190 100644 --- a/docs/commands/Get-TeamViewerPolicy.md +++ b/docs/Cmdlets_help/Get-TeamViewerPolicy.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Get-TeamViewerPolicy.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Get-TeamViewerPolicy.md schema: 2.0.0 --- diff --git a/docs/Cmdlets_help/Get-TeamViewerRoleAssignmentToAccount.md b/docs/Cmdlets_help/Get-TeamViewerRoleAssignmentToAccount.md new file mode 100644 index 0000000..47d8ec0 --- /dev/null +++ b/docs/Cmdlets_help/Get-TeamViewerRoleAssignmentToAccount.md @@ -0,0 +1,84 @@ +--- +external help file: TeamViewerPS-help.xml +Module Name: TeamViewerPS +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Get-TeamViewerRoleAssignmentToAccount.md +schema: 2.0.0 +--- + +# Get-TeamViewerRoleAssignmentToAccount + +## SYNOPSIS + +Lists all user role assignments of a user role. + +## SYNTAX + +```powershell +Get-TeamViewerRoleAssignmentToAccount [-ApiToken] [-UserRoleId] [] +``` + +## DESCRIPTION + +Lists all user role assignments of user role in the TeamViewer company associated with the API access token. + +## EXAMPLES + +### Example 1 + +```powershell +PS /> Get-TeamViewerRoleAssignmentToAccount -UserRoleId '72abbedc-9853-4fc8-9d28-fa35e207b048' +``` + +Lists all user assignments of user role `72abbedc-9853-4fc8-9d28-fa35e207b048`. + +## PARAMETERS + +### -ApiToken + +The TeamViewer API access token. + +```yaml +Type: SecureString +Parameter Sets: (All) +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UserRoleId + +UserRole to list its assigned users. + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: UserRole + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters + +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### None + +## OUTPUTS + +### System.Object + +An array of `TeamViewerPS.RoleAssignedUser` objects. + +## NOTES + +## RELATED LINKS diff --git a/docs/Cmdlets_help/Get-TeamViewerRoleAssignmentToUserGroup.md b/docs/Cmdlets_help/Get-TeamViewerRoleAssignmentToUserGroup.md new file mode 100644 index 0000000..abc39fc --- /dev/null +++ b/docs/Cmdlets_help/Get-TeamViewerRoleAssignmentToUserGroup.md @@ -0,0 +1,84 @@ +--- +external help file: TeamViewerPS-help.xml +Module Name: TeamViewerPS +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Get-TeamViewerRoleAssignmentToUserGroup.md +schema: 2.0.0 +--- + +# Get-TeamViewerRoleAssignmentToUserGroup + +## SYNOPSIS + +Lists all user group assignments of a user role. + +## SYNTAX + +```powershell +Get-TeamViewerRoleAssignmentToUserGroup [-ApiToken] [-UserRoleId] [] +``` + +## DESCRIPTION + +Lists all user group assignments of a user role in the TeamViewer company associated with the API access token. + +## EXAMPLES + +### Example 1 + +```powershell +PS /> Get-TeamViewerRoleAssignmentToUserGroup -UserRoleId '72abbedc-9853-4fc8-9d28-fa35e207b048' +``` + +Lists all user group assignments of user role `72abbedc-9853-4fc8-9d28-fa35e207b048`. + +## PARAMETERS + +### -ApiToken + +The TeamViewer API access token. + +```yaml +Type: SecureString +Parameter Sets: (All) +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UserRoleId + +UserRole to list its assigned users. + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: UserRole + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters + +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### None + +## OUTPUTS + +### System.Object + +An array of `TeamViewerPS.RoleAssignedUserGroup` objects. + +## NOTES + +## RELATED LINKS diff --git a/docs/commands/Get-TeamViewerService.md b/docs/Cmdlets_help/Get-TeamViewerService.md similarity index 95% rename from docs/commands/Get-TeamViewerService.md rename to docs/Cmdlets_help/Get-TeamViewerService.md index de5ef17..3d9ae9a 100644 --- a/docs/commands/Get-TeamViewerService.md +++ b/docs/Cmdlets_help/Get-TeamViewerService.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Get-TeamViewerService.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Get-TeamViewerService.md schema: 2.0.0 --- diff --git a/docs/commands/Get-TeamViewerSsoDomain.md b/docs/Cmdlets_help/Get-TeamViewerSsoDomain.md similarity index 92% rename from docs/commands/Get-TeamViewerSsoDomain.md rename to docs/Cmdlets_help/Get-TeamViewerSsoDomain.md index 0d4a7fc..5a5f4f5 100644 --- a/docs/commands/Get-TeamViewerSsoDomain.md +++ b/docs/Cmdlets_help/Get-TeamViewerSsoDomain.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Get-TeamViewerSsoDomain.md schema: 2.0.0 --- diff --git a/docs/commands/Get-TeamViewerSsoExclusion.md b/docs/Cmdlets_help/Get-TeamViewerSsoExclusion.md similarity index 94% rename from docs/commands/Get-TeamViewerSsoExclusion.md rename to docs/Cmdlets_help/Get-TeamViewerSsoExclusion.md index d4b8c39..cc841ca 100644 --- a/docs/commands/Get-TeamViewerSsoExclusion.md +++ b/docs/Cmdlets_help/Get-TeamViewerSsoExclusion.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Get-TeamViewerSsoExclusion.md schema: 2.0.0 --- diff --git a/docs/commands/Get-TeamViewerUser.md b/docs/Cmdlets_help/Get-TeamViewerUser.md similarity index 97% rename from docs/commands/Get-TeamViewerUser.md rename to docs/Cmdlets_help/Get-TeamViewerUser.md index 6e2a1e2..c20a735 100644 --- a/docs/commands/Get-TeamViewerUser.md +++ b/docs/Cmdlets_help/Get-TeamViewerUser.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Get-TeamViewerUser.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Get-TeamViewerUser.md schema: 2.0.0 --- @@ -146,7 +146,7 @@ Accept wildcard characters: False ### -PropertiesToLoad Can be used to retrieve all available properties of a user or just a -stripped-down mininal set of user properties. +stripped-down minimal set of user properties. ```yaml Type: Object diff --git a/docs/commands/Get-TeamViewerUserGroup.md b/docs/Cmdlets_help/Get-TeamViewerUserGroup.md similarity index 92% rename from docs/commands/Get-TeamViewerUserGroup.md rename to docs/Cmdlets_help/Get-TeamViewerUserGroup.md index fb7eaf3..fb81750 100644 --- a/docs/commands/Get-TeamViewerUserGroup.md +++ b/docs/Cmdlets_help/Get-TeamViewerUserGroup.md @@ -1,93 +1,93 @@ ---- -external help file: TeamViewerPS-help.xml -Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Get-Get-TeamViewerUserGroup.md -schema: 2.0.0 ---- - -# Get-TeamViewerUserGroup - -## SYNOPSIS - -Retrieve user groups of a TeamViewer company. - -## SYNTAX - -```powershell -Get-TeamViewerUserGroup [-ApiToken] [[-UserGroup] ] [] -``` - -## DESCRIPTION - -Lists all user groups of the TeamViewer company associated with the API access token. -The list can optionally be filtered using additional parameters. - -## EXAMPLES - -### Example 1 - -```powershell -PS /> Get-TeamViewerUserGroup -``` - -List all user groups. - -### Example 2 - -```powershell -PS /> Get-TeamViewerUserGroup -Id 1001 -``` - -Retrieve a single user group with id 1001. - -## PARAMETERS - -### -ApiToken - -The TeamViewer API access token. - -```yaml -Type: SecureString -Parameter Sets: (All) -Aliases: - -Required: True -Position: 0 -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -UserGroup - -Optional UserGroup that can be used to only get information of a specific user group. - -```yaml -Type: Object -Parameter Sets: (All) -Aliases: Id, UserGroupId - -Required: False -Position: 1 -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### CommonParameters - -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### None - -## OUTPUTS - -### System.Object - -An array of `TeamViewerPS.UserGroup` objects. - -## NOTES - -## RELATED LINKS +--- +external help file: TeamViewerPS-help.xml +Module Name: TeamViewerPS +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Get-Get-TeamViewerUserGroup.md +schema: 2.0.0 +--- + +# Get-TeamViewerUserGroup + +## SYNOPSIS + +Retrieve user groups of a TeamViewer company. + +## SYNTAX + +```powershell +Get-TeamViewerUserGroup [-ApiToken] [[-UserGroup] ] [] +``` + +## DESCRIPTION + +Lists all user groups of the TeamViewer company associated with the API access token. +The list can optionally be filtered using additional parameters. + +## EXAMPLES + +### Example 1 + +```powershell +PS /> Get-TeamViewerUserGroup +``` + +List all user groups. + +### Example 2 + +```powershell +PS /> Get-TeamViewerUserGroup -Id 1001 +``` + +Retrieve a single user group with id 1001. + +## PARAMETERS + +### -ApiToken + +The TeamViewer API access token. + +```yaml +Type: SecureString +Parameter Sets: (All) +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UserGroup + +Optional UserGroup that can be used to only get information of a specific user group. + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: Id, UserGroupId + +Required: False +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters + +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### None + +## OUTPUTS + +### System.Object + +An array of `TeamViewerPS.UserGroup` objects. + +## NOTES + +## RELATED LINKS diff --git a/docs/commands/Get-TeamViewerUserGroupMember.md b/docs/Cmdlets_help/Get-TeamViewerUserGroupMember.md similarity index 92% rename from docs/commands/Get-TeamViewerUserGroupMember.md rename to docs/Cmdlets_help/Get-TeamViewerUserGroupMember.md index 2f468c7..c3e2334 100644 --- a/docs/commands/Get-TeamViewerUserGroupMember.md +++ b/docs/Cmdlets_help/Get-TeamViewerUserGroupMember.md @@ -1,84 +1,84 @@ ---- -external help file: TeamViewerPS-help.xml -Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Get-TeamViewerUserGroupMember.md -schema: 2.0.0 ---- - -# Get-TeamViewerUserGroupMember - -## SYNOPSIS - -List all members of a user group. - -## SYNTAX - -```powershell -Get-TeamViewerUserGroupMember [-ApiToken] [-UserGroup] [] -``` - -## DESCRIPTION - -Lists all members of a user group of the TeamViewer company associated with the API access token. - -## EXAMPLES - -### Example 1 - -```powershell -PS /> Get-TeamViewerUserGroupMember -Id 1001 -``` - -List members all members of the user group with Id 1001. - -## PARAMETERS - -### -ApiToken - -The TeamViewer API access token. - -```yaml -Type: SecureString -Parameter Sets: (All) -Aliases: - -Required: True -Position: 0 -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -UserGroup - -UserGroup to list its members. - -```yaml -Type: Object -Parameter Sets: (All) -Aliases: Id, UserGroupId - -Required: True -Position: 1 -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### CommonParameters - -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### None - -## OUTPUTS - -### System.Object - -An array of `TeamViewerPS.UserGroupMember` objects. - -## NOTES - -## RELATED LINKS +--- +external help file: TeamViewerPS-help.xml +Module Name: TeamViewerPS +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Get-TeamViewerUserGroupMember.md +schema: 2.0.0 +--- + +# Get-TeamViewerUserGroupMember + +## SYNOPSIS + +List all members of a user group. + +## SYNTAX + +```powershell +Get-TeamViewerUserGroupMember [-ApiToken] [-UserGroup] [] +``` + +## DESCRIPTION + +Lists all members of a user group of the TeamViewer company associated with the API access token. + +## EXAMPLES + +### Example 1 + +```powershell +PS /> Get-TeamViewerUserGroupMember -Id 1001 +``` + +List members all members of the user group with Id 1001. + +## PARAMETERS + +### -ApiToken + +The TeamViewer API access token. + +```yaml +Type: SecureString +Parameter Sets: (All) +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UserGroup + +UserGroup to list its members. + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: Id, UserGroupId + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters + +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### None + +## OUTPUTS + +### System.Object + +An array of `TeamViewerPS.UserGroupMember` objects. + +## NOTES + +## RELATED LINKS diff --git a/docs/Cmdlets_help/Get-TeamViewerUserRole.md b/docs/Cmdlets_help/Get-TeamViewerUserRole.md new file mode 100644 index 0000000..1fcf81a --- /dev/null +++ b/docs/Cmdlets_help/Get-TeamViewerUserRole.md @@ -0,0 +1,68 @@ +--- +external help file: TeamViewerPS-help.xml +Module Name: TeamViewerPS +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Get-TeamViewerUserRole.md +schema: 2.0.0 +--- + +# Get-TeamViewerUserRole + +## SYNOPSIS + +Retrieve user roles in a TeamViewer company. + +## SYNTAX + +```powershell +Get-TeamViewerUserRole [-ApiToken] [] +``` + +## DESCRIPTION + +Lists all user roles in the TeamViewer company associated with the API access token. + +## EXAMPLES + +### Example 1 + +```powershell +PS /> Get-TeamViewerUserRole +``` + +List all user roles and their permissions. + +## PARAMETERS + +### -ApiToken + +The TeamViewer API access token. + +```yaml +Type: SecureString +Parameter Sets: (All) +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters + +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### None + +## OUTPUTS + +### System.Object + +An array of `TeamViewerPS.UserRole` objects. + +## NOTES + +## RELATED LINKS diff --git a/docs/commands/Get-TeamViewerVersion.md b/docs/Cmdlets_help/Get-TeamViewerVersion.md similarity index 95% rename from docs/commands/Get-TeamViewerVersion.md rename to docs/Cmdlets_help/Get-TeamViewerVersion.md index 9a8af15..9302e8a 100644 --- a/docs/commands/Get-TeamViewerVersion.md +++ b/docs/Cmdlets_help/Get-TeamViewerVersion.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Get-TeamViewerVersion.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Get-TeamViewerVersion.md schema: 2.0.0 --- diff --git a/docs/commands/Invoke-TeamViewerPackageDownload.md b/docs/Cmdlets_help/Invoke-TeamViewerPackageDownload.md similarity index 93% rename from docs/commands/Invoke-TeamViewerPackageDownload.md rename to docs/Cmdlets_help/Invoke-TeamViewerPackageDownload.md index 6cfff1e..51fa4ea 100644 --- a/docs/commands/Invoke-TeamViewerPackageDownload.md +++ b/docs/Cmdlets_help/Invoke-TeamViewerPackageDownload.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Invoke-TeamViewerPackageDownload.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Invoke-TeamViewerPackageDownload.md schema: 2.0.0 --- @@ -81,7 +81,7 @@ available on Windows platforms. Type: String Parameter Sets: (All) Aliases: -Accepted values: Full, Host, Portable, QuickJoin, QuickSupport, Full64Bit +Accepted values: Full, Host, MSI32, MSI64, Portable, QuickJoin, QuickSupport, Full64Bit Required: False Position: 0 diff --git a/docs/commands/Invoke-TeamViewerPing.md b/docs/Cmdlets_help/Invoke-TeamViewerPing.md similarity index 96% rename from docs/commands/Invoke-TeamViewerPing.md rename to docs/Cmdlets_help/Invoke-TeamViewerPing.md index 864dc38..39f793d 100644 --- a/docs/commands/Invoke-TeamViewerPing.md +++ b/docs/Cmdlets_help/Invoke-TeamViewerPing.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Invoke-TeamViewerPing.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Invoke-TeamViewerPing.md schema: 2.0.0 --- diff --git a/docs/commands/New-TeamViewerContact.md b/docs/Cmdlets_help/New-TeamViewerContact.md similarity index 98% rename from docs/commands/New-TeamViewerContact.md rename to docs/Cmdlets_help/New-TeamViewerContact.md index 63f7bf6..a4a4f97 100644 --- a/docs/commands/New-TeamViewerContact.md +++ b/docs/Cmdlets_help/New-TeamViewerContact.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/New-TeamViewerContact.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/New-TeamViewerContact.md schema: 2.0.0 --- diff --git a/docs/commands/New-TeamViewerDevice.md b/docs/Cmdlets_help/New-TeamViewerDevice.md similarity index 98% rename from docs/commands/New-TeamViewerDevice.md rename to docs/Cmdlets_help/New-TeamViewerDevice.md index 305a606..9527489 100644 --- a/docs/commands/New-TeamViewerDevice.md +++ b/docs/Cmdlets_help/New-TeamViewerDevice.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/New-TeamViewerDevice.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/New-TeamViewerDevice.md schema: 2.0.0 --- diff --git a/docs/commands/New-TeamViewerGroup.md b/docs/Cmdlets_help/New-TeamViewerGroup.md similarity index 98% rename from docs/commands/New-TeamViewerGroup.md rename to docs/Cmdlets_help/New-TeamViewerGroup.md index 9a62a70..f58eccd 100644 --- a/docs/commands/New-TeamViewerGroup.md +++ b/docs/Cmdlets_help/New-TeamViewerGroup.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/New-TeamViewerGroup.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/New-TeamViewerGroup.md schema: 2.0.0 --- diff --git a/docs/commands/New-TeamViewerManagedGroup.md b/docs/Cmdlets_help/New-TeamViewerManagedGroup.md similarity index 97% rename from docs/commands/New-TeamViewerManagedGroup.md rename to docs/Cmdlets_help/New-TeamViewerManagedGroup.md index 8c9cf2a..ad96a8f 100644 --- a/docs/commands/New-TeamViewerManagedGroup.md +++ b/docs/Cmdlets_help/New-TeamViewerManagedGroup.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/New-TeamViewerManagedGroup.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/New-TeamViewerManagedGroup.md schema: 2.0.0 --- diff --git a/docs/commands/New-TeamViewerPolicy.md b/docs/Cmdlets_help/New-TeamViewerPolicy.md similarity index 98% rename from docs/commands/New-TeamViewerPolicy.md rename to docs/Cmdlets_help/New-TeamViewerPolicy.md index 5802180..36c2e21 100644 --- a/docs/commands/New-TeamViewerPolicy.md +++ b/docs/Cmdlets_help/New-TeamViewerPolicy.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/New-TeamViewerPolicy.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/New-TeamViewerPolicy.md schema: 2.0.0 --- diff --git a/docs/commands/New-TeamViewerUser.md b/docs/Cmdlets_help/New-TeamViewerUser.md similarity index 99% rename from docs/commands/New-TeamViewerUser.md rename to docs/Cmdlets_help/New-TeamViewerUser.md index 2c1b0f0..59193f1 100644 --- a/docs/commands/New-TeamViewerUser.md +++ b/docs/Cmdlets_help/New-TeamViewerUser.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/New-TeamViewerUser.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/New-TeamViewerUser.md schema: 2.0.0 --- diff --git a/docs/commands/New-TeamViewerUserGroup.md b/docs/Cmdlets_help/New-TeamViewerUserGroup.md similarity index 93% rename from docs/commands/New-TeamViewerUserGroup.md rename to docs/Cmdlets_help/New-TeamViewerUserGroup.md index 77c3946..a316b33 100644 --- a/docs/commands/New-TeamViewerUserGroup.md +++ b/docs/Cmdlets_help/New-TeamViewerUserGroup.md @@ -1,119 +1,119 @@ ---- -external help file: TeamViewerPS-help.xml -Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/New-TeamViewerUserGroup.md -schema: 2.0.0 ---- - -# New-TeamViewerUserGroup - -## SYNOPSIS - -Create a new user group. - -## SYNTAX - -``` powershell -New-TeamViewerUserGroup [-ApiToken] [-Name] [-WhatIf] [-Confirm] [] -``` - -## DESCRIPTION - -Create a new user group that belongs to the TeamViewer company associated with the API access token. -The name of the new user group should be unique among the groups of the TeamViewer Company. - -## EXAMPLES - -### Example 1 - -```powershell -PS /> New-TeamViewerUserGroup -Name 'New user group' -``` - -Creates a new user groups with name `New user group`. -The name should be unique among the groups of the TeamViewer Company. - -## PARAMETERS - -### -ApiToken - -The TeamViewer API access token. - -```yaml -Type: SecureString -Parameter Sets: (All) -Aliases: - -Required: True -Position: 0 -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -Confirm - -Prompts you for confirmation before running the cmdlet. - -```yaml -Type: SwitchParameter -Parameter Sets: (All) -Aliases: cf - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -Name - -The name of the new user group. - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: True -Position: 1 -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -WhatIf - -Shows what would happen if the cmdlet runs. -The cmdlet is not run. - -```yaml -Type: SwitchParameter -Parameter Sets: (All) -Aliases: wi - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### CommonParameters - -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### None - -## OUTPUTS - -### System.Object - -A `TeamViewerPS.UserGroup` object. - -## NOTES - -## RELATED LINKS +--- +external help file: TeamViewerPS-help.xml +Module Name: TeamViewerPS +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/New-TeamViewerUserGroup.md +schema: 2.0.0 +--- + +# New-TeamViewerUserGroup + +## SYNOPSIS + +Create a new user group. + +## SYNTAX + +``` powershell +New-TeamViewerUserGroup [-ApiToken] [-Name] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION + +Create a new user group that belongs to the TeamViewer company associated with the API access token. +The name of the new user group should be unique among the groups of the TeamViewer Company. + +## EXAMPLES + +### Example 1 + +```powershell +PS /> New-TeamViewerUserGroup -Name 'New user group' +``` + +Creates a new user groups with name `New user group`. +The name should be unique among the groups of the TeamViewer Company. + +## PARAMETERS + +### -ApiToken + +The TeamViewer API access token. + +```yaml +Type: SecureString +Parameter Sets: (All) +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm + +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name + +The name of the new user group. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf + +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters + +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### None + +## OUTPUTS + +### System.Object + +A `TeamViewerPS.UserGroup` object. + +## NOTES + +## RELATED LINKS diff --git a/docs/Cmdlets_help/New-TeamViewerUserRole.md b/docs/Cmdlets_help/New-TeamViewerUserRole.md new file mode 100644 index 0000000..f6deb32 --- /dev/null +++ b/docs/Cmdlets_help/New-TeamViewerUserRole.md @@ -0,0 +1,144 @@ +--- +external help file: TeamViewerPS-help.xml +Module Name: TeamViewerPS +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/New-TeamViewerUserRole.md +schema: 2.0.0 +--- + +# New-TeamViewerUserRole + +## SYNOPSIS + +Create a new user role. + +## SYNTAX + +``` powershell +New-TeamViewerUserRole [-ApiToken] [-Name] [-Permissions] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION + +Create a new user role that belongs to the TeamViewer company associated with the API access token. +The name of the new user role should be unique among the roles of the TeamViewer Company. + +## EXAMPLES + +### Example 1 + +```powershell +PS /> New-TeamViewerUserRole -Name 'New user role' -Permissions 'AllowGroupharing','ManageConnections' +``` + +Creates a new user role with name `New user role` with permissions `AllowGroupSharing` and `ManageConnections` enabled. +Please see the TeamViewer API documentation for a list of valid values. + +### Example 2 + +```powershell +PS /> New-TeamViewerUserRole -Name 'New user role' +``` + +Creates a new user role with name `New user role` without any permissions. +The name should be unique among the roles of the TeamViewer Company. + +## PARAMETERS + +### -ApiToken + +The TeamViewer API access token. + +```yaml +Type: SecureString +Parameter Sets: (All) +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm + +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name + +The name of the new user role. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Permissions + +The permissions for the user role. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf + +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters + +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### None + +## OUTPUTS + +### System.Object + +A `TeamViewerPS.UserRole` object. + +## NOTES + +## RELATED LINKS diff --git a/docs/commands/Publish-TeamViewerGroup.md b/docs/Cmdlets_help/Publish-TeamViewerGroup.md similarity index 98% rename from docs/commands/Publish-TeamViewerGroup.md rename to docs/Cmdlets_help/Publish-TeamViewerGroup.md index df4c156..db62dec 100644 --- a/docs/commands/Publish-TeamViewerGroup.md +++ b/docs/Cmdlets_help/Publish-TeamViewerGroup.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Publish-TeamViewerGroup.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Publish-TeamViewerGroup.md schema: 2.0.0 --- diff --git a/docs/Cmdlets_help/Remove-TeamViewerAssignment.md b/docs/Cmdlets_help/Remove-TeamViewerAssignment.md new file mode 100644 index 0000000..5635c9a --- /dev/null +++ b/docs/Cmdlets_help/Remove-TeamViewerAssignment.md @@ -0,0 +1,48 @@ +--- +external help file: TeamViewerPS-help.xml +Module Name: TeamViewerPS +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Remove-TeamViewerAssignment.md +schema: 2.0.0 +--- + +# Remove-TeamViewerAssignment + +## SYNOPSIS + +Unassigns the device from its current company. + +## SYNTAX + +```powershell +Remove-TeamViewerAssignment +``` + +## DESCRIPTION + +Unassigns the calling device from its company. + +## EXAMPLES + +### Example 1 + +```powershell +PS /> Remove-TeamViewerAssignment +``` + +Unassigns the device from its company. + +## PARAMETERS + +### CommonParameters + +### None + +## INPUTS + +### None + +## OUTPUTS + +## NOTES + +## RELATED LINKS diff --git a/docs/commands/Remove-TeamViewerContact.md b/docs/Cmdlets_help/Remove-TeamViewerContact.md similarity index 97% rename from docs/commands/Remove-TeamViewerContact.md rename to docs/Cmdlets_help/Remove-TeamViewerContact.md index 1b02f08..f9a6981 100644 --- a/docs/commands/Remove-TeamViewerContact.md +++ b/docs/Cmdlets_help/Remove-TeamViewerContact.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Remove-TeamViewerContact.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Remove-TeamViewerContact.md schema: 2.0.0 --- diff --git a/docs/Cmdlets_help/Remove-TeamViewerCustomization.md b/docs/Cmdlets_help/Remove-TeamViewerCustomization.md new file mode 100644 index 0000000..d42f16c --- /dev/null +++ b/docs/Cmdlets_help/Remove-TeamViewerCustomization.md @@ -0,0 +1,47 @@ +--- +external help file: TeamViewerPS-help.xml +Module Name: TeamViewerPS +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Remove-TeamViewerCustomization.md +schema: 2.0.0 +--- + +# Remove-TeamViewerCustomization + +## SYNOPSIS + +Removes the customization from the TeamViewer Installation. + +## SYNTAX + +```powershell +Remove-TeamViewerCustomization +``` + +## DESCRIPTION + +Removes the existing customization from the TeamViewer Installation. +Existing customization should be removed before applying new customization. + +## EXAMPLES + +### Example 1 + +```powershell +PS /> Remove-TeamViewerAssignment +``` + +Removes the customization. + +## PARAMETERS + +### CommonParameters + +### None + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS diff --git a/docs/commands/Remove-TeamViewerDevice.md b/docs/Cmdlets_help/Remove-TeamViewerDevice.md similarity index 97% rename from docs/commands/Remove-TeamViewerDevice.md rename to docs/Cmdlets_help/Remove-TeamViewerDevice.md index 64182be..5cb101e 100644 --- a/docs/commands/Remove-TeamViewerDevice.md +++ b/docs/Cmdlets_help/Remove-TeamViewerDevice.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Remove-TeamViewerDevice.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Remove-TeamViewerDevice.md schema: 2.0.0 --- diff --git a/docs/commands/Remove-TeamViewerGroup.md b/docs/Cmdlets_help/Remove-TeamViewerGroup.md similarity index 97% rename from docs/commands/Remove-TeamViewerGroup.md rename to docs/Cmdlets_help/Remove-TeamViewerGroup.md index 9d9f313..c1aa0b2 100644 --- a/docs/commands/Remove-TeamViewerGroup.md +++ b/docs/Cmdlets_help/Remove-TeamViewerGroup.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Remove-TeamViewerGroup.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Remove-TeamViewerGroup.md schema: 2.0.0 --- diff --git a/docs/commands/Remove-TeamViewerManagedDevice.md b/docs/Cmdlets_help/Remove-TeamViewerManagedDevice.md similarity index 98% rename from docs/commands/Remove-TeamViewerManagedDevice.md rename to docs/Cmdlets_help/Remove-TeamViewerManagedDevice.md index 33ec45c..d205174 100644 --- a/docs/commands/Remove-TeamViewerManagedDevice.md +++ b/docs/Cmdlets_help/Remove-TeamViewerManagedDevice.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Remove-TeamViewerManagedDevice.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Remove-TeamViewerManagedDevice.md schema: 2.0.0 --- diff --git a/docs/commands/Remove-TeamViewerManagedDeviceManagement.md b/docs/Cmdlets_help/Remove-TeamViewerManagedDeviceManagement.md similarity index 97% rename from docs/commands/Remove-TeamViewerManagedDeviceManagement.md rename to docs/Cmdlets_help/Remove-TeamViewerManagedDeviceManagement.md index 6c2197e..ebfdf98 100644 --- a/docs/commands/Remove-TeamViewerManagedDeviceManagement.md +++ b/docs/Cmdlets_help/Remove-TeamViewerManagedDeviceManagement.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Remove-TeamViewerManagedDeviceManagement.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Remove-TeamViewerManagedDeviceManagement.md schema: 2.0.0 --- diff --git a/docs/commands/Remove-TeamViewerManagedGroup.md b/docs/Cmdlets_help/Remove-TeamViewerManagedGroup.md similarity index 97% rename from docs/commands/Remove-TeamViewerManagedGroup.md rename to docs/Cmdlets_help/Remove-TeamViewerManagedGroup.md index 21949b3..75be21e 100644 --- a/docs/commands/Remove-TeamViewerManagedGroup.md +++ b/docs/Cmdlets_help/Remove-TeamViewerManagedGroup.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Remove-TeamViewerManagedGroup.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Remove-TeamViewerManagedGroup.md schema: 2.0.0 --- diff --git a/docs/commands/Remove-TeamViewerManager.md b/docs/Cmdlets_help/Remove-TeamViewerManager.md similarity index 98% rename from docs/commands/Remove-TeamViewerManager.md rename to docs/Cmdlets_help/Remove-TeamViewerManager.md index ebcc52c..996e3b5 100644 --- a/docs/commands/Remove-TeamViewerManager.md +++ b/docs/Cmdlets_help/Remove-TeamViewerManager.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Remove-TeamViewerManager.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Remove-TeamViewerManager.md schema: 2.0.0 --- diff --git a/docs/Cmdlets_help/Remove-TeamViewerPSProxy.md b/docs/Cmdlets_help/Remove-TeamViewerPSProxy.md new file mode 100644 index 0000000..c4c3200 --- /dev/null +++ b/docs/Cmdlets_help/Remove-TeamViewerPSProxy.md @@ -0,0 +1,46 @@ +--- +external help file: TeamViewerPS-help.xml +Module Name: TeamViewerPS +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Remove-TeamViewerPSProxy +schema: 2.0.0 +--- + +# Remove-TeamViewerPSProxy + +## SYNOPSIS + +Remove TeamViewerPS proxy. + +## SYNTAX + +```powershell +Remove-TeamViewerPSProxy +``` + +## DESCRIPTION + +Removes the proxy and sets it to default for TeamViewerPS module functions. + +## EXAMPLES + +### Example 1 + +```powershell +PS /> Remove-TeamViewerPSProxy +``` + +Removes the existing proxy server used and sets it to default. + +## PARAMETERS + +### CommonParameters + +## INPUTS + +### None + +## OUTPUTS + +## NOTES + +## RELATED LINKS diff --git a/docs/commands/Remove-TeamViewerPolicy.md b/docs/Cmdlets_help/Remove-TeamViewerPolicy.md similarity index 97% rename from docs/commands/Remove-TeamViewerPolicy.md rename to docs/Cmdlets_help/Remove-TeamViewerPolicy.md index 8897dd4..26ed60f 100644 --- a/docs/commands/Remove-TeamViewerPolicy.md +++ b/docs/Cmdlets_help/Remove-TeamViewerPolicy.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Remove-TeamViewerPolicy.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Remove-TeamViewerPolicy.md schema: 2.0.0 --- diff --git a/docs/Cmdlets_help/Remove-TeamViewerPolicyFromManagedDevice.md b/docs/Cmdlets_help/Remove-TeamViewerPolicyFromManagedDevice.md new file mode 100644 index 0000000..ecafb2f --- /dev/null +++ b/docs/Cmdlets_help/Remove-TeamViewerPolicyFromManagedDevice.md @@ -0,0 +1,157 @@ +--- +external help file: TeamViewerPS-help.xml +Module Name: TeamViewerPS +online version: [Link to Online Documentation] +schema: 2.0.0 +--- + +# Remove-TeamViewerPolicyFromManagedDevice + +## SYNOPSIS + +Remove a policy from a managed device based on type. + +Valid Types are: + +- TeamViewer +- Monitoring +- PatchManagement + +## SYNTAX + +```powershell +Remove-TeamViewerPolicyFromManagedDevice -ApiToken -Device -PolicyType [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION + +Remove a specified policy from a managed device. + +## EXAMPLES + +### Example 1 + +Remove TeamViewer policy from device + +```powershell +PS /> Remove-TeamViewerPolicyFromManagedDevice -Device 'd8773208-a685-4323-9de5-7f86951f8c30' -PolicyType 1 +``` + +```powershell +PS /> Remove-TeamViewerPolicyFromManagedDevice -Device 'd8773208-a685-4323-9de5-7f86951f8c30' -PolicyType TeamViewer +``` + +### Example 2 + +Remove Monitoring policy from device + +```powershell +PS /> Remove-TeamViewerPolicyFromManagedDevice -Device '730ee15a-1ea4-4d80-9cfe-5a01709d0a2f' -PolicyType 4 +``` + +```powershell +PS /> Remove-TeamViewerPolicyFromManagedDevice -Device '730ee15a-1ea4-4d80-9cfe-5a01709d0a2f' -PolicyType Monitoring +``` + +### Example 3 + +Remove PatchManagement policy from device + +```powershell +PS /> Remove-TeamViewerPolicyFromManagedDevice -Device '730ee15a-1ea4-4d80-9cfe-5a01709d0a2f' -PolicyType 5 +``` + +```powershell +PS /> Remove-TeamViewerPolicyFromManagedDevice -Device '730ee15a-1ea4-4d80-9cfe-5a01709d0a2f' -PolicyType PatchManagement +``` + +## PARAMETERS + +### -ApiToken + +The TeamViewer API access token. + +```yaml +Type: SecureString +Parameter Sets: (All) +Aliases: +Required: True +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Device + +The managed device from which you want to remove the policy. + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: DeviceId +Required: True +Position: 1 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -PolicyType + +The type of policy to remove from the managed device. + +```yaml +Type: PolicyType (Enum) +Parameter Sets: (All) +Aliases: +Required: True +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm + +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf + +Shows what would happen if the cmdlet runs. The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters + +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### System.Object + +## OUTPUTS + +## NOTES + +## RELATED LINKS diff --git a/docs/Cmdlets_help/Remove-TeamViewerRoleFromAccount.md b/docs/Cmdlets_help/Remove-TeamViewerRoleFromAccount.md new file mode 100644 index 0000000..cc8dc6b --- /dev/null +++ b/docs/Cmdlets_help/Remove-TeamViewerRoleFromAccount.md @@ -0,0 +1,152 @@ +--- +external help file: TeamViewerPS-help.xml +Module Name: TeamViewerPS +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Remove-TeamViewerRoleFromAccount.md +schema: 2.0.0 +--- + +# Remove-TeamViewerRoleFromAccount + +## SYNOPSIS + +Unassign role from a given list of accounts. + +## SYNTAX + +### ByUserRoleIdMemberId (All) + +```powershell +Remove-TeamViewerRoleFromAccount [-ApiToken] [-UserRoleId] [-Account] + [-WhatIf] [-Confirm] [] +``` + +### ByUserId + +```powershell +Remove-TeamViewerRoleFromAccount [-ApiToken] [-UserRoleId] [-Account] + [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION + +Unassigns user role from one or many users. User role should belong to the TeamViewer company associated with the API access token. + +## EXAMPLES + +### Example 1 + +```powershell +PS /> Remove-TeamViewerRoleFromAccount -UserRoleId '9b465ea2-2f75-4101-a057-58a81ed0e57b' -Account @('123', '456', '789') +``` + +Unassigns role with id `9b465ea2-2f75-4101-a057-58a81ed0e57b` from users with id `123`, `456`, `789`. + +### Example 2 + +```powershell +PS /> @('123', '456', '789') | Remove-TeamViewerRoleFromAccount -UserRoleId '9b465ea2-2f75-4101-a057-58a81ed0e57b' +``` + +Unassigns role with id `9b465ea2-2f75-4101-a057-58a81ed0e57b` from users with id `123`, `456`, `789`. +Ids are passed as pipeline input. + +## PARAMETERS + +### -ApiToken + +The TeamViewer API access token. + +```yaml +Type: SecureString +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm + +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UserRoleId + +The role from where users will be unassigned from. + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: UserRole + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Account + +Users to be unassigned from a user role. + +```yaml +Type: Object[] +Parameter Sets: (All) +Aliases: Id, UserId + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -WhatIf + +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters + +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### System.Object + +### System.string[] + +An array of account Ids. + +## OUTPUTS + +## NOTES + +## RELATED LINKS diff --git a/docs/Cmdlets_help/Remove-TeamViewerRoleFromUserGroup.md b/docs/Cmdlets_help/Remove-TeamViewerRoleFromUserGroup.md new file mode 100644 index 0000000..e88378b --- /dev/null +++ b/docs/Cmdlets_help/Remove-TeamViewerRoleFromUserGroup.md @@ -0,0 +1,112 @@ +--- +external help file: TeamViewerPS-help.xml +Module Name: TeamViewerPS +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Remove-TeamViewerRoleFromUserGroup.md +schema: 2.0.0 +--- + +# Remove-TeamViewerRoleFromAccount + +## SYNOPSIS + +Unassign user role from a user group. + +## SYNTAX + +```powershell +Remove-TeamViewerRoleFromAccount [-ApiToken] [-UserGroup] [-WhatIf] + [-Confirm] [] +``` + +## DESCRIPTION + +Unassigns user role from a user group of the TeamViewer company associated with the API access token. + +## EXAMPLES + +### Example 1 + +```powershell +PS /> Remove-TeamViewerRoleFromAccount -UserGroup 1001 +``` + +The given user group `1001` gets unassigned from its user role. + +## PARAMETERS + +### -ApiToken + +The TeamViewer API access token. + +```yaml +Type: SecureString +Parameter Sets: (All) +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm + +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UserGroup + +The user group from which user role should be unassigned. + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: Id, UserGroupId + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf + +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters + +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS diff --git a/docs/commands/Remove-TeamViewerSsoExclusion.md b/docs/Cmdlets_help/Remove-TeamViewerSsoExclusion.md similarity index 95% rename from docs/commands/Remove-TeamViewerSsoExclusion.md rename to docs/Cmdlets_help/Remove-TeamViewerSsoExclusion.md index a0ee123..63cc616 100644 --- a/docs/commands/Remove-TeamViewerSsoExclusion.md +++ b/docs/Cmdlets_help/Remove-TeamViewerSsoExclusion.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Remove-TeamViewerSsoExclusion.md schema: 2.0.0 --- diff --git a/docs/commands/Remove-TeamViewerUser.md b/docs/Cmdlets_help/Remove-TeamViewerUser.md similarity index 95% rename from docs/commands/Remove-TeamViewerUser.md rename to docs/Cmdlets_help/Remove-TeamViewerUser.md index e37553e..3fc0094 100644 --- a/docs/commands/Remove-TeamViewerUser.md +++ b/docs/Cmdlets_help/Remove-TeamViewerUser.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Remove-TeamViewerUser.md schema: 2.0.0 --- diff --git a/docs/commands/Remove-TeamViewerUserGroup.md b/docs/Cmdlets_help/Remove-TeamViewerUserGroup.md similarity index 93% rename from docs/commands/Remove-TeamViewerUserGroup.md rename to docs/Cmdlets_help/Remove-TeamViewerUserGroup.md index 3df26a6..a78d4fd 100644 --- a/docs/commands/Remove-TeamViewerUserGroup.md +++ b/docs/Cmdlets_help/Remove-TeamViewerUserGroup.md @@ -1,124 +1,124 @@ ---- -external help file: TeamViewerPS-help.xml -Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Remove-TeamViewerUserGroup.md -schema: 2.0.0 ---- - -# Remove-TeamViewerUserGroup - -## SYNOPSIS - -Delete a user group from the TeamViewer company. - -## SYNTAX - -```powershell -Remove-TeamViewerUserGroup [-ApiToken] [-UserGroup] [-WhatIf] [-Confirm] - [] -``` - -## DESCRIPTION - -Deletes a use groups from the TeamViewer company. -All information regarding the user group will be deleted too. - -## EXAMPLES - -### Example 1 - -```powershell -PS /> Remove-TeamViewerUserGroup -Id 1001 -``` - -Deletes the user group with Id `1001`. - -### Example 2 - -```powershell -PS /> Remove-TeamViewerUserGroup -UserGroup (Get-TeamViewerUserGroup | Where-Object { $_.Name -eq "Test Group" }) -``` - -Remove a user group object retrieved using `Get-TeamViewerUserGroup` as input. -In this example, the user group with the name `Test Group`. - -## PARAMETERS - -### -ApiToken - -The TeamViewer API access token. - -```yaml -Type: SecureString -Parameter Sets: (All) -Aliases: - -Required: True -Position: 0 -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -Confirm - -Prompts you for confirmation before running the cmdlet. - -```yaml -Type: SwitchParameter -Parameter Sets: (All) -Aliases: cf - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -UserGroup - -The user groups to be deleted. - -```yaml -Type: Object -Parameter Sets: (All) -Aliases: Id, UserGroupId - -Required: True -Position: 1 -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -WhatIf - -Shows what would happen if the cmdlet runs. -The cmdlet is not run. - -```yaml -Type: SwitchParameter -Parameter Sets: (All) -Aliases: wi - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### CommonParameters - -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### None - -## OUTPUTS - -## NOTES - -## RELATED LINKS +--- +external help file: TeamViewerPS-help.xml +Module Name: TeamViewerPS +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Remove-TeamViewerUserGroup.md +schema: 2.0.0 +--- + +# Remove-TeamViewerUserGroup + +## SYNOPSIS + +Delete a user group from the TeamViewer company. + +## SYNTAX + +```powershell +Remove-TeamViewerUserGroup [-ApiToken] [-UserGroup] [-WhatIf] [-Confirm] + [] +``` + +## DESCRIPTION + +Deletes a use groups from the TeamViewer company. +All information regarding the user group will be deleted too. + +## EXAMPLES + +### Example 1 + +```powershell +PS /> Remove-TeamViewerUserGroup -Id 1001 +``` + +Deletes the user group with Id `1001`. + +### Example 2 + +```powershell +PS /> Remove-TeamViewerUserGroup -UserGroup (Get-TeamViewerUserGroup | Where-Object { $_.Name -eq "Test Group" }) +``` + +Remove a user group object retrieved using `Get-TeamViewerUserGroup` as input. +In this example, the user group with the name `Test Group`. + +## PARAMETERS + +### -ApiToken + +The TeamViewer API access token. + +```yaml +Type: SecureString +Parameter Sets: (All) +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm + +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UserGroup + +The user groups to be deleted. + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: Id, UserGroupId + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf + +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters + +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### None + +## OUTPUTS + +## NOTES + +## RELATED LINKS diff --git a/docs/commands/Remove-TeamViewerUserGroupMember.md b/docs/Cmdlets_help/Remove-TeamViewerUserGroupMember.md similarity index 93% rename from docs/commands/Remove-TeamViewerUserGroupMember.md rename to docs/Cmdlets_help/Remove-TeamViewerUserGroupMember.md index 6c9162d..281e950 100644 --- a/docs/commands/Remove-TeamViewerUserGroupMember.md +++ b/docs/Cmdlets_help/Remove-TeamViewerUserGroupMember.md @@ -1,185 +1,185 @@ ---- -external help file: TeamViewerPS-help.xml -Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Remove-TeamViewerUserGroupMember.md -schema: 2.0.0 ---- - -# Remove-TeamViewerUserGroupMember - -## SYNOPSIS - -Deletes members from a given user group. - -## SYNTAX - -### ByUserGroupMemberId (All) - -```powershell -Remove-TeamViewerUserGroupMember [-ApiToken] [-UserGroup] [-UserGroupMember] - [-WhatIf] [-Confirm] [] -``` - -### ByUserId - -```powershell -Remove-TeamViewerUserGroupMember [-ApiToken] [-UserGroup] [-User] - [-WhatIf] [-Confirm] [] -``` - -## DESCRIPTION - -Deletes one or many members from a user group. User group should belong to the TeamViewer company associated with the API access token. - -## EXAMPLES - -### Example 1 - -```powershell -PS /> Remove-TeamViewerUserGroupMember -UserGroup 1001 -UserGroupMember @(123, 456, 789) -``` - -Removes the accounts `123`, `456`, `789` from the group with id `1001`. - -### Example 2 - -```powershell -PS /> @(123, 456, 789) | Remove-TeamViewerUserGroupMember -UserGroup 1001 -``` - -Removes the accounts `123`, `456`, `789` from the group with id `1001`. -Ids are passed as pipeline input. - -### Example 3 - -```powershell -PS /> Remove-TeamViewerUserGroupMember -UserGroup 1001 -User @('u123', 'u456', 'u789') -``` - -Removes the users `u123`, `u456`, `u789` from the group with id `1001`. - -### Example 4 - -```powershell -PS /> Get-TeamViewerUserGroupMember -UserGroup 1001 | Remove-TeamViewerUserGroupMember -UserGroup 1001 -``` - -Removes all the users from the group with id `1001`. -Ids are passed as pipeline input. - -## PARAMETERS - -### -ApiToken - -The TeamViewer API access token. - -```yaml -Type: SecureString -Parameter Sets: (All) -Aliases: - -Required: True -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -Confirm - -Prompts you for confirmation before running the cmdlet. - -```yaml -Type: SwitchParameter -Parameter Sets: (All) -Aliases: cf - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -User - -Users to be removed from a user group. - -```yaml -Type: Object[] -Parameter Sets: ByUserId -Aliases: UserId - -Required: True -Position: Named -Default value: None -Accept pipeline input: True (ByValue) -Accept wildcard characters: False -``` - -### -UserGroup - -The group where members will be removed from. - -```yaml -Type: Object -Parameter Sets: (All) -Aliases: Id, UserGroupId - -Required: True -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -UserGroupMember - -User group members to be removed from a user group. - -```yaml -Type: Object[] -Parameter Sets: (ByUserGroupMemberId) -Aliases: MemberId, UserGroupMemberId - -Required: True -Position: Named -Default value: None -Accept pipeline input: True (ByValue) -Accept wildcard characters: False -``` - -### -WhatIf - -Shows what would happen if the cmdlet runs. -The cmdlet is not run. - -```yaml -Type: SwitchParameter -Parameter Sets: (All) -Aliases: wi - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### CommonParameters - -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### System.Object - -### System.Int32[] - -An array of account Ids. - -## OUTPUTS - -## NOTES - -## RELATED LINKS +--- +external help file: TeamViewerPS-help.xml +Module Name: TeamViewerPS +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Remove-TeamViewerUserGroupMember.md +schema: 2.0.0 +--- + +# Remove-TeamViewerUserGroupMember + +## SYNOPSIS + +Deletes members from a given user group. + +## SYNTAX + +### ByUserGroupMemberId (All) + +```powershell +Remove-TeamViewerUserGroupMember [-ApiToken] [-UserGroup] [-UserGroupMember] + [-WhatIf] [-Confirm] [] +``` + +### ByUserId + +```powershell +Remove-TeamViewerUserGroupMember [-ApiToken] [-UserGroup] [-User] + [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION + +Deletes one or many members from a user group. User group should belong to the TeamViewer company associated with the API access token. + +## EXAMPLES + +### Example 1 + +```powershell +PS /> Remove-TeamViewerUserGroupMember -UserGroup 1001 -UserGroupMember @(123, 456, 789) +``` + +Removes the accounts `123`, `456`, `789` from the group with id `1001`. + +### Example 2 + +```powershell +PS /> @(123, 456, 789) | Remove-TeamViewerUserGroupMember -UserGroup 1001 +``` + +Removes the accounts `123`, `456`, `789` from the group with id `1001`. +Ids are passed as pipeline input. + +### Example 3 + +```powershell +PS /> Remove-TeamViewerUserGroupMember -UserGroup 1001 -User @('u123', 'u456', 'u789') +``` + +Removes the users `u123`, `u456`, `u789` from the group with id `1001`. + +### Example 4 + +```powershell +PS /> Get-TeamViewerUserGroupMember -UserGroup 1001 | Remove-TeamViewerUserGroupMember -UserGroup 1001 +``` + +Removes all the users from the group with id `1001`. +Ids are passed as pipeline input. + +## PARAMETERS + +### -ApiToken + +The TeamViewer API access token. + +```yaml +Type: SecureString +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm + +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -User + +Users to be removed from a user group. + +```yaml +Type: Object[] +Parameter Sets: ByUserId +Aliases: UserId + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -UserGroup + +The group where members will be removed from. + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: Id, UserGroupId + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UserGroupMember + +User group members to be removed from a user group. + +```yaml +Type: Object[] +Parameter Sets: (ByUserGroupMemberId) +Aliases: MemberId, UserGroupMemberId + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -WhatIf + +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters + +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### System.Object + +### System.Int32[] + +An array of account Ids. + +## OUTPUTS + +## NOTES + +## RELATED LINKS diff --git a/docs/Cmdlets_help/Remove-TeamViewerUserRole.md b/docs/Cmdlets_help/Remove-TeamViewerUserRole.md new file mode 100644 index 0000000..e2b0c13 --- /dev/null +++ b/docs/Cmdlets_help/Remove-TeamViewerUserRole.md @@ -0,0 +1,124 @@ +--- +external help file: TeamViewerPS-help.xml +Module Name: TeamViewerPS +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Remove-TeamViewerUserRole.md +schema: 2.0.0 +--- + +# Remove-TeamViewerUserRole + +## SYNOPSIS + +Delete a user role from the TeamViewer company. + +## SYNTAX + +```powershell +Remove-TeamViewerUserRole [-ApiToken] [-UserRoleId] [-WhatIf] [-Confirm] + [] +``` + +## DESCRIPTION + +Deletes a user role from the TeamViewer company. +All permissions and assignments of the user role will be deleted too. + +## EXAMPLES + +### Example 1 + +```powershell +PS /> Remove-TeamViewerUserRole -UserRoleId '9b465ea2-2f75-4101-a057-58a81ed0e57b' +``` + +Deletes the user role with Id `9b465ea2-2f75-4101-a057-58a81ed0e57b`. + +### Example 2 + +```powershell +PS /> Remove-TeamViewerUserRole -UserRoleId (Get-TeamViewerUserRole | Where-Object { ($_.RoleName -eq 'Test Role') } ).RoleID +``` + +Removes a user role with RoleId retrieved using `Get-TeamViewerUserRole` as input. +In this example, the user role with the name `Test Role`. + +## PARAMETERS + +### -ApiToken + +The TeamViewer API access token. + +```yaml +Type: SecureString +Parameter Sets: (All) +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm + +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UserRoleId + +The user role to be deleted. + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: Id, UserRole + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf + +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters + +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### None + +## OUTPUTS + +## NOTES + +## RELATED LINKS diff --git a/docs/commands/Restart-TeamViewerService.md b/docs/Cmdlets_help/Restart-TeamViewerService.md similarity index 96% rename from docs/commands/Restart-TeamViewerService.md rename to docs/Cmdlets_help/Restart-TeamViewerService.md index 2687fbf..f354e28 100644 --- a/docs/commands/Restart-TeamViewerService.md +++ b/docs/Cmdlets_help/Restart-TeamViewerService.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Restart-TeamViewerService.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Restart-TeamViewerService.md schema: 2.0.0 --- diff --git a/docs/commands/Set-TeamViewerAccount.md b/docs/Cmdlets_help/Set-TeamViewerAccount.md similarity index 98% rename from docs/commands/Set-TeamViewerAccount.md rename to docs/Cmdlets_help/Set-TeamViewerAccount.md index 2158f76..aefa72a 100644 --- a/docs/commands/Set-TeamViewerAccount.md +++ b/docs/Cmdlets_help/Set-TeamViewerAccount.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Set-TeamViewerAccount.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Set-TeamViewerAccount.md schema: 2.0.0 --- diff --git a/docs/commands/Set-TeamViewerDevice.md b/docs/Cmdlets_help/Set-TeamViewerDevice.md similarity index 99% rename from docs/commands/Set-TeamViewerDevice.md rename to docs/Cmdlets_help/Set-TeamViewerDevice.md index d2f1a32..d6e77ca 100644 --- a/docs/commands/Set-TeamViewerDevice.md +++ b/docs/Cmdlets_help/Set-TeamViewerDevice.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Set-TeamViewerDevice.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Set-TeamViewerDevice.md schema: 2.0.0 --- diff --git a/docs/commands/Set-TeamViewerGroup.md b/docs/Cmdlets_help/Set-TeamViewerGroup.md similarity index 98% rename from docs/commands/Set-TeamViewerGroup.md rename to docs/Cmdlets_help/Set-TeamViewerGroup.md index cc729d6..c9c8e45 100644 --- a/docs/commands/Set-TeamViewerGroup.md +++ b/docs/Cmdlets_help/Set-TeamViewerGroup.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Set-TeamViewerGroup.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Set-TeamViewerGroup.md schema: 2.0.0 --- diff --git a/docs/commands/Set-TeamViewerManagedDevice.md b/docs/Cmdlets_help/Set-TeamViewerManagedDevice.md similarity index 85% rename from docs/commands/Set-TeamViewerManagedDevice.md rename to docs/Cmdlets_help/Set-TeamViewerManagedDevice.md index 4599997..3ee7414 100644 --- a/docs/commands/Set-TeamViewerManagedDevice.md +++ b/docs/Cmdlets_help/Set-TeamViewerManagedDevice.md @@ -15,7 +15,7 @@ Change properties of a TeamViewer managed device. ```powershell Set-TeamViewerManagedDevice [-ApiToken] [-Device] [[-Name] ] - [[-Policy] ] [-RemovePolicy] [-WhatIf] [-Confirm] [] + [[-Policy] ] [[-ManagedGroup] ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -50,10 +50,10 @@ Sets the policy of the device. ### Example 3 ```powershell -PS /> Set-TeamViewerManagedDevice -Device '33a2e2e1-27ef-43e2-a175-f97ee0344033' -RemovePolicy +PS /> Set-TeamViewerManagedDevice -Device '33a2e2e1-27ef-43e2-a175-f97ee0344033' -ManagedGroup '730ee15a-1ea4-4d80-9cfe-5a01709d0a2f' ``` -Removes the policy from the managed device. +Inherit the TeamViewer policy from a managed group to the device (the device has to be part of the managed group specified). ## PARAMETERS @@ -129,8 +129,6 @@ Object that can be used to identify the policy. This can either be the policy ID (as string or GUID) or a policy object that has been received using other module functions. -Cannot be used in conjunction with the `-RemovePolicy` parameter. - ```yaml Type: Object Parameter Sets: (All) @@ -143,21 +141,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -RemovePolicy - -Removes the policy from the managed device. +### -ManagedGroup -Cannot be used in conjunction with the `-Policy` parameter. +Object that can be used to identify the managed group. +This can either be the managed group ID (as string or GUID) or a managed group +object that has been received using other module functions. ```yaml -Type: SwitchParameter +Type: Object Parameter Sets: (All) -Aliases: +Aliases: ManagedGroupId -Required: False +Required: True Position: Named Default value: None -Accept pipeline input: False +Accept pipeline input: True (ByValue) Accept wildcard characters: False ``` diff --git a/docs/commands/Set-TeamViewerManagedGroup.md b/docs/Cmdlets_help/Set-TeamViewerManagedGroup.md similarity index 98% rename from docs/commands/Set-TeamViewerManagedGroup.md rename to docs/Cmdlets_help/Set-TeamViewerManagedGroup.md index 62b99de..21d6bd4 100644 --- a/docs/commands/Set-TeamViewerManagedGroup.md +++ b/docs/Cmdlets_help/Set-TeamViewerManagedGroup.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Set-TeamViewerManagedGroup.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Set-TeamViewerManagedGroup.md schema: 2.0.0 --- diff --git a/docs/commands/Set-TeamViewerManager.md b/docs/Cmdlets_help/Set-TeamViewerManager.md similarity index 99% rename from docs/commands/Set-TeamViewerManager.md rename to docs/Cmdlets_help/Set-TeamViewerManager.md index fee966a..4914428 100644 --- a/docs/commands/Set-TeamViewerManager.md +++ b/docs/Cmdlets_help/Set-TeamViewerManager.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Set-TeamViewerManager.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Set-TeamViewerManager.md schema: 2.0.0 --- diff --git a/docs/Cmdlets_help/Set-TeamViewerPSProxy.md b/docs/Cmdlets_help/Set-TeamViewerPSProxy.md new file mode 100644 index 0000000..fedd0cb --- /dev/null +++ b/docs/Cmdlets_help/Set-TeamViewerPSProxy.md @@ -0,0 +1,68 @@ +--- +external help file: TeamViewerPS-help.xml +Module Name: TeamViewerPS +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Set-TeamViewerPSProxy.md +schema: 2.0.0 +--- + +# Set-TeamViewerPSProxy + +## SYNOPSIS + +Set TeamViewerPS to use proxy. + +## SYNTAX + +```powershell +Set-TeamViewerPSProxy [-ProxyUri] [] +``` + +## DESCRIPTION + +Sets a Proxy to access webAPI for TeamViewerPS module functions. + +## EXAMPLES + +### Example 1 + +```powershell +PS /> Set-TeamViewerPSProxy -ProxyUri "http://example.com/port" +``` + +Sets the proxy server to "". + +### Example 2 + +```powershell +PS /> Set-TeamViewerPSProxy -ProxyUri "http://10.0.0.1:3128" +``` + +Sets the proxy server to "". + +## PARAMETERS + +### -ProxyUri + +The Proxy server Uri. + +```yaml +Type: Uri +Parameter Sets: (All) +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +## INPUTS + +### None + +## OUTPUTS + +## NOTES + +## RELATED LINKS diff --git a/docs/commands/Set-TeamViewerPolicy.md b/docs/Cmdlets_help/Set-TeamViewerPolicy.md similarity index 98% rename from docs/commands/Set-TeamViewerPolicy.md rename to docs/Cmdlets_help/Set-TeamViewerPolicy.md index f21eb86..2d0915f 100644 --- a/docs/commands/Set-TeamViewerPolicy.md +++ b/docs/Cmdlets_help/Set-TeamViewerPolicy.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Set-TeamViewerPolicy.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Set-TeamViewerPolicy.md schema: 2.0.0 --- diff --git a/docs/commands/Set-TeamViewerUser.md b/docs/Cmdlets_help/Set-TeamViewerUser.md similarity index 99% rename from docs/commands/Set-TeamViewerUser.md rename to docs/Cmdlets_help/Set-TeamViewerUser.md index 8d69416..8b49745 100644 --- a/docs/commands/Set-TeamViewerUser.md +++ b/docs/Cmdlets_help/Set-TeamViewerUser.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Set-TeamViewerUser.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Set-TeamViewerUser.md schema: 2.0.0 --- diff --git a/docs/commands/Set-TeamViewerUserGroup.md b/docs/Cmdlets_help/Set-TeamViewerUserGroup.md similarity index 93% rename from docs/commands/Set-TeamViewerUserGroup.md rename to docs/Cmdlets_help/Set-TeamViewerUserGroup.md index 53a5b35..bc9b69d 100644 --- a/docs/commands/Set-TeamViewerUserGroup.md +++ b/docs/Cmdlets_help/Set-TeamViewerUserGroup.md @@ -1,135 +1,135 @@ ---- -external help file: TeamViewerPS-help.xml -Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Set-TeamViewerUserGroup.md -schema: 2.0.0 ---- - -# Set-TeamViewerUserGroup - -## SYNOPSIS - -Update properties of a user group. - -## SYNTAX - -```powershell -Set-TeamViewerUserGroup [-ApiToken] [-UserGroup] [-Name] [-WhatIf] [-Confirm] - [] -``` - -## DESCRIPTION - -Update properties of a user group. Currently it is only possible to rename a group. -New name should be unique among all user groups of the TeamViewer company. - -## EXAMPLES - -### Example 1 - -```powershell -PS /> Set-TeamViewerUserGroup -UserGroup 1001 -Name 'New name of the user group' -``` - -Renames a user group with id `1001` to `New name of the user group`. - -## PARAMETERS - -### -ApiToken - -The TeamViewer API access token. - -```yaml -Type: SecureString -Parameter Sets: (All) -Aliases: - -Required: True -Position: 0 -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -Confirm - -Prompts you for confirmation before running the cmdlet. - -```yaml -Type: SwitchParameter -Parameter Sets: (All) -Aliases: cf - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -Name - -The new name of the group. - -```yaml -Type: String -Parameter Sets: (All) -Aliases: UserGroupName - -Required: True -Position: 2 -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -UserGroup - -The user group to be updated. - -```yaml -Type: Object -Parameter Sets: (All) -Aliases: Id, UserGroupId - -Required: True -Position: 1 -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -WhatIf - -Shows what would happen if the cmdlet runs. -The cmdlet is not run. - -```yaml -Type: SwitchParameter -Parameter Sets: (All) -Aliases: wi - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### CommonParameters - -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### None - -## OUTPUTS - -### System.Object - -A `TeamViewerPS.UserGroup` object. - -## NOTES - -## RELATED LINKS +--- +external help file: TeamViewerPS-help.xml +Module Name: TeamViewerPS +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Set-TeamViewerUserGroup.md +schema: 2.0.0 +--- + +# Set-TeamViewerUserGroup + +## SYNOPSIS + +Update properties of a user group. + +## SYNTAX + +```powershell +Set-TeamViewerUserGroup [-ApiToken] [-UserGroup] [-Name] [-WhatIf] [-Confirm] + [] +``` + +## DESCRIPTION + +Update properties of a user group. Currently it is only possible to rename a group. +New name should be unique among all user groups of the TeamViewer company. + +## EXAMPLES + +### Example 1 + +```powershell +PS /> Set-TeamViewerUserGroup -UserGroup 1001 -Name 'New name of the user group' +``` + +Renames a user group with id `1001` to `New name of the user group`. + +## PARAMETERS + +### -ApiToken + +The TeamViewer API access token. + +```yaml +Type: SecureString +Parameter Sets: (All) +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm + +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name + +The new name of the group. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: UserGroupName + +Required: True +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UserGroup + +The user group to be updated. + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: Id, UserGroupId + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf + +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters + +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### None + +## OUTPUTS + +### System.Object + +A `TeamViewerPS.UserGroup` object. + +## NOTES + +## RELATED LINKS diff --git a/docs/Cmdlets_help/Set-TeamViewerUserRole.md b/docs/Cmdlets_help/Set-TeamViewerUserRole.md new file mode 100644 index 0000000..95ff406 --- /dev/null +++ b/docs/Cmdlets_help/Set-TeamViewerUserRole.md @@ -0,0 +1,130 @@ +--- +external help file: TeamViewerPS-help.xml +Module Name: TeamViewerPS +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Set-TeamViewerUserRole.md +schema: 2.0.0 +--- + +# Set-TeamViewerUserRole + +## SYNOPSIS + +Update properties of a user role. + +## SYNTAX + +```powershell +Set-TeamViewerUserRole [-ApiToken] [-Name] [-UserRoleId] [-Permissions] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION + +Update properties of a user role. It allows to rename and alter permissions. + +## EXAMPLES + +### Example 1 + +```powershell +PS /> Set-TeamViewerUserRole -Name 'New name of user role' -Permissions 'AllowGroupSharing','ModifyConnections' -UserRoleId '9b465ea2-2f75-4101-a057-58a81ed0e57b' +``` + +Renames a user role with id `9b465ea2-2f75-4101-a057-58a81ed0e57b` to `New name of user role` and enables the permissions `AllowGroupSharing` and `ModifyConnections`. + +## PARAMETERS + +### -ApiToken + +The TeamViewer API access token. + +```yaml +Type: SecureString +Parameter Sets: (All) +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name + +The new name of the User role. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: UserRoleName + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UserRoleId + +The user role to be updated. + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: UserRole + +Required: True +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Permissions + +Updated set of permissions of the user role. +Please see the TeamViewer API documentation for a list of valid values. + +```yaml +Type: Array +Parameter Sets: ByParameters +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf + +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters + +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### None + +## OUTPUTS + +## NOTES + +## RELATED LINKS diff --git a/docs/commands/Start-TeamViewerService.md b/docs/Cmdlets_help/Start-TeamViewerService.md similarity index 96% rename from docs/commands/Start-TeamViewerService.md rename to docs/Cmdlets_help/Start-TeamViewerService.md index 38bf289..c672810 100644 --- a/docs/commands/Start-TeamViewerService.md +++ b/docs/Cmdlets_help/Start-TeamViewerService.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Start-TeamViewerService.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Start-TeamViewerService.md schema: 2.0.0 --- diff --git a/docs/commands/Stop-TeamViewerService.md b/docs/Cmdlets_help/Stop-TeamViewerService.md similarity index 96% rename from docs/commands/Stop-TeamViewerService.md rename to docs/Cmdlets_help/Stop-TeamViewerService.md index d744923..26a8f0b 100644 --- a/docs/commands/Stop-TeamViewerService.md +++ b/docs/Cmdlets_help/Stop-TeamViewerService.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Stop-TeamViewerService.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Stop-TeamViewerService.md schema: 2.0.0 --- diff --git a/docs/commands/Test-TeamViewerConnectivity.md b/docs/Cmdlets_help/Test-TeamViewerConnectivity.md similarity index 96% rename from docs/commands/Test-TeamViewerConnectivity.md rename to docs/Cmdlets_help/Test-TeamViewerConnectivity.md index 720c967..5e5e4b0 100644 --- a/docs/commands/Test-TeamViewerConnectivity.md +++ b/docs/Cmdlets_help/Test-TeamViewerConnectivity.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Test-TeamViewerConnectivity.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Test-TeamViewerConnectivity.md schema: 2.0.0 --- diff --git a/docs/commands/Test-TeamViewerInstallation.md b/docs/Cmdlets_help/Test-TeamViewerInstallation.md similarity index 94% rename from docs/commands/Test-TeamViewerInstallation.md rename to docs/Cmdlets_help/Test-TeamViewerInstallation.md index ecbc658..3b36d7f 100644 --- a/docs/commands/Test-TeamViewerInstallation.md +++ b/docs/Cmdlets_help/Test-TeamViewerInstallation.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Test-TeamViewerInstallation.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Test-TeamViewerInstallation.md schema: 2.0.0 --- diff --git a/docs/commands/Unpublish-TeamViewerGroup.md b/docs/Cmdlets_help/Unpublish-TeamViewerGroup.md similarity index 97% rename from docs/commands/Unpublish-TeamViewerGroup.md rename to docs/Cmdlets_help/Unpublish-TeamViewerGroup.md index 2881d5e..887e2ab 100644 --- a/docs/commands/Unpublish-TeamViewerGroup.md +++ b/docs/Cmdlets_help/Unpublish-TeamViewerGroup.md @@ -1,7 +1,7 @@ --- external help file: TeamViewerPS-help.xml Module Name: TeamViewerPS -online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/commands/Unpublish-TeamViewerGroup.md +online version: https://github.com/teamviewer/TeamViewerPS/blob/main/docs/Cmdlets_help/Unpublish-TeamViewerGroup.md schema: 2.0.0 --- diff --git a/TeamViewerPS/TeamViewerPS.Types.ps1 b/docs/TeamViewerPS.Types.ps1 similarity index 61% rename from TeamViewerPS/TeamViewerPS.Types.ps1 rename to docs/TeamViewerPS.Types.ps1 index cabf757..b1a10b0 100644 --- a/TeamViewerPS/TeamViewerPS.Types.ps1 +++ b/docs/TeamViewerPS.Types.ps1 @@ -3,3 +3,9 @@ enum TeamViewerConnectionReportSessionType { RemoteSupportActive = 2 RemoteSupportActiveSdk = 3 } + +enum PolicyType { + TeamViewer = 1 + Monitoring = 4 + PatchManagement = 5 +} diff --git a/TeamViewerPS/TeamViewerPS.format.ps1xml b/docs/TeamViewerPS.format.ps1xml similarity index 100% rename from TeamViewerPS/TeamViewerPS.format.ps1xml rename to docs/TeamViewerPS.format.ps1xml diff --git a/TeamViewerPS/TeamViewerPS.psd1 b/docs/TeamViewerPS.psd1 similarity index 99% rename from TeamViewerPS/TeamViewerPS.psd1 rename to docs/TeamViewerPS.psd1 index 97eeb1d..0ffbf58 100644 --- a/TeamViewerPS/TeamViewerPS.psd1 +++ b/docs/TeamViewerPS.psd1 @@ -3,7 +3,7 @@ RootModule = 'TeamViewerPS.psm1' # Version number of this module. - ModuleVersion = '1.5.1' + ModuleVersion = '2.0.0' # Supported PSEditions. # CompatiblePSEditions = @() diff --git a/TeamViewerPS/TeamViewerPS.psm1 b/docs/TeamViewerPS.psm1 similarity index 54% rename from TeamViewerPS/TeamViewerPS.psm1 rename to docs/TeamViewerPS.psm1 index 7106f40..e373072 100644 --- a/TeamViewerPS/TeamViewerPS.psm1 +++ b/docs/TeamViewerPS.psm1 @@ -1,6 +1,6 @@ $ModuleTypes = @( Get-ChildItem -Path "$PSScriptRoot/TeamViewerPS.Types.ps1" -ErrorAction SilentlyContinue ) -$PublicFunctions = @( Get-ChildItem -Path "$PSScriptRoot/Public/*.ps1" -ErrorAction SilentlyContinue ) -$PrivateFunctions = @( Get-ChildItem -Path "$PSScriptRoot/Private/*.ps1" -ErrorAction SilentlyContinue ) +$PublicFunctions = @( Get-ChildItem -Path "$PSScriptRoot/Cmdlets/Public/*.ps1" -ErrorAction SilentlyContinue ) +$PrivateFunctions = @( Get-ChildItem -Path "$PSScriptRoot/Cmdlets/Private/*.ps1" -ErrorAction SilentlyContinue ) @($ModuleTypes + $PublicFunctions + $PrivateFunctions) | ForEach-Object { . $_.FullName } Export-ModuleMember -Function $PublicFunctions.BaseName -Alias * diff --git a/docs/about_TeamViewerPS.md b/docs/about_TeamViewerPS.md index 6c8fe9f..4b066e5 100644 --- a/docs/about_TeamViewerPS.md +++ b/docs/about_TeamViewerPS.md @@ -20,31 +20,31 @@ Remotely manage the Computers & Contacts list via the TeamViewer Web API. The following functions are available in this category: -[`Get-TeamViewerContact`](commands/Get-TeamViewerContact.md) +[`Get-TeamViewerContact`](Cmdlets/Public/Get-TeamViewerContact.md) -[`Get-TeamViewerDevice`](commands/Get-TeamViewerDevice.md) +[`Get-TeamViewerDevice`](Cmdlets/Public/Get-TeamViewerDevice.md) -[`Get-TeamViewerGroup`](commands/Get-TeamViewerGroup.md) +[`Get-TeamViewerGroup`](Cmdlets/Public/Get-TeamViewerGroup.md) -[`New-TeamViewerContact`](commands/New-TeamViewerContact.md) +[`New-TeamViewerContact`](Cmdlets/Public/New-TeamViewerContact.md) -[`New-TeamViewerDevice`](commands/New-TeamViewerDevice.md) +[`New-TeamViewerDevice`](Cmdlets/Public/New-TeamViewerDevice.md) -[`New-TeamViewerGroup`](commands/New-TeamViewerGroup.md) +[`New-TeamViewerGroup`](Cmdlets/Public/New-TeamViewerGroup.md) -[`Remove-TeamViewerContact`](commands/Remove-TeamViewerContact.md) +[`Remove-TeamViewerContact`](Cmdlets/Public/Remove-TeamViewerContact.md) -[`Remove-TeamViewerDevice`](commands/Remove-TeamViewerDevice.md) +[`Remove-TeamViewerDevice`](Cmdlets/Public/Remove-TeamViewerDevice.md) -[`Remove-TeamViewerGroup`](commands/Remove-TeamViewerGroup.md) +[`Remove-TeamViewerGroup`](Cmdlets/Public/Remove-TeamViewerGroup.md) -[`Set-TeamViewerDevice`](commands/Set-TeamViewerDevice.md) +[`Set-TeamViewerDevice`](Cmdlets/Public/Set-TeamViewerDevice.md) -[`Set-TeamViewerGroup`](commands/Set-TeamViewerGroup.md) +[`Set-TeamViewerGroup`](Cmdlets/Public/Set-TeamViewerGroup.md) -[`Publish-TeamViewerGroup`](commands/Publish-TeamViewerGroup.md) +[`Publish-TeamViewerGroup`](Cmdlets/Public/Publish-TeamViewerGroup.md) -[`Unpublish-TeamViewerGroup`](commands/Unpublish-TeamViewerGroup.md) +[`Unpublish-TeamViewerGroup`](Cmdlets/Public/Unpublish-TeamViewerGroup.md) ## User management @@ -53,13 +53,13 @@ Web API. The following functions are available in this category: -[`Get-TeamViewerUser`](commands/Get-TeamViewerUser.md) +[`Get-TeamViewerUser`](Cmdlets/Public/Get-TeamViewerUser.md) -[`New-TeamViewerUser`](commands/New-TeamViewerUser.md) +[`New-TeamViewerUser`](Cmdlets/Public/New-TeamViewerUser.md) -[`Remove-TeamViewerUser`](commands/Remove-TeamViewerUser.md) +[`Remove-TeamViewerUser`](Cmdlets/Public/Remove-TeamViewerUser.md) -[`Set-TeamViewerUser`](commands/Set-TeamViewerUser.md) +[`Set-TeamViewerUser`](Cmdlets/Public/Set-TeamViewerUser.md) ## User groups @@ -68,19 +68,19 @@ TeamViewer Web API. Have user groups to organize company members. The following functions are available in this category: -[`Get-TeamViewerUserGroup`](commands/Get-TeamViewerUserGroup.md) +[`Get-TeamViewerUserGroup`](Cmdlets/Public/Get-TeamViewerUserGroup.md) -[`New-TeamViewerUserGroup`](commands/New-TeamViewerUserGroup.md) +[`New-TeamViewerUserGroup`](Cmdlets/Public/New-TeamViewerUserGroup.md) -[`Set-TeamViewerUserGroup`](commands/Set-TeamViewerUserGroup.md) +[`Set-TeamViewerUserGroup`](Cmdlets/Public/Set-TeamViewerUserGroup.md) -[`Remove-TeamViewerUserGroup`](commands/Remove-TeamViewerUserGroup.md) +[`Remove-TeamViewerUserGroup`](Cmdlets/Public/Remove-TeamViewerUserGroup.md) -[`Get-TeamViewerUserGroupMember`](commands/Get-TeamViewerUserGroupMember.md) +[`Get-TeamViewerUserGroupMember`](Cmdlets/Public/Get-TeamViewerUserGroupMember.md) -[`Add-TeamViewerUserGroupMember`](commands/Add-TeamViewerUserGroupMember.md) +[`Add-TeamViewerUserGroupMember`](Cmdlets/Public/Add-TeamViewerUserGroupMember.md) -[`Remove-TeamViewerUserGroupMember`](commands/Remove-TeamViewerUserGroupMember.md) +[`Remove-TeamViewerUserGroupMember`](Cmdlets/Public/Remove-TeamViewerUserGroupMember.md) ## Managed groups @@ -89,33 +89,33 @@ TeamViewer Web API. The following functions are available in this category: -[`Get-TeamViewerManagedDevice`](commands/Get-TeamViewerManagedDevice.md) +[`Get-TeamViewerManagedDevice`](Cmdlets/Public/Get-TeamViewerManagedDevice.md) -[`Get-TeamViewerManagedGroup`](commands/Get-TeamViewerManagedGroup.md) +[`Get-TeamViewerManagedGroup`](Cmdlets/Public/Get-TeamViewerManagedGroup.md) -[`Get-TeamViewerManagementId`](commands/Get-TeamViewerManagementId.md) +[`Get-TeamViewerManagementId`](Cmdlets/Public/Get-TeamViewerManagementId.md) -[`Get-TeamViewerManager`](commands/Get-TeamViewerManager.md) +[`Get-TeamViewerManager`](Cmdlets/Public/Get-TeamViewerManager.md) -[`New-TeamViewerManagedGroup`](commands/New-TeamViewerManagedGroup.md) +[`New-TeamViewerManagedGroup`](Cmdlets/Public/New-TeamViewerManagedGroup.md) -[`Set-TeamViewerManagedDevice`](commands/Set-TeamViewerManagedDevice.md) +[`Set-TeamViewerManagedDevice`](Cmdlets/Public/Set-TeamViewerManagedDevice.md) -[`Set-TeamViewerManagedGroup`](commands/Set-TeamViewerManagedGroup.md) +[`Set-TeamViewerManagedGroup`](Cmdlets/Public/Set-TeamViewerManagedGroup.md) -[`Set-TeamViewerManager`](commands/Set-TeamViewerManager.md) +[`Set-TeamViewerManager`](Cmdlets/Public/Set-TeamViewerManager.md) -[`Add-TeamViewerManagedDevice`](commands/Add-TeamViewerManagedDevice.md) +[`Add-TeamViewerManagedDevice`](Cmdlets/Public/Add-TeamViewerManagedDevice.md) -[`Add-TeamViewerManager`](commands/Add-TeamViewerManager.md) +[`Add-TeamViewerManager`](Cmdlets/Public/Add-TeamViewerManager.md) -[`Remove-TeamViewerManagedDevice`](commands/Remove-TeamViewerManagedDevice.md) +[`Remove-TeamViewerManagedDevice`](Cmdlets/Public/Remove-TeamViewerManagedDevice.md) -[`Remove-TeamViewerManagedDeviceManagement`](commands/Remove-TeamViewerManagedDeviceManagement.md) +[`Remove-TeamViewerManagedDeviceManagement`](Cmdlets/Public/Remove-TeamViewerManagedDeviceManagement.md) -[`Remove-TeamViewerManagedGroup`](commands/Remove-TeamViewerManagedGroup.md) +[`Remove-TeamViewerManagedGroup`](Cmdlets/Public/Remove-TeamViewerManagedGroup.md) -[`Remove-TeamViewerManager`](commands/Remove-TeamViewerManager.md) +[`Remove-TeamViewerManager`](Cmdlets/Public/Remove-TeamViewerManager.md) ## Policy management @@ -123,13 +123,13 @@ Remotely manage the policies of a TeamViewer company via the TeamViewer Web API. The following functions are available in this category: -[`Get-TeamViewerPolicy`](commands/Get-TeamViewerPolicy.md) +[`Get-TeamViewerPolicy`](Cmdlets/Public/Get-TeamViewerPolicy.md) -[`New-TeamViewerPolicy`](commands/New-TeamViewerPolicy.md) +[`New-TeamViewerPolicy`](Cmdlets/Public/New-TeamViewerPolicy.md) -[`Remove-TeamViewerPolicy`](commands/Remove-TeamViewerPolicy.md) +[`Remove-TeamViewerPolicy`](Cmdlets/Public/Remove-TeamViewerPolicy.md) -[`Set-TeamViewerPolicy`](commands/Set-TeamViewerPolicy.md) +[`Set-TeamViewerPolicy`](Cmdlets/Public/Set-TeamViewerPolicy.md) ## Single Sign-On management @@ -137,22 +137,22 @@ Remotely manage Single Sign-On configurations via the TeamViewer Web API. The following functions are available in this category: -[`Get-TeamViewerSsoDomain`](commands/Get-TeamViewerSsoDomain.md) +[`Get-TeamViewerSsoDomain`](Cmdlets/Public/Get-TeamViewerSsoDomain.md) -[`Get-TeamViewerSsoExclusion`](commands/Get-TeamViewerSsoExclusion.md) +[`Get-TeamViewerSsoExclusion`](Cmdlets/Public/Get-TeamViewerSsoExclusion.md) -[`Add-TeamViewerSsoExclusion`](commands/Add-TeamViewerSsoExclusion.md) +[`Add-TeamViewerSsoExclusion`](Cmdlets/Public/Add-TeamViewerSsoExclusion.md) -[`Remove-TeamViewerSsoExclusion`](commands/Remove-TeamViewerSsoExclusion.md) +[`Remove-TeamViewerSsoExclusion`](Cmdlets/Public/Remove-TeamViewerSsoExclusion.md) ## Event logs & reporting Retrieve event log entries or connection-reports of a TeamViewer company via the TeamViewer Web API. -[`Get-TeamViewerConnectionReport`](commands/Get-TeamViewerConnectionReport.md) +[`Get-TeamViewerConnectionReport`](Cmdlets/Public/Get-TeamViewerConnectionReport.md) -[`Get-TeamViewerEventLog`](commands/Get-TeamViewerEventLog.md) +[`Get-TeamViewerEventLog`](Cmdlets/Public/Get-TeamViewerEventLog.md) ## Local TeamViewer utilities @@ -160,23 +160,23 @@ Utilities that help managing the local TeamViewer installation. The following functions are available in this category: -[`Get-TeamViewerId`](commands/Get-TeamViewerId.md) +[`Get-TeamViewerId`](Cmdlets/Public/Get-TeamViewerId.md) -[`Get-TeamViewerService`](commands/Get-TeamViewerService.md) +[`Get-TeamViewerService`](Cmdlets/Public/Get-TeamViewerService.md) -[`Get-TeamViewerVersion`](commands/Get-TeamViewerVersion.md) +[`Get-TeamViewerVersion`](Cmdlets/Public/Get-TeamViewerVersion.md) -[`Invoke-TeamViewerPackageDownload`](commands/Invoke-TeamViewerPackageDownload.md) +[`Invoke-TeamViewerPackageDownload`](Cmdlets/Public/Invoke-TeamViewerPackageDownload.md) -[`Restart-TeamViewerService`](commands/Restart-TeamViewerService.md) +[`Restart-TeamViewerService`](Cmdlets/Public/Restart-TeamViewerService.md) -[`Start-TeamViewerService`](commands/Start-TeamViewerService.md) +[`Start-TeamViewerService`](Cmdlets/Public/Start-TeamViewerService.md) -[`Stop-TeamViewerService`](commands/Stop-TeamViewerService.md) +[`Stop-TeamViewerService`](Cmdlets/Public/Stop-TeamViewerService.md) -[`Test-TeamViewerConnectivity`](commands/Test-TeamViewerConnectivity.md) +[`Test-TeamViewerConnectivity`](Cmdlets/Public/Test-TeamViewerConnectivity.md) -[`Test-TeamViewerInstallation`](commands/Test-TeamViewerInstallation.md) +[`Test-TeamViewerInstallation`](Cmdlets/Public/Test-TeamViewerInstallation.md) ## Web API utilities @@ -184,11 +184,11 @@ Utilities that help working with the TeamViewer Web API related functions. The following functions are available in this category: -[`Connect-TeamViewerApi`](commands/Connect-TeamViewerApi.md) +[`Connect-TeamViewerApi`](Cmdlets/Public/Connect-TeamViewerApi.md) -[`Disconnect-TeamViewerApi`](commands/Disconnect-TeamViewerApi.md) +[`Disconnect-TeamViewerApi`](Cmdlets/Public/Disconnect-TeamViewerApi.md) -[`Invoke-TeamViewerPing`](commands/Invoke-TeamViewerPing.md) +[`Invoke-TeamViewerPing`](Cmdlets/Public/Invoke-TeamViewerPing.md) # SEE ALSO