I am getting this error when calling a function from a module that I have created and imported into my main script:
Run-RemoteScript : Cannot bind argument to parameter 'Targets' because it
is an empty string.
At C:\Scripts\Script.ps1:114 char:39
+ Run-RemoteScript -Targets $targets -RunMethod $runMethod ...
+ ~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Run-RemoteScript],
ParameterBindingValidationException
+ FullyQualifiedErrorId :
ParameterArgumentValidationErrorEmptyStringNotAllowed,Run-RemoteScript`
In my module, -Target
is defined as a parameter like this:
[Parameter(Mandatory, Position = 0)][String[]]$Targets,
In my main script (which imports my module), $targets
is defined like this:
$Targets = Set-TargetList
I have tried using a global
script scope, but this did not work.