Calculate directed broadcast address, specified IP address and subnet in PowerShell
My goal is to calculate the address of a directed broadcast when given the IP mask and subnet masks of the host node. I know it sounds like homework. When I discussed my problem and reduced it to this, I was surprised at myself. In any case, the solution will look something like the one in this question . I suppose, but I'm not a mathematician and my C sucks. I could do with PowerShell (preferred) or C # example to get me going.
thanks!
a source to share
See here for some PowerShell functions for IP math, including for calculating a broadcast address. The problem with using direct computation -bNot
to compute is that it returns a signed int64 which type randomly performs any bitwise operations that need an unsigned representation of the number.
a source to share