Giter VIP home page Giter VIP logo

Comments (11)

g-bougard avatar g-bougard commented on May 22, 2024 1

Yes, we need to add win32 support better reading the registry key here.

from fusioninventory-agent.

bvessey avatar bvessey commented on May 22, 2024 1

If the record exists for your computer object, there will be a Remote Access (or Remote Administration) tab, the subsequent screen will then list the computer object's TeamViewer ID

from fusioninventory-agent.

HairullinRR avatar HairullinRR commented on May 22, 2024 1

Hello!
no inventory id TeamViewer version 9 and below.
TeamViewer version 9 and below as the path in the registry HKEY__LOCAL_MACHINE\SOFTWARE\WOW6432Node\TeamViewer\Version9\
similarly x86 HKEY__LOCAL_MACHINE\SOFTWARE\TeamViewer\Version9\

from fusioninventory-agent.

g-bougard avatar g-bougard commented on May 22, 2024

@bvessey
Actually we check ClientID if we can run "teamviewer" command. Then we parse output of "teamviewer --info". This is the generic way.
"teamviewer" command is probably not in the path under win32. Can you report us the default path under win32 ?

from fusioninventory-agent.

bvessey avatar bvessey commented on May 22, 2024

I just tried the teamviewer --info command in windows and it doesn't return anything, simply opens the teamviewer GUI.

My current hacky workaround is based on this: https://www.sole.dk/vbscript-to-show-current-teamviewer-id-and-save-to-text-file/

Googling around doesn't provide any win32 commands to easily get the information. reg query will easily return the value in hex which could be converted to decimal once it's been taken in by the server as opposed to messing with the conversion on the client and then passing the decimal value to the server.

To answer your inital question, TeamViewer is installed at
%programfiles(x86)%\TeamViewer
or
%programfiles%\TeamViewer

depending on 32 / 64 bits.

The reg query can be made universal (1 query regardless of "bitness") by adding the /reg:32 switch at the end of the command.

from fusioninventory-agent.

g-bougard avatar g-bougard commented on May 22, 2024

Hi, I just published a 2.3.19 rc9 including the fix: FIA Installer 2.3.19-teclib-rc9

Can you confirm this fixes your issue ? Thx

from fusioninventory-agent.

bvessey avatar bvessey commented on May 22, 2024

It works! Any idea what the ETA is for release as this will make things much simpler within our team once in production.

from fusioninventory-agent.

g-bougard avatar g-bougard commented on May 22, 2024

Great thanks for the feedback.
The next release date is a matter of weeks, one month max.

from fusioninventory-agent.

nwf00 avatar nwf00 commented on May 22, 2024

Hi everyone, I´ve recently start using GLPI an Fusioninventory. I´ve InstallGLPI 9.1.1, FusionInventory Plugin 9.1+1.0 and FusionInventory Agent 2.3.18. I can´t find the remote_mgmt field (Teamviewer). I know that there is a fix ( FIA Installer 2.3.19-teclib-rc9) but whereshould be the field? THX for the help.

from fusioninventory-agent.

g-bougard avatar g-bougard commented on May 22, 2024

Hi @HairullinRR
First of all, I advise you to upgrade Teamviewer as v9 is even not available on official site. Of course, I can understand this is not possible and I'll take a look if we could scan such folder as I still saw /VersionX was still used with Teamviewer where X is the main version number.
Can you still confirm you can see \SOFTWARE\TeamViewer\Version9\ClientID key with regedit ?

from fusioninventory-agent.

ASVxASV avatar ASVxASV commented on May 22, 2024

Hello @g-bougard.
I colleague Hairullin.R.R!
We have several licenses Teamviewer 9 and update programm don't planted.On klient's insalled Teamviewer Host 9 and such this client's nearly 600.
I have practice writing vbs scripts.
I give an example vbs script.He is founded in editor meaning TeamViewerID any version, and writing in file .txt in format .csv
In script used mode checking subsections register in cycle.
Look on this example.

On Error Resume Next
Dim allComp(500,4)
Dim arrStr, count2
Dim iTm
Dim dwValue
Dim dwValueID

' ForAppending = 8 ForReading = 1, ForWriting = 2
Const ForAppending = 8
Const ForReading = 1
Const ForWriting = 2
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002

Function EnvString(variable)
    set objShell = WScript.CreateObject( "WScript.Shell" )
    variable = "%" & variable & "%"
    EnvString = objShell.ExpandEnvironmentStrings(variable)
    Set objShell = Nothing    
End Function

'Get Enviromental Vars
user=lcase(EnvString("username"))
comp=lcase(EnvString("ComputerName"))
domain=lcase(EnvString("UserDomain"))

