PowerShell for Windows Admins

Nov 20 2010   6:59AM GMT

Memory, IRQ and devices

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

One of our most valuable system resources is memory. Back in the day we also used to worry about IRQs as we only had 16 but modern Windows gets round this for us.

If you want to know what memory is being used by which device then try this.  We also get IRQ as a bonus

$source = @"
public class sysirqram  {
public string Memory { get; set;}
public string Device { get; set;}
public string Status { get; set;}
public long IRQ { get; set;}
Add-Type $source -Language CSharpVersion3

$data = @()
Get-WmiObject Win32_DeviceMemoryAddress | foreach {

$name = $_.Name

$query = "ASSOCIATORS OF `
{Win32_DeviceMemoryAddress.StartingAddress=’$($_.StartingAddress)’} `
Get-WmiObject -Query $query | foreach {

  $qirq = "ASSOCIATORS OF {Win32_PnPEntity.DeviceID=’$($_.PNPDeviceID)’} `
  $irqs  = Get-WmiObject -Query $qirq | select IRQNumber -Unique
  $myobject = New-Object -TypeName sysirqram -Property @{
   Memory= $name;
   Device = $_.Name;
   Status = $_.Status;
   IRQ = $irqs.IRQNumber
  $data += $myobject
$data | Format-Table -AutoSize

Define a new class and create it using Add-Type.  We can then start with the Win32_Devicememory class to discover what memory is being used. Thsi can be associated with the Win32_PNPEntity class to get the device which we then associate with Win32_IRQResource to get the IRQ.

Not the simplest of WMI scripts but its logical when you pick it apart

 Comment on this Post

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: