Hi
I am trying to pass a parameter to a remote script with an invoke-command.
If i run the invoke command with the script in the local computer it´s works, but when i call the invoke-command with the second script in other server it´s fails with a conversion error for the type [System.Collections.Specialized.NameValueCollection]
I think this can be because some serialization to transfer the data between the two servers. Any help??
The command:
Invoke-Command -computername $RemoteServerName -Credential $credential -Authentication Credssp -scriptblock {
param(
[String]$scriptDeploy,
[String]$BackupPath,
[String]$DeployPath,
[System.Collections.Specialized.NameValueCollection]$dtsConfigReplacements,
[System.Collections.Specialized.NameValueCollection]$dtsxReplacements
) &"$scriptDeploy" -BackupPath $BackupPath -DeployPath $DeployPath -dtsConfigReplacements $dtsConfigReplacements -dtsxReplacements $dtsxReplacements
} -ArgumentList $Script_To_Run, $script:BackupPath, $script:DeployPath, $script:dtsConfigReplacements, $script:dtsxReplacements
The command fails with this error:
Cannot process argument transformation on parameter 'dtsConfigReplacements'. Ca
nnot convert the "System.Collections.ArrayList" value of type "System.Collectio
ns.ArrayList" to type "System.Collections.Specialized.NameValueCollection".
+ CategoryInfo : InvalidData: (:) [BDesarrollo.
ps1], ParameterBindin...mationException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,Deploy.Aprovisionamiento.Desarrollo.ps1