我知道其他人已经发布了有关此内容的信息,但是到目前为止,我尝试过的每件事都没有用。我遇到的问题是,当我在Where-Object语句周围添加方括号时,它将把我试图过滤的列转换为函数。因此不允许它运行。
$AgentList | Select-Object Leaf.NodeName, Properties.OSType, PropsView.version, BranchNode.Node | Where-Object{ (PropsView.version -lt '5.5.0.447') -and (Properties.OSType -ne 'Mac OS X')} | Sort-Object -Property EPOBranchNode.NodeTextPath2 -Descending
我希望能够同时对PropsView.version和Properties.OSType进行过滤。目前,我可以做一个或另一个,但是当我尝试同时添加两者时,我遇到了错误。
The term 'PropsView.version' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
答案 0 :(得分:1)
$AgentList | Select-Object Leaf.NodeName, Properties.OSType, PropsView.version, BranchNode.Node | Where-Object{ ($_.'PropsView.version' -lt '5.5.0.447') -and ($_.'Properties.OSType' -ne 'Mac OS X')} | Sort-Object -Property EPOBranchNode.NodeTextPath2 -Descending
只需添加$ _。然后在我要排序的列两边加上单引号。我没有添加的单引号使我感到困惑。谢谢大家的帮助!