1

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??

1 Answer 1

1

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)

Sign up to request clarification or add additional context in comments.

1 Comment

Looks good. Will just check before accepting, currently busy looking at something else though! :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.