From 847a3b00616f362943e75fe5d6889db74b5d56fa Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Tue, 9 Oct 2018 12:13:07 -0700 Subject: [PATCH] provide useful powershell error --- common/powershell/powershell.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/powershell/powershell.go b/common/powershell/powershell.go index 6540c7705..4c3dd80d1 100644 --- a/common/powershell/powershell.go +++ b/common/powershell/powershell.go @@ -39,7 +39,7 @@ func (ps *PowerShellCmd) Run(fileContents string, params ...string) error { func (ps *PowerShellCmd) Output(fileContents string, params ...string) (string, error) { path, err := ps.getPowerShellPath() if err != nil { - return "", err + return "", fmt.Errorf("Cannot find PowerShell in the path") } filename, err := saveScript(fileContents) @@ -239,7 +239,7 @@ param([string]$moduleName) func HasVirtualMachineVirtualizationExtensions() (bool, error) { - var script = ` + var script = ` (GET-Command Hyper-V\Set-VMProcessor).parameters.keys -contains "ExposeVirtualizationExtensions" ` @@ -344,7 +344,7 @@ param([string]$path,[string]$productKey) $unattend = [xml](Get-Content -Path $path) $ns = @{ un = 'urn:schemas-microsoft-com:unattend' } -$setupNode = $unattend | +$setupNode = $unattend | Select-Xml -XPath '//un:settings[@pass = "specialize"]/un:component[@name = "Microsoft-Windows-Shell-Setup"]' -Namespace $ns | Select-Object -ExpandProperty Node