使用PowerShell标识以RD*开头的实例名称

使用PowerShell标识以RD*开头的实例名称,powershell,azure-powershell,Powershell,Azure Powershell,我正在尝试查找所有超出阈值限制的Azure实例。我的系统检测到了这些实例,现在我想从文本中提取所有机器并采取行动。我只有PowerShell作为一个选项来标识以下文本中以RD*开头的所有实例 {DescriptionEntryId=343578460; 问题: 已为此xxxxxx的59个不同实例触发xxxxxx 描述:设置此项以识别问题验证:警告RDXXXXXXXX在15分钟内达到阈值(2)。评估窗口期间的数据点范围在2.393和6.054之间。RDXXXXXXXX达到阈值(2)满足时间为15分

我正在尝试查找所有超出阈值限制的Azure实例。我的系统检测到了这些实例,现在我想从文本中提取所有机器并采取行动。我只有PowerShell作为一个选项来标识以下文本中以RD*开头的所有实例

{DescriptionEntryId=343578460;
问题:
已为此xxxxxx的59个不同实例触发xxxxxx
描述:设置此项以识别问题验证:警告RDXXXXXXXX在15分钟内达到阈值(2)。评估窗口期间的数据点范围在2.393和6.054之间。RDXXXXXXXX达到阈值(2)满足时间为15分钟中的15分钟。评估窗口期间的数据点范围在2.722和6.813之间。RDXXXXXXXXXXXX阈值(2)满足时间为15分钟中的15分钟。评估窗口期间的数据点范围在2.481和5.909之间。RDXXXXXXXXXXXXXXXX阈值(2)在15分钟中的14分钟内达到。评估窗口期间的数据点范围在1.412和6.588之间。RDXXXXXXXXXXXX在15分钟中的15分钟内达到阈值(2)。评估窗口期间的数据点范围在3.375和6.24之间。RDXXXXXXXXXXXXXXXX达到阈值(2)在15分钟中的15分钟内满足。评估窗口期间的数据点范围在2.382和6.863之间。RDXXXXXXXXXXXX在15分钟中的14分钟内满足阈值(2)。评估窗口期间的数据点范围在0.418和11之间。RDXXXXXXXXXXXXXXXX在阈值(2)之间满足时间为15分钟中的15分钟。评估窗口期间的数据点范围在3.059和6.667之间。RDXXXXXXXXXXXX阈值(2)满足时间为15分钟中的15分钟。评估窗口期间的数据点范围在2.255和7.5之间。RDXXXXXXXXXXXXXXXX阈值(2)在15分钟中的15分钟内满足。评估窗口期间的数据点范围在2.545和5.291之间。RDXXXXXXXXXX阈值(2)在15分钟中的14分钟内满足。评估窗口期间的数据点范围在1.691和5.6之间。RDXXXXXXXXXXXXXX阈值(2)在15分钟中的14分钟内满足。评估窗口期间的数据点范围在2到6.755之间。RDXXXXXXXXXX在15分钟中的15分钟内满足阈值(2)
查看有关xxxx被触发原因的其他信息

您似乎正在显示某种HTML报告,并希望使用Powershell解析该报告。对于此解决方案,您需要将报告保存在.HTML文件中

假设您这样做了,并将报告保存到磁盘
D:\report.html
然后你可以做:

# read the report file as string
$htmlReport = Get-Content -Path 'D:\Report.html' -Raw

# create a Regular Expression object to capture the RD machines and their issues
$regex = [regex] '<dt>(?<Name>RD[^<]*)</dt><dd>(?<Issue>[^<]+)</dd>'
$matches = $regex.Match($htmlReport)
while ($matches.Success) {
    New-Object -TypeName PSObject -Property ([ordered]@{ Name = $matches.Groups['Name'].Value; Issue = $matches.Groups['Issue'].Value })
    $matches = $matches.NextMatch()
} 

非常感谢,我会在我的脚本中加入这一点,你推荐任何正则表达式工具来让像我这样的新蜜蜂使用regex变得容易吗?我个人喜欢RegexBuddy,但它不是免费的。网上有很多regex测试人员,比如google for it,你会找到一个你喜欢的。
Name           Issue                                                                                                                       
----           -----                                                                                                                       
RDxxxxxxxxx    The threshold (2) was met for 15 of 15 minutes. The data points during the evaluation window ranged between 2.393 and 6.054.
RDxxxxxxxxx    The threshold (2) was met for 15 of 15 minutes. The data points during the evaluation window ranged between 2.722 and 6.813.
RDxxxxxxxxxxxx The threshold (2) was met for 15 of 15 minutes. The data points during the evaluation window ranged between 2.481 and 5.909.
RDxxxxxxxxxx   The threshold (2) was met for 14 of 15 minutes. The data points during the evaluation window ranged between 1.412 and 6.588.
RDxxxxxxxxxxxx The threshold (2) was met for 15 of 15 minutes. The data points during the evaluation window ranged between 3.375 and 6.24. 
RDxxxxxxxxxx   The threshold (2) was met for 15 of 15 minutes. The data points during the evaluation window ranged between 2.382 and 6.863.
RDxxxxxxxxxxxx The threshold (2) was met for 14 of 15 minutes. The data points during the evaluation window ranged between 0.418 and 11.   
RDxxxxxxxxxxxx The threshold (2) was met for 15 of 15 minutes. The data points during the evaluation window ranged between 3.059 and 6.667.
RDxxxxxxxxxxxx The threshold (2) was met for 15 of 15 minutes. The data points during the evaluation window ranged between 2.255 and 7.5.  
RDxxxxxxxxxxxx The threshold (2) was met for 15 of 15 minutes. The data points during the evaluation window ranged between 2.545 and 5.291.
RDxxxxxxxxxx   The threshold (2) was met for 14 of 15 minutes. The data points during the evaluation window ranged between 1.691 and 5.6.  
RDxxxxxxxxxxxx The threshold (2) was met for 14 of 15 minutes. The data points during the evaluation window ranged between 2 and 6.755.