Device Role based on Subnets
As of now we have update Device Role through Business Adapter. Is there any way to update Device Role based on its Subnet or IP Address ?
We have 2019 R2 on-prem.
This thread has been automatically locked due to inactivity.
To continue the discussion, please start a new thread.
You'll need some kind of logic or mapping, buth with that you can continue using a Business Adapter. You could even hardcode it in SQL, if you like.
SELECT CASE WHEN IPAddress LIKE '%.10.50.%' THEN 'Development' WHEN IPAddress LIKE '%.10.60.%' THEN 'Test' WHEN IPAddress LIKE '%.10.70.%' THEN 'Training' WHEN IPAddress LIKE '%.20.10.%' THEN 'Production' ELSE 'Prodcution' END AS Role FROM ComplianceComputer
Depending on your network, you'll might need to smart up your code a bit.
I have created update statement as below.
set compliancecomputerroleid = '1' where IPAddress like '%172.20.129.%' or IPAddress like '%172.26.9.%'and ComplianceComputerRoleID='7'
How can we hardcode same thing in BusinessAdapter ?
I would just go and use the code as a SELECT statement in a Business Adapter and then have the Business Adapter mechanics update the role for you.
Have it not create computers, but update them. Use the computer name for matching and update the role. You'll need to work with the role values, not IDs.
Or you could go with a "dummy import", doing nothing, but running a SQL script (custom query). This query could then be an update statement.