这有效:
Output "Cluster Group: ""$($Group.Name)"", Current Owner: $($Group.OwnerNode), Current State: $($Group.State)"
这不起作用:
Output "Cluster Group: ""$($Group.Name)"", Current Owner: $($Group.OwnerNode.ToUpper()), Current State: $($Group.State)"
有一个错误:
Method invocation failed because [Microsoft.FailoverClusters.PowerShell.ClusterNode] doesn't contain a method named 'ToUpper'.
有关如何将此字符串从Get-ClusterGroup字符串的输出变为大写的任何想法?谢谢!
ToUpper()是一个字符串方法,OwnerNode可能不是字符串.在调用ToUpper()之前调用ToString()方法.
$($Group.OwnerNode.ToString().ToUpper())
正如Shay Levy已经解释的那样,OwnerNode
它不是一个字符串,因此不是一种方法ToUpper()
.你可以打电话ToUpper()
给它的Name
财产:
$($Group.OwnerNode.Name.ToUpper())