Important Notice: On February 29th, this community was put into read-only mode. All existing posts will remain but customers are unable to add new posts or comment on existing. Please feel to join our Community Discord for any questions and discussions.

Using Scanned Data as Variable in a Tool

Is there a way to use the content of scanned data as a Variable in a Tool (something like $(Registry:\HKLM\Software\...) or $(Computer:RAMSize))?

 

I've build a Scan that reads the TeamViewer ClientId's from computers. I've then added a Tool that calls TeamViewer with the Id from that the selected computer and the predefined password we use for all user installations in our company. The problem was getting the specific ClientId.

I solved this by using an sqlite query to the inventory database (and a big thanks! to PDQ for using an easily understandable schema for that ...unlike say sharepoint or the typical oracle based software), read that into an environment variable and supplied that var as teamviewer commandline parameter.

 

This works perfectly for me and I like that I can't access pretty much any collected information this way, but I somehow feel that writing sql queries might not be everyone's favorite thing...

 

In case someone is interested these are the Registry Paths for the 64/32bit TeamViewer Id's used in the scan:

HKLM\Software\Wow6432Node\TeamViewer\ClientID
HKLM\Software\TeamViewer\ClientID

and this is the tool command:

for /f %%i in ('sqlite3 "C:\ProgramData\Admin Arsenal\PDQ Inventory\Database.db" "select ifnull(e6.Value, e3.Value) from Computers as c left outer join RegistryPaths as p6 on p6.Hive='HKEY_LOCAL_MACHINE' and p6.PathName='SOFTWARE\Wow6432Node\TeamViewer' left outer join RegistryPaths as p3 on p3.Hive='HKEY_LOCAL_MACHINE' and p3.PathName='SOFTWARE\TeamViewer' left outer join RegistryEntries as e6 on e6.ComputerId=c.ComputerId and e6.RegistryPathId=p6.RegistryPathId and e6.Name='ClientID' left outer join RegistryEntries as e3 on e3.ComputerId=c.ComputerId and e3.RegistryPathId=p3.RegistryPathId and e3.Name='ClientID' where c.Name='$(Computer:TARGET)'"') do set ClientID=%%i
@"C:\Program Files (x86)\TeamViewer\TeamViewer.exe" -i %ClientID% -P "<PREDEFINED-PWD>"

You might want to replace the sqlite3 and TeamViewer binary path with your own paths and insert your own predefined passwort.

1

Comments

1 comment
Date Votes
  • The sentence:

    [...] and I like that I can't access pretty much any [...]

    should actually read:

    [...] and I like that I can access pretty much any [...]

    -1