DanHam
8214a12a2a
Move append of portion of command used to send elevated PS output to file
2017-09-26 11:07:26 +01:00
DanHam
2a060adbf8
Don't use -EncodedCommand with PS as progress stream always leaks to stderr
...
* Setting $ProgressPreference to SilentlyContinue makes no difference
when -EncodedCommand is used - any output to the progress stream
still appears on stderr.
* Delete file containing encode/decode functions since we no longer
need them.
* Fixes leak of output on progress streams for both normal and elevated
commands.
* Since we no longer base64 encode, ensure any characters special to XML
are correctly escaped in the elevated command. This ensures correct
parsing once the command is wrapped within the elevatedTemplates XML
based Task Scheduler definition.
Fixes #4322
2017-09-26 11:07:11 +01:00
DanHam
5374c6e367
Use system context env var to set path for elevated PS env vars file
2017-09-21 12:08:29 +01:00
Matthew Hooker
af1187d5e1
simplify a bit
2017-09-15 10:06:54 -07:00
Megan Marsh
cbe1d7d854
simplify file upload for elevated powershell wrapper
2017-09-14 17:01:48 -07:00
Megan Marsh
92e70757bb
Move env vars into a file that we dot-source instead of trying to write them all to the command line
2017-09-14 17:00:57 -07:00
Megan Marsh
d458628529
exclude elevated_executed_command from config interpolation so it can be used correctly later
2017-09-14 10:50:32 -07:00
Megan Marsh
c6889ad009
clarify logging by changing 'shell' to 'powershell' inside of the powershell provisioner
2017-09-06 11:59:25 -07:00
Megan Marsh
b2923b4da6
check stdout to make sure echo command actually goes through before counting computer as fully restarted
2017-08-24 12:10:27 -07:00
Megan Marsh
5214851463
make every script name unique
2017-08-22 14:03:28 -07:00
Matthew Hooker
81522dced0
move packer to hashicorp
2017-04-04 13:39:01 -07:00
Matthew Hooker
0149f679de
Print instead of Printf with no dynamic first variable.
2017-03-28 20:36:20 -07:00
DanHam
4122f3a897
provisioner/powershell: Remove env var check - we already check in Prepare
2017-01-23 12:10:46 +00:00
Matthew Hooker
480398c3d2
only set PACKER_HTTP_ADDR if a server is listening
2017-01-17 17:17:36 -08:00
Matthew Hooker
6563eb213c
Document. add to windows-shell and powershell
2017-01-17 17:07:36 -08:00
DanHam
0423f91037
Fix to allow equals sign in value of environment variable
2016-12-28 00:33:16 +00:00
Taliesin Sisson
e36051d394
Pattern for infrastructure changed to quote filename and execute file with ampersand as everything is run in powershell now
...
Handle powershell commands by specifying any extra infrastructure around running scripts inside of ExecuteCommand and ElevatedExecuteCommand
2016-12-12 22:44:55 +00:00
Taliesin Sisson
d61513bf77
Encode powershell using utf8
...
Fix a bug in the size of string that was returned when decoding a base64 string
Added tests around encoding and decoding powershell scripts. Used [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes('powershell commands')) | clip to generate what base 64 strings should look like
2016-12-12 22:44:54 +00:00
Taliesin Sisson
17597b48e1
Base64 encode powershell to avoid any necessary escaping
2016-12-12 22:44:54 +00:00
Taliesin Sisson
5d5809b27e
Make hiding of progress backward compatible with old versions of powershell
2016-12-12 22:44:48 +00:00
Taliesin Sisson
e8c2b49be8
Use correct quotation of variables
2016-12-12 22:44:34 +00:00
Taliesin Sisson
4b394c8563
Write output will put ouput from function, so we don't want to be getting line from output of function
...
Fix unit tests for not showing progress stream when using powershell
Ensure that progress stream does not get leaked into stdout
Using Write-Output instead of Write-Host since PS v5 now leaks the host stream to stderr
2016-12-12 22:44:33 +00:00
Taliesin Sisson
cd6213eb55
Seems like we do need to escape the double quote
2016-12-12 22:44:25 +00:00
Taliesin Sisson
5285a819dd
Quoting of powershell commands and associated tests
2016-12-12 22:44:19 +00:00
Taliesin Sisson
3051ea6633
Quote powershell so that it does not try to interpret command to be run
...
Get VName out of state. This allows template replacement to be run on vmname
2016-12-12 22:44:10 +00:00
Taliesin Sisson
6c3030c73a
Add a little safety around variables that are passed into provisioner.
2016-12-12 22:44:10 +00:00
Rickard von Essen
f17bd30070
Revert "Removed escaped quotes in non-elevated powershell invocation"
...
This reverts commit 1b186f1613
.
2016-10-26 21:12:11 +02:00
Simon Guest
1b186f1613
Removed escaped quotes in non-elevated powershell invocation
2016-03-20 20:28:08 -07:00
Gonzalo Peci
21107b0027
Fix wrong command type being used when running elevated provisioner.
2015-07-28 16:14:32 +12:00
Mitchell Hashimoto
7c8e86c9c5
provisioner/*: fix interpolation context
2015-06-22 12:26:54 -07:00
Mitchell Hashimoto
ab6a330d86
provisioner/*: fix go vet
2015-06-14 12:39:39 -07:00
Mitchell Hashimoto
040ff0706d
provisioner/powershell
2015-06-14 11:01:28 -07:00