我有这个脚本:
$i = 0
$Destination_Server = @()
foreach ($row in $Table | where { $_.cube_name -match "$CUBE" }) {
$i++
$Destination_Server += $row.Item("process_server")
if (-not ($Destination_Server)) {
Write-Host "`r`n > Server: N/A...ensure CUBE << $CUBE_input >> exists in the table"
} else {
Write-Host "`r`n` > Server $($i):" $Destination_Server[-1]
}
}
$Destination_Server | Select-Object -Unique
Invoke-ASCmd -InputFile $JSON_file -Server $Destination_Server >$process_output
运行它时,它会抱怨
Invoke-ASCmd : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'Server'. + ... nvoke-ASCmd -InputFile $JSON_file -Server $Destination_Server >$proce ...
由于$Destination_Server
返回一个唯一值,为什么调用命令会出现问题?它应该只接受一个已传递的值。