diff --git a/agent/Unix/teamviewer.pm b/agent/Unix/teamviewer.pm index 7bb4cad..6b6b8b2 100644 --- a/agent/Unix/teamviewer.pm +++ b/agent/Unix/teamviewer.pm @@ -65,6 +65,11 @@ sub teamviewer_inventory_handler { # Suppress unused spaces $team_id =~ s/\s+//g; $team_version =~ s/\s+//g; + + + if($team_id == "" || $team_id == $null){ + $team_id = "No data available in table" + } push @{$common->{xmltags}->{TEAMVIEWER}}, { diff --git a/agent/Windows/teamviewer.ps1 b/agent/Windows/teamviewer.ps1 new file mode 100644 index 0000000..d36f63f --- /dev/null +++ b/agent/Windows/teamviewer.ps1 @@ -0,0 +1,45 @@ +<# + .SYNOPSIS + This script retrieves TeamViewer's ClientID and Version from the registry + and outputs the result in an XML format. + + .DESCRIPTION + It considers both 32-bit and 64-bit OS architectures. +#> + +$xml = $null + +# Declare the registry path +$regPath = "" + +# Initialize the registry path based on the architecture +if(Test-Path "HKLM:\SOFTWARE\WOW6432Node\TeamViewer") +{ + $regPath = "HKLM:\SOFTWARE\WOW6432Node\TeamViewer" +} +if(Test-Path "HKLM:\SOFTWARE\TeamViewer") +{ + $regPath = "HKLM:\SOFTWARE\TeamViewer" +} + +if (Test-Path $regPath) +{ + # Try to get TeamViewer ClientID from the registry + $teamViewer = (Get-ItemProperty -Path $regPath) | ForEach-Object { + $xml += "`n" + $xml += ""+ $_.Version +"`n" + $xml += ""+ $_.ClientID +"`n" + $xml += "`n" + } +} + +# just in case +if($xml -eq $null) { + $xml += "`n" + $xml += "" + "No data available in table" + "`n" + $xml += "`n" + $xml += "`n" +} + +[Console]::OutputEncoding = [System.Text.Encoding]::UTF8 +[Console]::WriteLine($xml) diff --git a/agent/Windows/teamviewer.vbs b/agent/Windows/teamviewer.vbs index 751a119..89a164c 100644 --- a/agent/Windows/teamviewer.vbs +++ b/agent/Windows/teamviewer.vbs @@ -1,46 +1,50 @@ -'---------------------------------------------------------- -' Plugin for OCS Inventory NG 2.x -' Script : Retrieve Teamviewer ID and version -' Version : 2.00 -' Date : 22/07/2017 -' Authors : Valentin DEVILLE and Stéphane PAUTREL (acb78.com) -'---------------------------------------------------------- -' OS checked [X] on 32b 64b (Professionnal edition) -' Windows XP [X] -' Windows Vista [X] [X] -' Windows 7 [X] [X] -' Windows 8.1 [X] [X] -' Windows 10 [X] [X] -' Windows 2k8R2 [X] -' Windows 2k12R2 [X] -' Windows 2k16 [X] -' --------------------------------------------------------- -' NOTE : No checked on Windows 8 -' --------------------------------------------------------- -On Error Resume Next - -Set shell = WScript.CreateObject("WScript.Shell") -Set objWMIService = GetObject( "winmgmts://./root/cimv2" ) -Set colItems = objWMIService.ExecQuery( "SELECT * FROM Win32_Processor", , 48 ) - -For Each objItem in colItems - ArchiOS = objItem.AddressWidth - If ArchiOS = "32" Then - Wow = "" - ElseIf ArchiOS = "64" Then - Wow = "WOW6432Node\" - End If -Next - -stReg = "HKEY_LOCAL_MACHINE\SOFTWARE\" & Wow & "TeamViewer\" -Check = shell.RegRead(stReg) -If Err.Number <> 0 Then Wscript.quit - -twID = shell.RegRead (stReg & "ClientID") -twVersion = shell.RegRead (stReg & "Version") - -Wscript.Echo _ - "" & VbCrLf &_ - "" & twID & "" & VbCrLf &_ - "" & twVersion & "" & VbCrLf &_ - "" +'---------------------------------------------------------- +' Plugin for OCS Inventory NG 2.x +' Script : Retrieve Teamviewer ID and version +' Version : 2.00 +' Date : 22/07/2017 +' Authors : Valentin DEVILLE and Stéphane PAUTREL (acb78.com) +'---------------------------------------------------------- +' OS checked [X] on 32b 64b (Professionnal edition) +' Windows XP [X] +' Windows Vista [X] [X] +' Windows 7 [X] [X] +' Windows 8.1 [X] [X] +' Windows 10 [X] [X] +' Windows 2k8R2 [X] +' Windows 2k12R2 [X] +' Windows 2k16 [X] +' --------------------------------------------------------- +' NOTE : No checked on Windows 8 +' --------------------------------------------------------- +On Error Resume Next + +Set shell = WScript.CreateObject("WScript.Shell") +Set objWMIService = GetObject( "winmgmts://./root/cimv2" ) +Set colItems = objWMIService.ExecQuery( "SELECT * FROM Win32_Processor", , 48 ) + +For Each objItem in colItems + ArchiOS = objItem.AddressWidth + If ArchiOS = "32" Then + Wow = "" + ElseIf ArchiOS = "64" Then + Wow = "WOW6432Node\" + End If +Next + +stReg = "HKEY_LOCAL_MACHINE\SOFTWARE\" & Wow & "TeamViewer\" +Check = shell.RegRead(stReg) +If Err.Number <> 0 Then Wscript.quit + +twID = shell.RegRead (stReg & "ClientID") +twVersion = shell.RegRead (stReg & "Version") + +If twID = "" AND twVersion = "" Then + twID = "No data available in table" +End If + +Wscript.Echo _ + "" & VbCrLf &_ + "" & twID & "" & VbCrLf &_ + "" & twVersion & "" & VbCrLf &_ + "" \ No newline at end of file