I am writing a Powershell script to determine if a machine is on the corporate network. The machine may or may not be on the domain, so I want to check at "IP" level.
Have written something to check by pinging a couple of servers on a couple of different subnets (to get around the risk of someone being on another (external) subnet with a host on the same IP.)
Works, but it's a bit slow, and not especially "future-proof" - e.g. in 2 years time when I decomission the server it'll break.
Is there a way I can use the dns suffix being given by the local dhcp server?
Just direct me what I need to check - I can figure out the script.