简体   繁体   English

如何在PowerShell上的JSON输出中获取特定值?

[英]How do I get the specific values in a JSON Output on PowerShell?

Get-AzureRmMetric -DetailedOutput -MetricName '\Processor Information(_Total)\% Processor Time'

This is the command and I only want the Average values. 这是命令,我只想要平均值。 How do I extract it? 我如何提取它?

Here is how it looks like on the PS Window. 这是在PS窗口上的外观。 enter image description here 在此处输入图片说明

This question was asked by me yesterday, and while I could not find a direct solution via PowerShell, I did make it work through Visual Studio. 昨天我问了这个问题,尽管我无法通过PowerShell找到直接的解决方案,但确实可以通过Visual Studio使用它。 Here's what I did. 这就是我所做的。

Based on a little bit of tinkering around, I stored the output as a String and then manipulated the string using the ' Regex.Split ' method. 基于一点点修改,我将输出存储为String,然后使用Regex.Split方法处理该字符串。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM