{"id":5071,"date":"2021-11-12T10:21:39","date_gmt":"2021-11-12T10:21:39","guid":{"rendered":"https:\/\/lgildv5i97.onrocket.site\/answers\/?post_type=question&#038;p=5071"},"modified":"2021-11-12T10:22:05","modified_gmt":"2021-11-12T10:22:05","slug":"batch-file-subnet-script","status":"publish","type":"question","link":"https:\/\/computing.net\/answers\/programming\/batch-file-subnet-script\/21668.html","title":{"rendered":"Batch File Subnet Script"},"content":{"rendered":"<p>My group has been tasked to locate a large amount of computers on our company network.<\/p>\n<p>right now the standard they are using is just calling clients asking them where the PCs are. It&#8217;s a headache becuase 50% of the clients called don&#8217;t know.<\/p>\n<p>I&#8217;m trying to put togther a windows script that will<br \/>\n1. Ping computername and resolve the ip address.<br \/>\n2. use the ip address and compare it to know subnets on out company network to find out what subnet it is on.<\/p>\n<p>I have a list of subnets that my company uses.<br \/>\nexample:<br \/>\n&#8212;&#8212;&#8212;&#8212;<br \/>\nNetwork:Downtown Building B<br \/>\n141.179.234.0\/23<br \/>\n&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>NOW..my questions.<\/p>\n<p>What type of formula would I use to find out what subnet a particular IP address is on ?<\/p>\n<p>At my disposal:<br \/>\n1. host IP address<br \/>\n2. Subnet mask of host<br \/>\n3. A list of known subnets used by our company.<\/p>\n<p>Thanks in advance for any advice =T<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"iawp_total_views":1},"question-category":[55],"question_tags":[],"class_list":["post-5071","question","type-question","status-publish","hentry","question-category-programming"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question\/5071","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question"}],"about":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/types\/question"}],"author":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/comments?post=5071"}],"wp:attachment":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/media?parent=5071"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question-category?post=5071"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question_tags?post=5071"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}