Reputation: 29694
I'm calling a powershell script thus:
function checkUrlOnSites([string[]]$urls) {
#1
Write-Verbose $urls.count
$results=invoke-command -computername $computerName -ea silentlycontinue
-ev errRemote -scriptblock ${function:checkUrlOnSite} -args $urls
}
function checkUrlOnSite([string[]]$urls)
{
#2
Write-Verbose $urls.count
}
The first Write-Verbose
writes 2
the second writes 1
? what am I missing here? Where's my other string disappearing to??
Upvotes: 1
Views: 121
Reputation: 60918
change in this way:
$results=invoke-command -computername $computerName -ea silentlycontinue `
-ev errRemote -scriptblock ${function:checkUrlOnSite} -argumentlist (,$urls)
You need to force the argument as an array with the comma notation (,$urls)
Upvotes: 1