List Servers, Workstations and Users using PowerShell and AD

I am writing a basic PowerShell script function to list all the servers, workstation and users list in your domain. It will be very helpful if your admin asks you to find the count of the machines installed with specific OS version. Let’s take ex: as Windows Server 2008 R2.