Powershell: Get Computer Configuration

I’m a great fan of the Belarc Advisor. This system profiler gives you an extensive inventory of just about anything you need to know about your computer. One exception is the kind of memory that is installed. (It will tell you how much is installed, and how many free slots you may have if any). The free version of Belarc is for personal use only; use on a corporate, educational or corporate network requires a license. So, it may be of interest to look at Powershell’s capability for returning information about computers.

My use-case is memory information.  I’ve got a slow machine that I think may be slow due to the fact that it only has limited memory. Of course, you can find the amount of installed memory of a machine using the Control Panel ->System applet.    Screenshot_060915_090137_AM

The down and dirty about the memory can be obtained by querying the Windows Management Instrumentation (WMI), a database of objects which are related to the Windows operating system. To restrict this to a memory query, you simply specify memory object.

Get-WMIObject CIM_PhysicalMemory

To make a long story short, this call will provide a host of information abou the physical memory chips that are installed in the machine. You can restrict the information by choosing which of the fields you actually want to see, by putting the call in the form of a SQL query.

This call duplicates the line above….returning everything available about the installed memory.

GetWMIObject -query "Select * from  CIM_PhysicalMemory"

This call returns a subset of the memory information. First the select statement gets all of the memory attributes (fields), and then the output is piped to the Format-Table cmdlet, specifying just the fields we want to appear in the table.  The -auto attribute will format field widths of the table, so the information for each record appears on one line.

Get-WmiObject -query "Select * from CIM_PhysicalMemory" | 
Format-Table name, capacity, datawidth,speed, manufacturer, devicelocator, partnumber -auto

Screenshot_060915_094312_AM

Caveat: Everything above was run on my Windows 7 machine. I also tried running this on the Windows 10 preview running in a VirtualBox VM, and didn’t get any response. I don’t know if this is related to Windows 10,  the fact that it is still a preview…  or that it is running in VirtualBox.

References & Thanks:
http://www.computerperformance.co.uk/powershell/powershell_wmi_memory.htm
https://msdn.microsoft.com/en-us/library/aa394347%28v=vs.85%29.aspx

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s