0

次のエラーが表示されますが、なぜ、または何を求めているのかわかりません。

テーブルに表示しようとしているオブジェクトは次のとおりです。

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

値が配列内にあることはわかっています。しかし、正しく表示されません。format-table なしで表示すると、値フィールドは空として表示されます。

4

1 に答える 1

6

不正なフォーマット キー名があります。削除します (または幅に名前を変更しますか?):

@{Expression={$_.Value};Label="URL"; カウント=35 }

于 2011-07-18T16:24:05.237 に答える