This is very crass and simplified, and frankly, other programs (such as Angry IP and (my personal favorite) NMap) do a much, much better job; however, if you need to do a scan in a script for whatever reason, this may do the trick. It would be very easy to make any changes to this you'd like, such as leaving out DNS resolution, or swapping it for a WMI query, or adding just about anything else you want. This is just a quick, dirty example, and as such, it doesn't have a lot of polish. (Note: as-is, this code requires Windows 8 due to Resolve-DnsName not being included in prior versions)
If you want to run this on Windows 7, here are two methods of resolving DNS names that work:
Using .NET methods (my preference):
Windows PowerShell One Liner: Name to IP Address
Using nslookup (more work to get the output you want, but always a good tool):
PowerShell v2 And DNS Queries