Packer seems to be using wrong powershell.

85 views
Skip to first unread message

William McKenzie

unread,
Aug 3, 2017, 5:00:42 PM8/3/17
to Packer
Don't know what could be happening here. Packer clearly knows it is doing a hyper-v, but the error is clearing coming from a VMWare powershell module. What gives?

==> hyperv-iso: Creating temporary directory...
==> hyperv-iso: Downloading or copying ISO
    hyperv
-iso: Downloading or copying: https://cvxartifactorypro.azure.chevron.com/artifactory/iso/en_windows_server_2012_r2_with_update_x64_dvd_6052708.iso
==> hyperv-iso: Starting HTTP server on port 8277
==> hyperv-iso: Creating switch 'LAN' if required...
==> hyperv-iso:     switch 'LAN' already exists. Will not delete on cleanup...
==> hyperv-iso: Creating virtual machine...
==> hyperv-iso: Error creating virtual machine: PowerShell error: New-VM : A parameter cannot be found that matches parameter name 'Path'.
==> hyperv-iso: At C:\Users\wism\AppData\Local\Temp\ps631471300.ps1:5 char:22
==> hyperv-iso: + New-VM -Name $vmName -Path $path -MemoryStartupBytes $memoryStartupBy ...
==> hyperv-iso: +                      ~~~~~
==> hyperv-iso:     + CategoryInfo          : InvalidArgument: (:) [New-VM], ParameterBindingException
==> hyperv-iso:     + FullyQualifiedErrorId : NamedParameterNotFound,VMware.VimAutomation.ViCore.Cmdlets.Commands.NewVM

==> hyperv-iso: Unregistering and deleting virtual machine...
==> hyperv-iso: Error deleting virtual machine: PowerShell error: Get-VM : 8/3/2017 3:51:58 PM  Get-VM          You are not currently connected to any servers. Please connect first using a Connect cmdlet.
==> hyperv-iso: At C:\Users\wism\AppData\Local\Temp\ps231655763.ps1:4 char:7
==> hyperv-iso: + $vm = Get-VM -Name $vmName
==> hyperv-iso: +       ~~~~~~~~~~~~~~~~~~~~
==> hyperv-iso:     + CategoryInfo          : ResourceUnavailable: (:) [Get-VM], ViServerConnectionException
==> hyperv-iso:     + FullyQualifiedErrorId : Core_BaseCmdlet_NotConnectedError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetVM
==> hyperv-iso:
==> hyperv-iso: Unable to find type [Microsoft.HyperV.PowerShell.VMState].
==> hyperv-iso: At C:\Users\wism\AppData\Local\Temp\ps231655763.ps1:5 char:20
==> hyperv-iso: + if (($vm.State -ne [Microsoft.HyperV.PowerShell.VMState]::Off) -and ( ...
==> hyperv-iso: +                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
==> hyperv-iso:     + CategoryInfo          : InvalidOperation: (Microsoft.HyperV.PowerShell.VMState:TypeName) [], RuntimeException
==> hyperv-iso:     + FullyQualifiedErrorId : TypeNotFound
==> hyperv-iso:
==> hyperv-iso: Remove-VM : A parameter cannot be found that matches parameter name 'Name'.
==> hyperv-iso: At C:\Users\wism\AppData\Local\Temp\ps231655763.ps1:9 char:11
==> hyperv-iso: + Remove-VM -Name $vmName -Force -Confirm:$false
==> hyperv-iso: +           ~~~~~
==> hyperv-iso:     + CategoryInfo          : InvalidArgument: (:) [Remove-VM], ParameterBindingException
==> hyperv-iso:     + FullyQualifiedErrorId : NamedParameterNotFound,VMware.VimAutomation.ViCore.Cmdlets.Commands.RemoveVM
==> hyperv-iso: Deleting output directory...
==> hyperv-iso: Deleting temporary directory...
Build 'hyperv-iso' errored: Error creating virtual machine: PowerShell error: New-VM : A parameter cannot be found that matches parameter name 'Path'.
At C:\Users\wism\AppData\Local\Temp\ps631471300.ps1:5 char:22
+ New-VM -Name $vmName -Path $path -MemoryStartupBytes $memoryStartupBy ...
+                      ~~~~~
   
+ CategoryInfo          : InvalidArgument: (:) [New-VM], ParameterBindingException
   
+ FullyQualifiedErrorId : NamedParameterNotFound,VMware.VimAutomation.ViCore.Cmdlets.Commands.NewVM


==> Some builds didn't complete successfully and had errors:
--> hyperv-iso: Error creating virtual machine: PowerShell error: New-VM : A parameter cannot be found that matches parameter name '
Path'.
At C:\Users\wism\AppData\Local\Temp\ps631471300.ps1:5 char:22
+ New-VM -Name $vmName -Path $path -MemoryStartupBytes $memoryStartupBy ...
+                      ~~~~~
    + CategoryInfo          : InvalidArgument: (:) [New-VM], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,VMware.VimAutomation.ViCore.Cmdlets.Commands.NewVM


==> Builds finished but no artifacts were created.






Rickard von Essen

unread,
Aug 3, 2017, 10:01:45 PM8/3/17
to packe...@googlegroups.com
Could you please provide your template and the output when running with PACKER_LOG=1 packer build template.json 

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/7c2a8704-49fd-4214-8236-9adca57605c2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

William McKenzie

unread,
Aug 4, 2017, 7:58:03 AM8/4/17
to packe...@googlegroups.com
Well, I figured it out, but I'm not sure whether it really would be considered a bug or not. It turns out that VMWare's PowerCLI and Microsoft's HyperV module use some of the exact same module names (like, say, 'New-VM') and the order in which they will be selected is undetermined. So I recently installed PowerCLI to try to do some vSphere builds, and once I did that it broke my hyper-v builds. So, I had to uninstall PowerCLI and re-install the Hyper-V feature to make it work. I think it could be fixed by using qualified module names, but if not it is at least worth making mention of in the documentation. For myself, i don't really need the PowerCLI, except to turn ssh on and off on our vSphere host, so I'm not really blocked anymore. 

cheers,
~Bill

You received this message because you are subscribed to a topic in the Google Groups "Packer" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/packer-tool/QUdkoqESYY0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to packer-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/CALz9Rt-H7kpvMteyP-Tw5d2ZQNHwon%3Dqrp2WGyD00s4nd1PxPw%40mail.gmail.com.

Rickard von Essen

unread,
Aug 4, 2017, 8:21:04 AM8/4/17
to packe...@googlegroups.com
Could you please open an issue for this at https://github.com/hashicorp/packer 

/ Rickard 

Reply all
Reply to author
Forward
0 new messages