Rob*_*ert 0 powershell formatting invalid-argument
我收到以下错误,我不明白为什么或它要求什么.
我试图在表格中显示的对象是:
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
}
Run Code Online (Sandbox Code Playgroud)
基本流程如下.
#< 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
Run Code Online (Sandbox Code Playgroud)
我知道值在数组中; 但它无法正常显示.如果我在没有格式表的情况下显示它,则值字段只显示为空.
| 归档时间: |
|
| 查看次数: |
1936 次 |
| 最近记录: |