'Edit this to point to a shared drive where all users have write access
'strDirectory = "\\server\share\subfolder"
strDirectory = "\\server\TeamviewerID"
'Edit this to point to a shared drive where all users have write access
Set wshshell = CreateObject("WScript.Shell")
computer = WshShell.ExpandEnvironmentStrings("%computername%")
strComputer = "."

'strFile = "\" & comp & "_TeamViewerID.csv" 'Outputs to "TeamViewerID.csv" 
 
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
 strComputer & "\root\default:StdRegProv")
' Перенос сроки vbCrLf
For iTm = 6 to 13

strKeyPath = "SOFTWARE\Wow6432Node\TeamViewer\Version" & iTm
strValueName = "ClientID"
oReg.GetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
if Not IsNull(dwValue) Then
strFile = "\" & comp & "_TeamViewerID" & "_" & dwValue & "_File.csv" 'Outputs to "TeamViewerID.csv" 
if len(dwValue) >= 9 then 
'strText2 = "Домен;" & domain & ";Компьютер;" & comp & vbCrLf & ";Логин (Пользователь);" & user & vbCrLf & ";" & "Версия TeamViewer;" & iTm & vbCrLf & ";ID;" & dwValue
strText2 = domain & ";" & comp & ";" & user & ";" & iTm & ";" & dwValue
'wscript.echo(dwValue)
end If
end If
If Not IsNull(dwValue) Then
strText = "Домен;Компьютер;Логин (Пользователь);Версия TeamViewer;TeamViewerID"
strFile = "\" & comp & "_TeamViewerID" & "_" & dwValue & "_File.csv" 'Outputs to "TeamViewerID.csv" 
'wscript.echo(dwValue)
end If
Next

For iTm = 6 to 13

strKeyPath = "SOFTWARE\TeamViewer\Version" & iTm
strValueName = "ClientID"
oReg.GetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
if Not IsNull(dwValue) Then
strFile = "\" & comp & "_TeamViewerID" & "_" & dwValue & "_File.csv" 'Outputs to "TeamViewerID.csv" 
if len(dwValue) >= 9 then 
'strText2 = "Домен;" & domain & ";Компьютер;" & comp & vbCrLf & ";Логин (Пользователь);" & user & vbCrLf & ";" & "Версия TeamViewer;" & iTm & vbCrLf & ";ID;" & dwValue
strText2 = domain & ";" & comp & ";" & user & ";" & iTm & ";" & dwValue
'wscript.echo(dwValue)
end If
end If
If Not IsNull(dwValue) Then
strText = "Домен;Компьютер;Логин (Пользователь);Версия TeamViewer;TeamViewerID"
strFile = "\" & comp & "_TeamViewerID" & "_" & dwValue & "_File.csv" 'Outputs to "TeamViewerID.csv" 
'wscript.echo(dwValue)
end If
Next

strKeyPath = "SOFTWARE\TeamViewer\"
strValueName = "ClientID"
strValueVersion = "Version"
oReg.GetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
if Not IsNull(dwValue) Then
strFile = "\" & comp & "_TeamViewerID" & "_" & dwValue & "_File.csv" 'Outputs to "TeamViewerID.csv" 
if len(dwValue) >= 9 then 
oReg.GetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValueVersion
'strText2 = "Домен;" & domain & ";Компьютер;" & comp & vbCrLf & ";Логин (Пользователь);" & user & vbCrLf & ";" & "Версия TeamViewer;" & iTm & vbCrLf & ";ID;" & dwValue
strText2 = domain & ";" & comp & ";" & user & ";" & strValueVersion & ";" & dwValue
'wscript.echo(dwValue)
end If
end If
If Not IsNull(dwValue) Then
strText = "Домен;Компьютер;Логин (Пользователь);Версия TeamViewer;TeamViewerID"
strFile = "\" & comp & "_TeamViewerID" & "_" & dwValue & "_File.csv" 'Outputs to "TeamViewerID.csv" 
'wscript.echo(dwValue)
end If


Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(strDirectory) Then
   Set objFolder = objFSO.GetFolder(strDirectory)
   'wscript.echo("Folder Exists!")
Else
	Set objFolder = objFSO.CreateFolder(strDirectory)  
	If not objFSO.FolderExists(strDirectory) Then
		wscript.quit
	End If
	'wscript.echo("Folder Does Not Exist!")
End If

