hashicorp / hashicorp/packer

Packer error "The string is missing the terminator: '." when executing powershell script in provisioners block

Open
#11,684 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
15.8k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

When filing a bug, please include the following headings if possible. Any
example text in this template can be deleted.

#### Overview of the Issue

I am building windows 2019 server image using packer, we have 2 security hardening scripts to be executed as part of the image build. Those 2 scripts were working fine while running in a test VM manually . The VM is created using the windows 2019 packer image.

A paragraph or two about the issue you're experiencing.

#### Reproduction Steps

Steps to reproduce this issue

### Packer version
1.7.8
From `packer version`

### Simplified Packer Template

If the file is longer than a few dozen lines, please include the URL to the
[gist](https://gist.github.com/) of the log or use the [Github detailed
format](https://gist.github.com/ericclemmons/b146fe5da72ca1f706b2ef72a20ac39d)
instead of posting it directly in the issue.

### Operating system and Environment details

OS, Architecture, and any other information you can provide about the
environment.

### Log Fragments and crash.log files

vsphere-iso: At C:\Windows\Temp\script-623a3ad4-4f88-f45d-6ae5-19f915965091.ps1:1097 char:20
vsphere-iso: + write-host $i' '
vsphere-iso: + ~
vsphere-iso: The string is missing the terminator: '.
vsphere-iso: + CategoryInfo : ParserError: (:) [], ParseException
vsphere-iso: + FullyQualifiedErrorId : TerminatorExpectedAtEndOfString

Include appropriate log fragments. If the log is longer than a few dozen lines,
please include the URL to the [gist](https://gist.github.com/) of the log or
use the [Github detailed format](https://gist.github.com/ericclemmons/b146fe5da72ca1f706b2ef72a20ac39d) instead of posting it directly in the issue.

Set the env var `PACKER_LOG=1` for maximum log detail.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.