I get the following error anytime I try to call any elevated powershell 
script from a provisioner with Windows 8 and 2012 vms.  

Error:

> ==> virtualbox-iso: Connected to WinRM!
> ==> virtualbox-iso: Uploading VirtualBox version info (5.1.18)
> ==> virtualbox-iso: Provisioning with Powershell...
> ==> virtualbox-iso: Provisioning with shell script: 
> C:\Users\vagrant\AppData\Local\Temp\packer-powershell-provisioner029272611
>     virtualbox-iso: Exception calling "Run" with "1" argument(s): "Could 
> not load file or assembly
>     virtualbox-iso: 'Microsoft.PowerShell.Commands.Management' or one of 
> its dependencies. The
>     virtualbox-iso: system cannot find the file specified."
>     virtualbox-iso: At 
> C:\Users\vagrant\AppData\Local\Temp\packer-elevated-shell-58d88da0-926d-aa38
>     virtualbox-iso: -4744-6d53beaecfa5.ps1:51 char:1
>     virtualbox-iso: + $t.Run($null) | Out-Null
>     virtualbox-iso: + ~~~~~~~~~~~~~~~~~~~~~~~~
>     virtualbox-iso: + CategoryInfo          : NotSpecified: (:) [], 
> MethodInvocationException
>     virtualbox-iso: + FullyQualifiedErrorId : ComMethodTargetInvocation
>     virtualbox-iso:
> ==> virtualbox-iso: Unregistering and deleting virtual machine...
> ==> virtualbox-iso: Deleting output directory...
> Build 'virtualbox-iso' errored: Script exited with non-zero exit status: 
> 1. Allowed exit codes are: [0 3010]


What I have tried:
* If I use the same scripts on Windows 7, 8.1, 10, 2008R2, 2012R2 or 2016 
it works as expected.
* Tried a different script on 8 and get the above problem.
* Tried not elevating script... error doesn't appear but I need to run 
elevation for Windows patching.
* Tried rebooting before running scripts.
* Tried to installing .net 3.5 features.






-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/b8c0f2e5-26fe-470e-8d82-d5f1a59a0629%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to