命令Test-Cluster
正在生成xml和htm文件的输出。
$v = test-cluster -Node w16-sqlcA,w16-sqlcB -Include "Storage" -Force -Disk $csv -Verbose
似乎只能通过解析xml获得详细结果。我必须获取活动的名称和结果,就好像它显示在下面的htm文件中一样。
有没有内置的获取方式? (或者已经为测试集群结果编写了解析器?我搜索并找不到)。请帮忙。
答案 0 :(得分:0)
运行测试时,将在C:\ Windows \ Cluster \ Reports中生成包含结果的xml文件
您可以使用此功能检查多少个测试具有特定结果状态
function Get-ClusterValidationResultCount
{
param(
[Parameter(Mandatory = $true)]
[ValidateSet('Failed','Warning','Success','Not Applicable', 'Canceled')]
[String]
$Status
)
$validationFile = (Get-ChildItem C:\Windows\Cluster\Reports -Filter "Validation Data*.xml" | Select -First 1).FullName
if ([string]::IsNullOrEmpty("$validationFile")) {
throw "No validation xml found"
}
$results = Select-Xml -Path "$validationFile" -XPath "//ResultDescription" | Where-Object { $_.Node.Value."#cdata-section" -eq $Status }
return $results.Count
}
Get-ClusterValidationResultCount -Status Failed