WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

How To
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Get Network Address Using IP Address and Subnet mask


We had a need to get the network address on windows based systems to use when querying sites in services in Active Directory. We have used output from "route.exe print" and also IP4RouteTable in wmi. However, found a really easy way to get this info based on the IP and Subnet.
;Get network address using ip address and subnet mask
;Created by EvanJHoush   
IPAddress = "???.???.???"
IPSubnet = "???.???.???"

aIP = Arrayize(IPAddress,".") 
aSNM = Arrayize(IPSubnet,".") 
NetworkAddress = '' 
;Simple ANDing will give us the NETWORK ID 
For i = 0 to 3 
       NetworkAddress = ItemInsert((aIP[i] & aSNM[i]),-1,NetworkAddress,".") 
Next 
Message(Network address",networkaddress)
exit

Article ID:   W15977
File Created: 2004:03:30:15:42:06
Last Updated: 2004:03:30:15:42:06