Although knowing the operating systems running in a network is becoming more and more important (mainly for security reasons), current operating system discovery tools are not sufficiently accurate to acquire the information in a fully automated way. Many design choices explain this lack of accuracy, but they all come down to a poor knowledge representation scheme. In this paper, we study how answer set programming can be used to guide the design of a knowledge-oriented operating system discovery tool. The result is significantly more accurate than today's state of the art tools.