Windows System Inventory Script with powershell

I have designed this script to build a system inventory in windows. This script collects windows system information and writes it to an excel file. It first checks the connectivity to the servers, and if it is working, it pulls data from the servers. GUI dialog boxes are added

3.8 Star
14,943 times
Add to favorites
Operating System
E-mail Twitter Digg Facebook
Sign in to ask a question

  • Apps and Hotfix
    3 Posts | Last post November 17, 2015
    • Out of curiosity why use the registry instead of WMI for the applications? The origination (Credit Union) I work for has remote registry disabled in windows firewall as well as the last place I worked for which was a community college. Also why a csv for the hotfixes? Other than that great job/great script this can save a lot of time if you don't have software like LanSweeper to work with.
      I like to use AD for the list of computers to scan. I usually add something like:
      Get-ADComputer -Filter * | sort Name | select -ExpandProperty Name | out-file "C:\Yourfile.txt"
    • Excuse me for late reply.. I tried with gwmi command like win32_product, but it first checks what are the installed softwares, executes their msi files, then checks if everything is correct, then gets the value of that software. This would take a very long time. If you have long list of server names, you have to wait for very long time.Moreover, win32_product worked in xp and in 2003 it didnt. I have used powershell 3, and some cmdlets doesnt work with earlier versions of os. So, i thought lets try with old school method and make this script.
    • great Job building this script, however by using the registry you miss vital information regarding installed products, for instance, on my computer I have Office Professional Plus 2013 and the registry does not recognize this, instead it just says I have Microsoft Office 64-bit Components 2013,If you mix the win32_product class using the Caption information it will be a lot more precise.
      Other than that congratulations!
  • You cannot call a method on a null-valued expression
    4 Posts | Last post April 08, 2015
    • I get this error for each server in my text file:
      Processing server SERVERA
      You cannot call a method on a null-valued expression.
      At C:\MyScripts\Windows System Inventory.ps1:350 char:2
      +  $sheet4.Cells.Item($misc1row,$misc1column) = $computer
      +  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
          + FullyQualifiedErrorId : InvokeMethodOnNull
      Same error for:
      At C:\MyScripts\Windows System Inventory.ps1:352 char:1
      + $sheet4.Cells.Item($misc1row,$misc1column) = $timezone
      At C:\MyScripts\Windows System Inventory.ps1:354 char:2
      +  $sheet4.Cells.Item($misc1row,$misc1column) = $standardname
      At C:\MyScripts\Windows System Inventory.ps1:356 char:2
      +  $sheet4.Cells.Item($misc1row,$misc1column) = $bootconfig
      At C:\MyScripts\Windows System Inventory.ps1:358 char:2
      +  $sheet4.Cells.Item($misc1row,$misc1column) = $admins
      At C:\MyScripts\Windows System Inventory.ps1:363 char:1
      + $usedRange3.EntireColumn.AutoFit() | Out-Null
      At C:\MyScripts\Windows System Inventory.ps1:391 char:1
      + $sheet6.Cells.Item($serverCount123,1) = "$computer"
      At C:\MyScripts\Windows System Inventory.ps1:400 char:2
      +  $sheet6.cells.item($sheet6row,$sheet6column) = "Not Configured"
      At C:\MyScripts\Windows System Inventory.ps1:405 char:1
      + $usedrange5.entirecolumn.autofit() | Out-Null
    • Hi,
      can you post the output of the below commands while executing the script? I tried in my machine and it worked without a single error. Do you have admin access on the remote server (SERVERA)?
      $misc = Get-CimInstance -ClassName win32_TimeZone -CimSession $Session
      $timezone = $misc.caption
      $standardname = $misc.StandardName
      $bootconfig = (Get-CimInstance -ClassName Win32_BootConfiguration -CimSession $Session).ConfigurationPath
    • see email:, thanks
    • Two additional worksheets need to be added. Add the following lines at line 72:
      $workbook.Worksheets.Add() | Out-Null
      $workbook.Worksheets.Add() | Out-Null
  • Similar inventory script for Servers Win2K3 and above
    2 Posts | Last post July 30, 2014
    • Dear Chaitanya,
      You script is excellent, however I noticed that it requires Powershell v3.0 and also WINRM on remote servers. Is there any similar scripts to get all inventory from all remote servers running with Win2K3 and above. I need to execute such script from Windows 2008 server with Powershell v2.0.
      Thanks in advance,
    • Hi Shashi,
      I dont have script ready with posh 2 for 2008.