Skip to content

added new Get-TeamViewerInstallationType function#96

Open
radu-cristea-15 wants to merge 1 commit intomainfrom
new_Get-TeamViewerInstalltionType_function
Open

added new Get-TeamViewerInstallationType function#96
radu-cristea-15 wants to merge 1 commit intomainfrom
new_Get-TeamViewerInstalltionType_function

Conversation

@radu-cristea-15
Copy link
Collaborator

No description provided.

@radu-cristea-15 radu-cristea-15 force-pushed the new_Get-TeamViewerInstalltionType_function branch from bfd0667 to 8c7e2bb Compare February 5, 2026 14:36
@radu-cristea-15 radu-cristea-15 force-pushed the new_Get-TeamViewerInstalltionType_function branch from 8c7e2bb to 269f65d Compare February 5, 2026 14:46

## SYNOPSIS

Gets the TeamViewer installation type.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Gets the TeamViewer installation type.
Returns the TeamViewer installation type.


## DESCRIPTION

The command checks the TeamViewer installation and returns the installation type (Msi or Exe).
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
The command checks the TeamViewer installation and returns the installation type (Msi or Exe).
The command checks the TeamViewer installation and returns the installation type (Msi, Exe, or Unknown).

Copy link
Contributor

Choose a reason for hiding this comment

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

Running all tests returned this:

[-] Get-TeamViewerInstallationType.TeamViewer not installed.Should return Unknown when TeamViewer is not installed 11.62s (11.62s|1ms)
 Expected strings to be the same, but they were different.
 Expected length: 7
 Actual length:   3
 Strings differ at index 0.
 Expected: 'Unknown'
 But was:  'Msi'
            ^
 at $result | Should -Be 'Unknown', D:\Sources\TeamViewerPS\Tests\Public\Get-TeamViewerInstallationType.Tests.ps1:60
 at <ScriptBlock>, D:\Sources\TeamViewerPS\Tests\Public\Get-TeamViewerInstallationType.Tests.ps1:60

Please investigate what is going wrong here.

@@ -0,0 +1,68 @@
function Get-TeamViewerInstallationType {

#i)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#i)

Unneccessary comment, I think.

}
}

#ii)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#ii)

Obsolete comment can be removed.

'HKLM:\SOFTWARE\WOW6432Node\TeamViewer'
)

foreach ($tv in $tvPaths) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This foreach will always find at least one of the entries when TV is installed and thus at least one of them will call return ''. The second part further down is never called. This should not be the case as the second check should also be made.

}
}
catch {
return 'Exe'
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not really sure, if the catch should return "Exe". It looks more like "Unknown" to me.


#ii)
try {
$msi = Get-CimInstance Win32_Product -Filter "Name='TeamViewer'" -ErrorAction Stop
Copy link
Contributor

Choose a reason for hiding this comment

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

This test should be done above when it seems likely that the installation is an MSI installation. Both MsiInstallation registry value + this being present are proof of the correct installation via MSI.

'HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall',
'HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall'
)
foreach ($path in $uninstallPaths) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This test would make more sense above when we believe it is not Msi but quiet likely an Exe installation. Then we could add a check, that the file pointed to by the UninstallString is really on the disc. If that file is missing, it is definitely a broken installation and should return "Unknown".

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants