24 Commits

Author SHA1 Message Date
hashicorp-copywrite[bot]
36a312ee26
add missing license headers and update copyright file headers to BUS-1.1 2023-08-10 21:53:25 +01:00
sophia
0a1b20bb07 Get powershell path in %WINDIR%/System32 2021-06-29 10:34:57 -05:00
Chris Roberts
5967a23fa0 Support pwsh executable name for powershell
This updates the powershell detection to look for the `pwsh` executable
    and use it when the powershell executable is not available.
2021-04-28 12:45:48 -07:00
Liam Feid
3898d02259 Use the correct powershell executable for privileged commands 2020-07-28 07:48:41 +02:00
Chris Roberts
8d36ba8864 Use Base64#strict_encode64 instead of Base64#urlsafe_encode64 for PowerShell
The #urlsafe_encode64 method complies with RFC 4648 but as the documentation
points out it uses the "URL and Filename Safe Alphabet". The #strict_encode64
method does not, and does not include linefeeds.

Fixes #10438
2018-12-06 16:13:48 -08:00
Chris Roberts
4ff5291b89 Update powerup to handle spaces properly in arguments 2018-11-09 15:26:55 -08:00
Brian Cain
e073153728
(#10099) Properly join commands from passed in array
Prior to this commit, the `Util::Powershell.execute_inline`
method didn't properly join the passed in command and instead attempted
to execute the array of strings. This commit updates that
behavior to join the command array prior to inserting it into the full
powershell command.
2018-08-14 09:30:11 -07:00
Chris Roberts
5357727350 Attempt full path to powershell as last resort in WSL 2018-06-15 09:03:18 -07:00
Chris Roberts
ef4d431d36 Remove console resizing on powershell commands 2018-06-12 16:47:47 -07:00
Chris Roberts
5325000fa6 Add helper option for setting custom module path on PowerShell executes 2018-06-12 10:44:12 -07:00
Chris Roberts
5f4e661155 Add automatic console resize and environment support for powershell commands 2018-05-30 15:04:59 -07:00
Chris Roberts
e6457d5061 Overhaul the Hyper-V provider 2018-05-24 14:43:44 -07:00
Brian Cain
188fd5d6a6
Split out run methods with Powershell functions 2018-04-20 10:51:38 -07:00
Chris Roberts
90fa705a6d Make powershell version detection timeout configurable
Allows custom configuration of the powershell timeout and bumps
the default timeout from 10 seconds to 30 seconds.

Fixes #9629
2018-04-04 16:02:11 -07:00
Sergii Bondarenko
47a7f0817c #9298: Try to fallback to "powershell.exe" on WSL if "powershell" is not available 2018-02-28 10:08:01 -08:00
Brian Cain
3844a8e9f9
(#9056) Pass ruby block to capture stdout when determining PS version
Prior to this commit, the function used to determine the version of
Powershell would loop forever inside the Subprocess.execute function
because the process would never exit. This commit fixes that by passing
in a ruby block to capture the version from stdout instead of trying to
capture it from the returned process when it exits.
2018-02-22 10:04:16 -08:00
Chris Roberts
0dbd8538a0 Update return value documentation to actual behavior 2018-01-02 14:03:06 -08:00
Chris Roberts
00fa50c296 SMB enhancements 2017-12-21 09:55:19 -08:00
Chris Roberts
ad5bc23088 Validate powershell prior to powershell use
Adds powershell validation to ensure powershell is available on
the PATH and checks powershell version to ensure meets the
defined minimum powershell version.
2017-07-31 15:05:41 -07:00
Luke Bakken
52e98ffdfb Improve detection of admin and hyper-v admin rights via using SIDs and powershell 2016-10-13 14:22:08 -07:00
Mitchell Hashimoto
a1d9121852 synced_folders/smb: verify PowerShell v3 is running or later [GH-3257] 2014-04-02 09:45:42 -07:00
Jonas Stendahl
d7320399e2 Fixed broken PowerShell scripts execution [GH-3192] 2014-03-14 12:42:28 +01:00
Mitchell Hashimoto
621369ebba core: Execute PowerShell scripts even with spaces in dir [GH-3100] 2014-03-12 19:49:45 -07:00
Mitchell Hashimoto
a1958ee12f providers/hyperv: shuffle things around 2014-02-27 08:12:48 -08:00