Update TeamViewer IDs
I have a custom inventory field set up for TeamViewer IDs. Currently, I use a registry scanner to obtain this and the following query will update the field for computers with existing TeamViewer IDs, but it won't create new ones. How can I get it to create the custom inventory field and then append with the latest ID?
I'd prefer to use PowerShell if possible as updating the database from SQL doesn't seem as wise.
Update CustomComputerValues
Set Value =
(select RegistryEntries.Value
From RegistryEntries
INNER JOIN Computers ON RegistryEntries.ComputerId = Computers.ComputerId
Where RegistryEntries.Name = "ClientID" and CustomComputerValues.ComputerId = RegistryEntries.ComputerId)
Where
CustomComputerValues.CustomComputerItemId = 2
AND
Value <> (select RegistryEntries.Value
From RegistryEntries
INNER JOIN Computers ON RegistryEntries.ComputerId = Computers.ComputerId
Where RegistryEntries.Name = "ClientID" and CustomComputerValues.ComputerId = RegistryEntries.ComputerId)
-
Okay, so I ended up following some advice from Ryan Joachim from Reddit and running it as a tool/deployment instead, which works great.
Code is below for anyone interested. It basically scans the target machine, grabs the TeamViewer ID from the registry then invokes the server to update the custom field in PDQ Inventory.
Please sign in to leave a comment.
Comments
1 comment