One more interesting task is to explore local network and check which computers are alive.
As a first step we need to get a list of computers which registered in Active Directory (as you understand, this approach works only for networks with Active Directory). Here we can use DirectorySearcher from System.DirectoryServices namespace. We create DirectoryEntry that by default points to the current domain and makes search over computers in this domain.
The next step is to check the availability of computers. F# Asynchronous Workflows help us here. We make a sequence of ping-calls(up to 4) to each computer which allows us to understand if computer is available or not. We are expecting to get a valid response with IPStatus.Success status. If we get an exception instead of response or run out of attempts, we will mark this computer as unavailable.
Now we are ready to get a list of available computers.
Play with your…
View original post 6 more words