Need script on getting the RAM details

Welcome Forums General PowerShell Q&A Need script on getting the RAM details

Viewing 3 reply threads
  • Author
    Posts
    • #259759
      Participant
      Topics: 11
      Replies: 8
      Points: 26
      Rank: Member

      Hi Fellas,

      I need to extract the RAM details in a formatted csv file.

      I am using this

      function RAMINFO{
      $memory = (get-Counter -ListSet memory).paths
      Get-Counter -Counter $memory -SampleInterval 1
      }
      RAMINFO

      This shows me all the counters.. I need just the basic ones ( the ones that shows on the task manager console – Commit, In Use, pages, Total, Non Paged)
      Can someone help me extracting the details in a CSV..

    • #259765
      Senior Moderator
      Topics: 9
      Replies: 1373
      Points: 5,061
      Helping Hand
      Rank: Community MVP

      You can have a look at wmi classes win32_physicalmemory. Use Get-CimInstance cmdlet to explore the class.

      • This reply was modified 3 weeks, 6 days ago by kvprasoon. Reason: post correction
    • #259780
      Participant
      Topics: 11
      Replies: 8
      Points: 26
      Rank: Member

      I have checked the details from the class but not getting an  option of getting the details like Paged Memory, Non Paged Memory, In Use, Commit Memory
      I need these in  a csv format with appropriate headings.

      If you have a script, please share

    • #259810
      Senior Moderator
      Topics: 10
      Replies: 184
      Points: 980
      Helping Hand
      Rank: Major Contributor

      If you want information on both physical and virtual memory you’ll have to collect it from multiple places. Virtual memory is a logical device for the operating system (as opposed to a physical device). You can get details on the pagefile from the Win32_PageFileUsage class and use Select-Object to get specific pieces, such as:

      To get your CSV, you could collect the specific pieces of information that you want, store them in a custom object with the labels that you want, and then use Export-Csv.

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