If objFSO.FileExists(strDirectory & strFile) Then
	'wscript.echo("File Exists!")
	Set objFolder = objFSO.GetFolder(strDirectory)
	Set objTextFile = objFSO.OpenTextFile(strDirectory & strFile)
	count = 0
	Do while NOT objTextFile.AtEndOfStream
		arrStr = split(objTextFile.ReadLine,";")
		'wscript.echo(Count & "," & arrStr)
		if arrStr(1) <> comp Then
			count = count + 1
			allcomp(count,0)=arrStr(0) 'Domain / Company
			allcomp(count,1)=arrStr(1) 'Computer Name
			allcomp(count,2)=arrStr(2) 'Username
			allcomp(count,3)=arrStr(3) 'Teamviewer Version
			allcomp(count,4)=arrStr(4) 'Teamviewer ID
		End If
	Loop
		
		'wscript.echo("EOF!")
		objTextFile.Close
		set objTextFile = nothing
		
		objFSO.DeleteFile(strDirectory & strFile)
		
		Set objFile = objFSO.CreateTextFile(strDirectory & strFile)
		set objFile = nothing
		
		Set objTextFile = objFSO.OpenTextFile(strDirectory & strFile, ForAppending, True)
		count2 = Count
		'wscript.echo(count2)
		if IsNull(dwValue) Then
		strText = "Домен;Компьютер;Логин (Пользователь);Версия TeamViewer;TeamViewerID"
		for count = 1 to count2
		
			strtext=allcomp(count,0)&";"&allcomp(count,1)&";"&allcomp(count,2)&";"&allcomp(count,3)&";"&allcomp(count,4)
			objTextFile.WriteLine(strText)
		
			'wscript.echo(strText)
		Next
		end if
		if IsNull(dwValue) Then
		objTextFile.WriteLine(strText2)
		end if
		'wscript.echo(strText2)
		objTextFile.Close
		set objTextFile = nothing
Else
	Set objFile = objFSO.CreateTextFile(strDirectory & strFile)
	set objFile = nothing
	Set objTextFile = objFSO.OpenTextFile(strDirectory & strFile, ForAppending, True)
	if IsNull(dwValue) Then
	strText3 = "Домен;Компьютер;Логин (Пользователь);Версия TeamViewer;TeamViewerID"
	objTextFile.WriteLine(strText3)
	objTextFile.Close
	end if
	set objTextFile = nothing
End If

set objFolder = nothing
set objFSO = Nothing

I checking way in register HKLM\SOFTWARE\TeamViewer\Version9\ClientID and changed in your way founded register in file TeamViewer.pm
This code has been working.In system GLPI writing record TeamViewerID.

package FusionInventory::Agent::Task::Inventory::Generic::Remote_Mgmt::TeamViewer;

use strict;
use warnings;

use English qw(-no_match_vars);

use FusionInventory::Agent::Tools;

sub isEnabled {
    my (%params) = @_;

    if ($OSNAME eq 'MSWin32') {

        FusionInventory::Agent::Tools::Win32->use();

        return defined getRegistryKey(
            path => is64bit() ?
                "HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/TeamViewer/Version9" :
                "HKEY_LOCAL_MACHINE/SOFTWARE/TeamViewer/Version9",
            logger => $params{logger}
        );
    }

    return canRun('teamviewer');
}

sub doInventory {
    my (%params) = @_;

    my $inventory = $params{inventory};
    my $logger    = $params{logger};

    my $teamViewerID = _getID(logger => $logger);
    if (defined($teamViewerID)) {
        $logger->debug('Found TeamViewerID : ' . $teamViewerID) if ($logger);

        $inventory->addEntry(
            section => 'REMOTE_MGMT',
            entry   => {
                ID   => $teamViewerID,
                TYPE => 'teamviewer'
            }
        );
    } else {
        $logger->debug('TeamViewerID not found') if ($logger);
    }
}

sub _getID {
    my (%params) = @_;

    if ($OSNAME eq 'MSWin32') {

        FusionInventory::Agent::Tools::Win32->use();

        my $clientid = getRegistryValue(
            path   => is64bit() ?
                "HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/TeamViewer/Version9/ClientID" :
                "HKEY_LOCAL_MACHINE/SOFTWARE/TeamViewer/Version9/ClientID",
            %params
        );

        return $clientid ? hex($clientid) || $clientid : undef ;
    }

    return getFirstMatch(
        command => "teamviewer --info",
        pattern => qr/TeamViewer ID:(?:\033\[0m|\s)*(\d+)\s+/,
        %params
    );
}

1;

I dont have working with computer language Perl(=
I make do cycle checking way HKLM\SOFTWARE\TeamViewer
I suggest checking way register in cycle HKLM\SOFTWARE\TeamViewer\ClientID, if in HKLM\SOFTWARE\TeamViewer\ not Exist ClientID, Then checking HKLM\SOFTWARE\TeamViewer\VersionN\ClientID
in cycle.
iTm variable Integer

For iTm = 1 do 13.
HKLM\SOFTWARE\TeamViewer\Version"iTm"\ ClientID
If you have ClientID then remembered in variable TeamViewerID value ClientID
next

Maybe you have more simple solution, please help me!

from fusioninventory-agent.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.