I have several Windows 10 hosts that I would like to run scripts on using bolt via WinRM transport. These hosts can run individual commands fine with "bolt command run ..." but fail to run a PowerShell script with "bolt script run ..."
Completed analytics submission
Opened session
Executing command: $parent = [System.IO.Path]::GetTempPath()
$name = [System.IO.Path]::GetRandomFileName()
$path = Join-Path $parent $name
New-Item -ItemType Directory -Path $path | Out-Null
$path
stdout: C:\Users\bsipos\AppData\Local\Temp\bak15pal.jqn
stderr:
Command returned successfully
Uploading echo-hi.ps1, to C:\Users\bsipos\AppData\Local\Temp\bak15pal.jqn\echo-hi.ps1
Executing command: $invokeArgs = @
Unknown macro: { ScriptBlock = (Get-Command "C}
try
Unknown macro: { Invoke-Command @invokeArgs }
catch
Unknown macro: { Write-Error $_.Exception exit 1 }
stdout:
stderr: $invokeArgs = @{
: System.Management.Automation.ParameterBindingValidationException: Cannot validate argument on parameter 'ScriptBlock'. The argument is null. Provide a valid value for the argument, and then try running the command again. ---> System.Management.Automation.ValidationMetadataException: The argument is null. Provide a valid value for the argument, and then try running the command again.
at System.Management.Automation.ValidateNotNullAttribute.Validate(Object arguments, EngineIntrinsics engineIntrinsics)
at System.Management.Automation.ParameterBinderBase.BindParameter(CommandParameterInternal parameter, CompiledCommandParameter parameterMetadata, ParameterBindingFlags flags)
— End of inner exception stack trace —
at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
+ CategoryInfo : NotSpecified: (
[Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException
Command failed with exit code 1
Executing command: Remove-Item -Force -Recurse -Path "C:\Users\bsipos\AppData\Local\Temp\bak15pal.jqn"
Command returned successfully
Closed session