New Question

Building Win2016 VHDx using blog's doc [closed]

asked 2017-06-06 17:50:09 +0300

Nebukazar gravatar image

Hi, We've been testing out the win2016 image generation tool provided in the following blog article:

The code we're currently using is the following:

$ErrorActionPreference = "Stop"
Import-Module ..\WinImageBuilder.psm1
$windowsImagePath = "C:\images\my-windows-image.raw.tgz"
$wimFilePath = "D:\Sources\install.wim"
$image = (Get-WimFileImagesInfo -WimFilePath $wimFilePath)[1]
$switchName = 'VRACK'

    New-WindowsOnlineImage -WimFilePath $wimFilePath -ImageName $image.ImageName `
        -WindowsImagePath $windowsImagePath -Type 'MAAS' -ExtraFeatures @() `
        -SizeBytes 30GB -CpuCores 4 -Memory 4GB -SwitchName $switchName `
        -ProductKey $productKey -DiskLayout 'BIOS' `
        -InstallUpdates:$true -AdministratorPassword 'Pa$$w0rd' `
        -PurgeUpdates:$true -DisableSwap:$true

However, we're still getting the following errors while trying to generate the image file:

PS> .\create-windows-online-cloud-image.ps1
Windows online image generation started at: 2017-06-05 4:15:36 PM
Image generation started at: 2017-06-05 4:15:39 PM

Copying: C:\[SOME-PATH]\windows-openstack-imaging-tools\UnattendResources E:\UnattendResources
Downloading Cloudbase-Init...
WARNING: Exception calling "DownloadFile" with "2" argument(s): "The operation has timed out"
WARNING: Exception calling "DownloadFile" with "2" argument(s): "The operation has timed out"
WARNING: Exception calling "DownloadFile" with "2" argument(s): "The operation has timed out"

Invoke-Command : Exception calling "DownloadFile" with "2" argument(s): "The operation has timed out"
At C:\Users\[SOME-PATH]\windows-openstack-imaging-tools\WinImageBuilder.psm1:56 char:20
+             $res = Invoke-Command -ScriptBlock $command
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Invoke-Command], MethodInvocationException
    + FullyQualifiedErrorId : WebException,Microsoft.PowerShell.Commands.InvokeCommandCommand

Our external vswitch name is "VRACK". The Windows Server 2016 Trial ISO is mounted @ D:\

Any thoughts what might be wrong ?


edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Nebukazar
close date 2017-06-07 20:37:33.618429

2 answers

Sort by » oldest newest most voted

answered 2017-06-06 21:08:39 +0300

avladu gravatar image

updated 2017-06-06 21:18:55 +0300

The problem you are getting is due to the fact the Cloudbase-Init installer from could not be downloaded.

Is your Windows host (from where you run New-WindowsOnlineImage) connected to the Internet and are the DNS servers set correctly?

You can test this assumption by executing from powershell or cmd shell:

Thank you,
Adrian Vladu

edit flag offensive delete link more


cloudinit = fixed! We're now getting the following errors: - The generated vhdx (UEFI) is booting up, but sysprep is kicking in and the VM halts. When firing up the vm once more, it seems as if the OS has been corrupted:

Nebukazar gravatar imageNebukazar ( 2017-06-06 22:33:07 +0300 )edit

Make sure you use New-WindowsOnlineImage to generate cloud ready images and you require Cloudbase-init beta version in order to successfully boot on uefi systems. Use parameter - BetaRelease:$true parameter for New-WindowsOnlineImage. On the uefi issues, are you testing the image in hyper v?

avladu gravatar imageavladu ( 2017-06-06 22:42:49 +0300 )edit

Thanks! The BetaRelease parameter fixed the thing.. :)

Nebukazar gravatar imageNebukazar ( 2017-06-07 19:30:52 +0300 )edit

answered 2017-06-06 18:15:00 +0300

jrack gravatar image

Are you behind a proxy? Seems like the live updates may be failing.

edit flag offensive delete link more


Nope... how networking is being configured on the guest for windows updates retrieving ? Is there any NAT'ing being done ?

Nebukazar gravatar imageNebukazar ( 2017-06-06 18:17:16 +0300 )edit

I don't think so as the NAT support in the vSwitch is still pretty new and in my experience is a bit wonky. The DORAs I would think would egress your configured vSwitch so assuming you have a DHCP server on the outside listening?

jrack gravatar imagejrack ( 2017-06-06 18:20:49 +0300 )edit

Question Tools

1 follower


Asked: 2017-06-06 17:50:09 +0300

Seen: 1,002 times

Last updated: Jun 06 '17