cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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.

(3) Replies
mfranz
By Level 17 Champion
Level 17 Champion

Hi,

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.

Best regards,

Markward

@mfranz 

I have created update statement as below.

update ComplianceComputer
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 ?

Hi,

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.

2020-09-16_12h33_47.png

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.

Best regards,

Markward