Jump to content


johnli

Query based collection based on IP subnet

Recommended Posts

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

Share this post


Link to post
Share on other sites

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..

Share this post


Link to post
Share on other sites

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%"

Share this post


Link to post
Share on other sites

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...

Share this post


Link to post
Share on other sites

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 !

Share this post


Link to post
Share on other sites

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 
 

Share this post


Link to post
Share on other sites

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...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.