Jira (BOLT-1542) bolt "script run" fails on hosts which can "command run" with WinRM

2 views
Skip to first unread message

Brian Sipos (Jira)

unread,
Mar 10, 2020, 4:35:04 PM3/10/20
to puppe...@googlegroups.com
Brian Sipos created an issue
 
Puppet Task Runner / Bug BOLT-1542
bolt "script run" fails on hosts which can "command run" with WinRM
Issue Type: Bug Bug
Assignee: Unassigned
Created: 2020/03/10 1:34 PM
Environment:

Bolt 2.1.0 on Fedora 30 running commands on Windows 10

Priority: Normal Normal
Reporter: Brian Sipos

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 ..."

The documentation at https://puppet.com/docs/bolt/latest/running_bolt_commands.html doesn't give much specific guidance about the contents of the script, so I assume there are no specific limitations other than being a valid powershell script.

Even the example linked to from https://puppet.com/docs/bolt/latest/bolt_examples.html#1-run-your-powershell-script-on-a-windows-target fails to run with the same reason. A fragment of the bolt "–debug" mode error is below:

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

 

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages