Skip to content

Query based collection based on IP subnet

Featured Replies

Hi!

 

How can i build a query based on a IP sunnet ?

 

Address: 159.171.10.1
Netmask: 255.255.255.128 = 25

Network: 159.171.10.0/25
Broadcast: 159.171.10.127
HostMin: 159.171.10.1

HostMax: 159.171.10.126

 

I have now (but it won't do the job) :

select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_NETWORK_ADAPTER_CONFIGURATION on SMS_G_System_NETWORK_ADAPTER_CONFIGURATION.ResourceId = SMS_R_System.ResourceId where SMS_G_System_NETWORK_ADAPTER_CONFIGURATION.IPAddress >= "159.171.10.1" and SMS_G_System_NETWORK_ADAPTER_CONFIGURATION.IPAddress <= "159.171.10.126"

Any tips, ideas ??

The IP address is a String and not a Number therefore the >= and <= will treat everything as a string. This will produce odd results.

 

For this I would try to look at the gateway, instead of the IP address..

this is what I use for my subnet based collections.

 

select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System where SMS_R_System.IPSubnets in ("10.0.1.0") and SMS_R_System.OperatingSystemNameandVersion like "%workstation%"

  • Author

The IP address is a String and not a Number therefore the >= and <= will treat everything as a string. This will produce odd results.

 

For this I would try to look at the gateway, instead of the IP address..

 

oke, I give it a try! Thanks...

  • Author

this is what I use for my subnet based collections.

 

select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System where SMS_R_System.IPSubnets in ("10.0.1.0") and SMS_R_System.OperatingSystemNameandVersion like "%workstation%"

 

I must test this....thanks !

  • 5 years later...

select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System where SMS_R_System.IPSubnets in ("xx.xx.xx.0") and SMS_R_System.OperatingSystemNameandVersion like "%workstation%"

 

 

This is working thank you 
 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.