title: Unable to Access [Guest] metrics using Get-AzureRmMetric
body: <p>I have guest-level metrics enable for an Azure Virtual Machine and am trying to get the history for the <strong>[Guest]\Memory\Committed Bytes</strong> property using <code>Get-AzureRMMetric</code>.</p>
  
  <pre><code>$endTime = Get-Date
  $startTime = $endTime.AddMinutes(-540)
  $timeGrain = '00:05:00'
  $metricName = '\Memory\Committed Bytes'
  
  
  $history=(Get-AzureRmMetric -ResourceId $resourceId `
  -TimeGrain $timeGrain -StartTime $startTime `
  -EndTime $endTime `
  -MetricNames $metricName)
  
  $history.data | Format-table -wrap Average,Timestamp,Maxiumim,Minimum,Total
  </code></pre>
  
  <p>I get the following error:
  <a href="https://i.stack.imgur.com/z1jhk.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/z1jhk.jpg" alt="enter image description here"></a></p>
  
  <p>This code works fine if I change the <code>$metricname</code> to any of the host metrics ("Percentage CPU" for example), but I need to get the memory information.  </p>
  
  <p>Note:  This is in PowerShell 5.1, I've found that I can use almost the same code (<code>$history.metricvalues</code> rather than <code>$history.data</code>) in PowerShell v3 and I can get to the <strong>[Guest]</strong> metrics there, but not any of the host metrics.</p>
  
  <p><a href="https://i.stack.imgur.com/qT5HN.jpg" rel="nofollow noreferrer">Powershell v3 example</a></p>