Skip to content

Invoke-BoltCommand fails when passing multiple servers to -Targets #2739

@rogfut

Description

@rogfut

Describe the Bug

When running an Invoke-BoltCommand and passing in a server list text file that is UTF8 encoded with .txt extension, the command throws 800+ line Traceback

Invoke-BoltCommand -Command "write-host 'hi'" -Targets '@servers.txt' -Transport winrm -Ssl:$false -User roger@example.com -PasswordPrompt

This also happens when I pass in a comma delimited server list as a string:

Invoke-BoltCommand -Command "write-host 'hi'" -Targets 'server01.example.com,server02.example.com' -Transport winrm -Ssl:$false -User roger@example.com -PasswordPrompt

Expected Behavior

The bolt command should be successful and output the following:

Started on <server>...
Finished on <server>:
  hi

When I run the command and pass a single server to -Targets, the command is successful.

Invoke-BoltCommand -Command "write-host 'hi'" -Targets 'server01.example.com' -Transport winrm -Ssl:$false -User roger@example.com -PasswordPrompt

Steps to Reproduce

Invoke-BoltCommand -Command "write-host 'hi'" -Targets '@servers.txt' -Transport winrm -Ssl:$false -User roger@example.com -PasswordPrompt

where @'servers.txt' has 12+ servers, is in my cwd, is UTF8 encoded with CRLF end of line sequence

Format is like:

server1.example.com
server2.example.com
server3.example.com

Environment

  • Version 3.4.0
  • Platform Windows 10 Enterprise 10.0.17763
  • Powershell version
    Major Minor Build Revision

5 1 17763 1490

Additional Context

Stdout from the command is attached
puppet_error_log.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugBug reports and fixes.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions