# Execute\_command attempts to run variables

**URL:** <https://discuss.hashicorp.com/t/execute-command-attempts-to-run-variables/55131>\
**Category:** Packer\
**Created:** [June 17, 2023, 8:52pm UTC](https://discuss.hashicorp.com/t/execute-command-attempts-to-run-variables/55131 "2023-06-17T20:52:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![barber-greg](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/barber-greg/32/36351_2.png) [@barber-greg](https://discuss.hashicorp.com/u/barber-greg)\
**Post date:** [June 17, 2023, 8:52pm UTC](https://discuss.hashicorp.com/t/execute-command-attempts-to-run-variables/55131/1 "2023-06-17T20:52:50Z")

</div>

I have a Azure ADO pipeline that runs my packer build on a linux agent. In the template I have shell-local provsioner that runs a powershell script that is defined like:

…  
environment\_vars = [“Server={var.vcenter\_server.PDC}","User={var.username}”,“Password={var.password}","VM={var.vm\_name.eight}”]

```
execute_command = ["/bin/bash", "-c", "{{.Vars}} /usr/bin/pwsh {{.Script}}"]

env_var_format = "$env:%s='%s'; "

scripts = ["scripts/removedisk.ps1"]

```

Everytime the script runs it tries to run the .Vars as a script also. I’ve tried different variations of the execute\_command but cannot get the shell-local provsioner to run correctly. What is the correct way to get the script to run?

---

<div class="post-metadata">

**Author:** ![safenetwork-CMTY](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/safenetwork-cmty/32/16286_2.png) [@safenetwork-CMTY](https://discuss.hashicorp.com/u/safenetwork-CMTY)\
**Post date:** [June 18, 2023, 8:39pm UTC](https://discuss.hashicorp.com/t/execute-command-attempts-to-run-variables/55131/2 "2023-06-18T20:39:16Z")

</div>

Maybe I’m stupid, but why not get rid of the brackets,  
ditch the “/bin/bash -c” and change {{.Script}} into {{ .Path }},  
like you’d see in the examples, with only bash changed into pwsh ?
