Computers inventory

Welcome Forums General PowerShell Q&A Computers inventory

  • This topic has 8 replies, 4 voices, and was last updated 1 month ago by
    Participant
    .
Viewing 8 reply threads
  • Author
    Posts
    • #186661
      Participant
      Topics: 1
      Replies: 3
      Points: 26
      Rank: Member

      Hello,

      I'm new to this forum (actually just registered) and I need some help.

      I'm new to PowerShell but I was able to get partial information of what I want and putting them all together does not seem possible for my level of knowledge.

      Basically, I would like to generate a csv file with the following information per computer on the network (or Get-Content from a  text file).

      ComputerName, CurrentlyLoggedOnUser, OS (Win 7/10), PhysicalDiskSize (GB), TotalPhysicalMemory (GB), CPU Type (i5/i7), Dell Service Tag as well, since all of our computers/laptops are Dell.

      Could someone please help me with that?

       

      Thank you in advance,  🙂

       

    • #186691
      Senior Moderator
      Topics: 8
      Replies: 1141
      Points: 3,928
      Helping Hand
      Rank: Community Hero

      You are at the right place !

      These were all time requirements in the industry and already been solved. Below link will help you to get started.

      https://gallery.technet.microsoft.com/Windows-System-Inventory-9b27593e

      There are many such scripts in the public network 🙂

    • #186736
      Participant
      Topics: 3
      Replies: 137
      Points: 721
      Helping Hand
      Rank: Major Contributor

      https://gallery.technet.microsoft.com/Windows-System-Inventory-9b27593e

      Thanks @kvprasoon. This is very sophisticated.

      @85xlt75 – Precise to your requirement, you can use the script below...

    • #186778
      Participant
      Topics: 10
      Replies: 1284
      Points: 1,084
      Helping Hand
      Rank: Community Hero

      As kvprasoon said, this is one of most common tasks and most books use this example to create tools in Powershell, so there are basic to advanced scripts that output Powershell or HTML reports.

      @Kiran: Move '$Output = ' in front of foreach ($CN in $ComputerName) to support returning multiple computers.

      $Output = foreach ($CN in $ComputerName)
      
    • #186781
      Participant
      Topics: 3
      Replies: 137
      Points: 721
      Helping Hand
      Rank: Major Contributor

      @kiran: Move '$Output = ' in front of foreach ($CN in $ComputerName) to support returning multiple computers.

      @Rob Simmers, Thanks for pointing it out, I have updated it in the gist. Thank you.

    • #186793
      Participant
      Topics: 1
      Replies: 3
      Points: 26
      Rank: Member

      Hi Kiran,

      I tried your script and although it did not give any error, it did not do anything else either. It just brought me back to the prompt.

      Why would it not show any output?

      Thank you,

    • #186796
      Participant
      Topics: 3
      Replies: 137
      Points: 721
      Helping Hand
      Rank: Major Contributor

      Hi Kiran,

      I tried your script and although it did not give any error, it did not do anything else either. It just brought me back to the prompt.

      Why would it not show any output?

      Thank you,

      It's a function, and you need to call explicitly...

      
      # Now call the function
      
      Get-Inventory -ComputerName comp1,comp2...,compn
      
      

      Thank you.

    • #186808
      Participant
      Topics: 1
      Replies: 3
      Points: 26
      Rank: Member

      Hi kvprasoon,

      I run your script and although it displayed a lot of errors, it did what it was supposed to.

      For testing purposes, I selected only two workstations and it gave me all the requested information except for the currently logged on user.

      Is there a way to add that? You can tell me what to add and where to add it on the script and I will do it then test again.

      Thank you,

       

       

       

    • #186817
      Participant
      Topics: 1
      Replies: 3
      Points: 26
      Rank: Member

      Hi Kiran,

      Still nothing.

      I tried Get-Content from a txt file, I tried Get-Content from a variable and I tried .\Get-Inventory -ComputerName WKS1, SRV1.

      It brought me back to the prompt with no errors and no output.

      Thank you,

Viewing 8 reply threads
  • You must be logged in to reply to this topic.