Server Inventory Script

August 5th, 2009 by Steve Leave a reply »

As a consultant, many times I need to quickly gain information about the Windows servers in an environment. I’ve finally put something together to try and make my life easier. It is a script that opens Microsoft Excel, sets column definitions that seem useful to me, then populates the spreadsheet with a bunch of data.  The data is gathered from every Windows server that is a member of the Active Directory domain you specify.  Specifically, it gathers:

  1. Server Name
  2. Whether the server is online (ping’able) or not
  3. OS
  4. Service Pack
  5. Manufacturer
  6. Model
  7. Serial Number
  8. Whether it is a domain controller
  9. Whether it is a DNS server
  10. Whether it is a DHCP server
  11. Whether it is a WINS server (yes there are still a few of those)
  12. Whether it is a MSCS cluster node
  13. Whether it is an Exchange server
  14. What applications are installed (excluding Security Updates and Hotfixes)
  15. Whether WMI could be connected to

Dependencies

  • Microsoft Excel (any later version is fine)
  • Sysinternals PSTools
  • Admin rights on every server in the domain (Domain Admin rights would be easiest)

I wanted to use WMI exclusively but unfortunately it is very unreliable, therefore the script heavily depends on 2 PSTools (PSInfo and PSService).  You will need to download those and place them in a directory on the PC you run the script from.

Edits

The only lines you need to edit are 15 and 16, where you enter in your domain name (follow the format example!) and the path to your PSTools directory.

'your domain below
strDom = "DC=ACME,DC=COM"
pstoolsPath = "c:\Tools\pstools"

You can download the text of the script here or a zip file with the script here.  I hope others find it helpful.  As always, use this solution at your own risk.  If you have problems with the script, comment on the post and I will help when I have time.

Advertisement

3 comments

  1. Joe Stocker says:

    Great job Steve – this is very helpful!!

  2. Kenny says:

    work just fine even with 2008 servers.
    Good job, steve

Leave a Reply