-
Notifications
You must be signed in to change notification settings - Fork 8k
Closed
Labels
Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-AnsweredThe question is answered.The question is answered.WG-Cmdlets-Corecmdlets in the Microsoft.PowerShell.Core modulecmdlets in the Microsoft.PowerShell.Core module
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
Set up a list of computers
Pipe it to a foreach-object -Parallel with an Invoke-Command, specifying credentials, already stored in a variable $cred
.
Example:
$computerList | % -Parallel {Invoke-Command -ComputerName $_ -Credential $cred -ScriptBlock {ipconfig} }
Expected behavior
Powershell should behave in the same way whether or not -Parallel is specified.
Without -Parallel, Powershell processes every line sequentially successfully, with the payload written in the scriptblock parameter.
Actual behavior
Powershell gives out an error for each computer specified :
> Invoke-Command: Cannot process argument transformation on parameter 'Credential'. A command that prompts the user failed because the host program or the command type does not support user interaction. The host was attempting to request confirmation with the following message: Enter your credentials.
Error details
Exception :
Type : System.Management.Automation.ParameterBindingArgumentTransformationException
Message : Cannot process argument transformation on parameter 'Credential'. A command that prompts the
user failed because the host program or the command type does not support user interaction. The host was attempting to
request confirmation with the following message: Enter your credentials.
ParameterName : Credential
ParameterType : pscredential
ErrorId : ParameterArgumentTransformationError
Line : 1
Offset : 50
CommandInvocation :
MyCommand : Invoke-Command
BoundParameters :
Comparer : System.OrdinalIgnoreCaseComparer
Count : 1
Keys :
Length : 12
Values :
Length : 1
LongLength : 1
Rank : 1
SyncRoot :
Length : 9
IsFixedSize : True
Count : 1
SyncRoot :
Comparer : System.OrdinalIgnoreCaseComparer
Count : 1
Keys :
Length : 12
Values :
Length : 1
LongLength : 1
Rank : 1
SyncRoot :
Length : 9
IsFixedSize : True
Count : 1
SyncRoot :
Comparer : System.OrdinalIgnoreCaseComparer
Count : 1
Keys :
Length : 12
Values :
Length : 1
LongLength : 1
Rank : 1
SyncRoot :
Length : 9
IsFixedSize : True
Count : 1
SyncRoot :
Comparer : System.OrdinalIgnoreCaseComparer
Count : 1
Keys :
Length : 12
Values :
Length : 1
LongLength : 1
Rank : 1
SyncRoot :
Length : 9
IsFixedSize : True
Count : 1
SyncRoot :
Comparer : System.OrdinalIgnoreCaseComparer
Count : 1
Keys :
Length : 12
Values :
Length : 1
LongLength : 1
Rank : 1
SyncRoot :
Length : 9
IsFixedSize : True
Count : 1
SyncRoot :
Comparer : System.OrdinalIgnoreCaseComparer
Count : 1
Keys :
Length : 12
Values :
Length : 1
LongLength : 1
Rank : 1
SyncRoot : …
IsFixedSize : True
Count : 1
SyncRoot :
Comparer : System.OrdinalIgnoreCaseComparer
Count : 1
Keys : …
Values : …
SyncRoot : …
ScriptLineNumber : 1
OffsetInLine : 1
HistoryId : 1
Line : Invoke-Command -ComputerName $_ -Credential $cred -ScriptBlock {ipconfig}
PositionMessage : At line:1 char:1
+ Invoke-Command -ComputerName $_ -Credential $cred -ScriptBlock { …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
InvocationName : Invoke-Command
PipelineLength : 1
PipelinePosition : 1
ErrorRecord :
Exception :
Type : System.Management.Automation.ParentContainsErrorRecordException
Message : Cannot process argument transformation on parameter 'Credential'. A command that prompts the
user failed because the host program or the command type does not support user interaction. The host was attempting to
request confirmation with the following message: Enter your credentials.
HResult : -2146233087
CategoryInfo : InvalidData: (:) [Invoke-Command], ParentContainsErrorRecordException
FullyQualifiedErrorId : ParameterArgumentTransformationError,Microsoft.PowerShell.Commands.InvokeCommandCommand
InvocationInfo :
MyCommand : Invoke-Command
ScriptLineNumber : 1
OffsetInLine : 50
HistoryId : 1
Line : Invoke-Command -ComputerName $_ -Credential $cred -ScriptBlock {ipconfig}
PositionMessage : At line:1 char:50
+ Invoke-Command -ComputerName $_ -Credential $cred -ScriptBlock { …
+ ~~~~~
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
TargetSite :
Name : BindParameter
DeclaringType : System.Management.Automation.ParameterBinderBase, System.Management.Automation,
Version=7.1.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
MemberType : Method
Module : System.Management.Automation.dll
StackTrace :
at System.Management.Automation.ParameterBinderBase.BindParameter(CommandParameterInternal parameter,
CompiledCommandParameter parameterMetadata, ParameterBindingFlags flags)
at System.Management.Automation.CmdletParameterBinderController.BindParameter(CommandParameterInternal argument,
MergedCompiledCommandParameter parameter, ParameterBindingFlags flags)
at System.Management.Automation.CmdletParameterBinderController.BindParameter(UInt32 parameterSets,
CommandParameterInternal argument, MergedCompiledCommandParameter parameter, ParameterBindingFlags flags)
at System.Management.Automation.CmdletParameterBinderController.BindNamedParameter(UInt32 parameterSets,
CommandParameterInternal argument, MergedCompiledCommandParameter parameter)
at System.Management.Automation.ParameterBinderController.BindNamedParameters(UInt32 parameterSets, Collection`1
arguments)
at System.Management.Automation.CmdletParameterBinderController.BindCommandLineParametersNoValidation(Collection`1
arguments)
at System.Management.Automation.CmdletParameterBinderController.BindCommandLineParameters(Collection`1 arguments)
at System.Management.Automation.CommandProcessor.BindCommandLineParameters()
at System.Management.Automation.CommandProcessor.Prepare(IDictionary psDefaultParameterValues)
at System.Management.Automation.CommandProcessorBase.DoPrepare(IDictionary psDefaultParameterValues)
at System.Management.Automation.Internal.PipelineProcessor.Start(Boolean incomingStream)
at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input)
--- End of stack trace from previous location ---
at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input)
at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput,
CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][]
commandRedirections, FunctionContext funcContext)
at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Data : System.Collections.ListDictionaryInternal
InnerException :
Type : System.Management.Automation.Host.HostException
ErrorRecord :
Exception :
Type : System.Management.Automation.ParentContainsErrorRecordException
Message : A command that prompts the user failed because the host program or the command type does not
support user interaction. The host was attempting to request confirmation with the following message: Enter your
credentials.
HResult : -2146233087
CategoryInfo : NotImplemented: (:) [], ParentContainsErrorRecordException
FullyQualifiedErrorId : HostFunctionNotImplemented
TargetSite :
Name : ThrowPromptNotInteractive
DeclaringType : System.Management.Automation.Internal.Host.InternalHostUserInterface,
System.Management.Automation, Version=7.1.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
MemberType : Method
Module : System.Management.Automation.dll
StackTrace :
at System.Management.Automation.Internal.Host.InternalHostUserInterface.ThrowPromptNotInteractive(String
promptMessage)
at System.Management.Automation.Internal.Host.InternalHostUserInterface.PromptForCredential(String caption, String
message, String userName, String targetName, PSCredentialTypes allowedCredentialTypes, PSCredentialUIOptions options)
at System.Management.Automation.Internal.Host.InternalHostUserInterface.PromptForCredential(String caption, String
message, String userName, String targetName)
at System.Management.Automation.CredentialAttribute.Transform(EngineIntrinsics engineIntrinsics, Object inputData)
at System.Management.Automation.ParameterBinderBase.BindParameter(CommandParameterInternal parameter,
CompiledCommandParameter parameterMetadata, ParameterBindingFlags flags)
Message : A command that prompts the user failed because the host program or the command type does not
support user interaction. The host was attempting to request confirmation with the following message: Enter your
credentials.
Source : System.Management.Automation
HResult : -2146233087
Source : System.Management.Automation
HResult : -2146233087
CategoryInfo : InvalidData: (:) [Invoke-Command], ParameterBindingArgumentTransformationException
FullyQualifiedErrorId : ParameterArgumentTransformationError,Microsoft.PowerShell.Commands.InvokeCommandCommand
InvocationInfo :
MyCommand : Invoke-Command
ScriptLineNumber : 1
OffsetInLine : 50
HistoryId : 1
Line : Invoke-Command -ComputerName $_ -Credential $cred -ScriptBlock {ipconfig}
PositionMessage : At line:1 char:50
+ Invoke-Command -ComputerName $_ -Credential $cred -ScriptBlock { …
+ ~~~~~
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
Environment data
Name Value
---- -----
PSVersion 7.1.5
PSEdition Core
GitCommitId 7.1.5
OS Microsoft Windows 10.0.18363
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals
No response
Metadata
Metadata
Assignees
Labels
Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-AnsweredThe question is answered.The question is answered.WG-Cmdlets-Corecmdlets in the Microsoft.PowerShell.Core modulecmdlets in the Microsoft.PowerShell.Core module