如何用哈希表筑巢表,然后查询第二个表
以下是大脚本的摘要。我要通过所有收集几个规格的服务器,然后检查每个服务器的客户端变更率,如果它们超过10个,那么该条目将在该服务器中记录使用其客户端名称($ $ entity
),并且具有更改($ changeratePCT
)。
$allservers = @{}
foreach ($server in $allservers){
if ($server -notin $allervers.keys){
$allservers[$server]= @{}
$allservers[$server]['changerate']= @{}
}
$allservers[$server]['CPU']= $cpu
$allservers[$server]['mem'] = $memory
if ($changeRatePct -gt 10) {
if ($entity -notin $allservers[$server]['changerate'].keys ) {
$allservers[$server]['changerate'][$entity] = @{}
$allservers[$server]['changerate'][$entity]['changeRatePct'] = $changeRatePct
}
}
}
脚本不填充变更率。我的另一个问题如何从每个服务器中获取客户名称的价值及其更改率,如果我通过循环循环,如下所示
$allservers.GetEnumerator()| Sort-Object { $_.name}| ForEach-Object {
????
}
Below is snippet from big script . I am going thru all servers collecting few specs then checking each servers's client change rate , if they are more than 10 then that entries to be record in that server with their client name ($entity
) and with change($changeratepct
).
$allservers = @{}
foreach ($server in $allservers){
if ($server -notin $allervers.keys){
$allservers[$server]= @{}
$allservers[$server]['changerate']= @{}
}
$allservers[$server]['CPU']= $cpu
$allservers[$server]['mem'] = $memory
if ($changeRatePct -gt 10) {
if ($entity -notin $allservers[$server]['changerate'].keys ) {
$allservers[$server]['changerate'][$entity] = @{}
$allservers[$server]['changerate'][$entity]['changeRatePct'] = $changeRatePct
}
}
}
Script not populating change rate. my other question how to get value of client name and their change rate from each server if I am looping thru as shown below
$allservers.GetEnumerator()| Sort-Object { $_.name}| ForEach-Object {
????
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论