Use system context env var to set path for elevated PS env vars file

This commit is contained in:
DanHam 2017-09-21 12:08:29 +01:00
parent 4ce381cae7
commit 5374c6e367
No known key found for this signature in database
GPG Key ID: 58E79AEDD6AA987E
1 changed files with 1 additions and 1 deletions

View File

@ -417,7 +417,7 @@ func (p *Provisioner) createCommandTextPrivileged() (command string, err error)
// we'll be dot-sourcing this later // we'll be dot-sourcing this later
envVarReader := strings.NewReader(flattenedEnvVars) envVarReader := strings.NewReader(flattenedEnvVars)
uuid := uuid.TimeOrderedUUID() uuid := uuid.TimeOrderedUUID()
envVarPath := fmt.Sprintf(`${env:TEMP}\packer-env-vars-%s.ps1`, uuid) envVarPath := fmt.Sprintf(`${env:SYSTEMROOT}\Temp\packer-env-vars-%s.ps1`, uuid)
log.Printf("Uploading env vars to %s", envVarPath) log.Printf("Uploading env vars to %s", envVarPath)
err = p.communicator.Upload(envVarPath, envVarReader, nil) err = p.communicator.Upload(envVarPath, envVarReader, nil)
if err != nil { if err != nil {