PowerShell Hardware Inventory Script

Scenario:PowerShell hardware Inventory Script.Have you ever wanted to have an inventory without the hassle of going to each finding the information needed to fill the information for your inventory? It is important to keep your inventory up to date. Every time there is a change y

10,375 times
Add to favorites
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question

  • Feedback
    1 Posts | Last post October 04, 2019
    • Hi - Thanks for the script.  I ran it and kept only getting Computer Name, Operating system, and Service Pack. After debugging I found the 1st computer in $AllComputersNames didn't exist and so $Connection was false.  This resulted in the 1st entry into $Inventory to only have 3 columns ("Name","OperatingSystem","ServicePack"). Even though the remaining machines were online, the only details added to $Inventory was "Name","OperatingSystem","ServicePack".    Line 98 (Get-CimInstance Graphics) and Line 100 (Get-CimInstance Sound) are also missing "-ComputerName $ComputerName". 
  • I made some updates.
    1 Posts | Last post March 22, 2019
    • I went and made some updates to your script. Up to you if you want to back port the changes. 
  • Modifying for Inventory of a list of computers
    1 Posts | Last post January 30, 2019
    • SConstantnou - This script is excellent and I thank you for taking the time to do this and making it available to the public.  I'm looking for this same information on computers which I support.  If I run this script against all computers in our AD it would be over 20,000.  The computers I support are a sub-set of these (about 150) and I have a list of them (host name and IP).  I found another script online that does a scan from a "known list" of computers but it's not as inclusive as what you have here.  I'm still learning PowerShell and trying to weed my way between your script and the other one I have to see if I can compile something that will be inclusive as well as run from a list.  My goal is to do as much as I can with this (learning process).  Are there any hint / starters you can provide to get me heading down the right path in regards to do the inventory against a list of computers instead of the entire AD?  Thank you.
  • Error loops ?
    2 Posts | Last post January 24, 2019
    • Hi there SConstantinou. Thanks for taking the time to upload this script. it didnt work for me though :-(
      2 errors found in the code. The first is corrected when creating the folder C:\Scripts_Output\. Maybe your could put a line in there "if it doesnt exist, create it"
      The second error is:
      Get-ADComputer : The term 'Get-ADComputer' is not recognized as the name of a cmdlet, function, script file, or
      operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
      At line:1 char:17
      + $AllComputers = Get-ADComputer -Filter * -Properties Name
      +                 ~~~~~~~~~~~~~~
          + CategoryInfo          : ObjectNotFound: (Get-ADComputer:String) [], CommandNotFoundException
          + FullyQualifiedErrorId : CommandNotFoundException
       I havent found a fix for yet. meaning that an empty inventory.xls file is created.
    • Dear mankboy,
      Sorry for the late reply.
      Regarding the first error you found I will check it out. Regarding your second issue, you can either run the script from your domain controller or add the below line above declaration of $Inventory and below param
      Import-Module ActiveDirectory
      Let me know if this solved your issue.