0
我收到以下错误,我不明白为什么或它要求什么。Powershell:Format-Table:非法密钥计数
我想在一个表中显示的对象是:
function newURLObject()
{
# param ([String]$Value, [Int]$Count = "1", [String]$IP)
param ([String]$Value, [Int]$Count = "1")
$obj = new-object PSObject
$obj | add-member -type NoteProperty -Name Value -Value $Value.substring(1)
$obj | add-member -type NoteProperty -Name Count -Value $Count
# $obj | add-member -type NoteProperty -Name IP -Value $IP
return $obj
}
的基本流程如下。
#< Declare Objects>
#< Code to create an array of those objects >
$z = @{Expression={$_.Count};Label="Count";width=5}, @{Expression={$_.Value};Label="URL";count=35}
$y = $listOfRequestedURLs | sort count -descending | select -first 30 | ft $z
Format-Table : Illegal key count
At C:\Temp\parse IIS logs.ps1:231 char:8
+ $y | ft <<<< $z
+ CategoryInfo : InvalidArgument: (:) [Format-Table], NotSupportedException
+ FullyQualifiedErrorId : DictionaryKeyIllegal,Microsoft.PowerShell.Commands.FormatTableCommand
我知道这些值在数组中;但它不会正确显示。如果我在没有格式表的情况下显示它,值字段只显示为空。
Err ..对不起,因为密集,但我不明白你与粗体的区别。 – Robert
有效的键名是:Expression,FormatString,Label/Name,Width和Alignment。显然伯爵不是其中之一。 –
深度也是一个有效的密钥名称。 –