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.
Cannot bind argument to parameter xxxxx' because it is an empty string. I try to script for office 365 adding distribution groups and then add users later. But my code does not work until the end .. (I learn the powershell ...) Thnaks you. $Users is empty bcoz of this line.
Run-RemoteScript : Cannot bind argument to parameter 'Targets' because it is an empty string.
[Bug] Convert-RepositoryUri : Cannot bind argument to parameter 'Uri' because it is an empty string. · Issue #4917 · ScoopInstaller/Scoop · GitHub tinygo-org/tinygo#2821 build: install scoop without update to avoid bug in ScoopInstaller tinygo-org/tinygo#2853 Resolve running installer as admin (#5) MinoruSekine/setup-scoop#6
It was rejected when at least one of the member strings was empty or null. Either set AllowEmptyString as an attribute in the parameter you're calling, or check whether the members are not empty strings before passing them. Show activity on this post.
Probably a late answer, but in case others have a similar issue.
In my case, it was an array of strings. It was rejected when at least one of the member strings was empty or null.
Either set AllowEmptyString
as an attribute in the parameter you're calling, or check whether the members are not empty strings before passing them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With