[DISCUSSION] Sysprep and capturing image using VirtualBox

Discussion in 'Virtualization' started by ceo54, Sep 14, 2021.

  1. ceo54

    ceo54 MDL Addicted

    Aug 13, 2015
    867
    361
    30
    I'm interested in this too but If I do this, what file do I capture the Image from? With VMware, I do Sysprep and mount & capture the image from .vmdk file.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. chillgates

    chillgates MDL Senior Member

    Dec 15, 2010
    356
    201
    10
    I don't know about these sysrep and capturing image things. May somebody see this thread and reply you. I suggest my friend for you @Tiger-1
     
  3. pix

    pix MDL Member

    Nov 3, 2008
    136
    96
    10
    Which aspects of vbox do you prefer to Vmware, apart from cost?
     
  4. chillgates

    chillgates MDL Senior Member

    Dec 15, 2010
    356
    201
    10
    when trying to install linux on vmware it gave some error but i didn't get that error in virtualbox. i forgot what that error was.
     
  5. parafer

    parafer MDL Member

    Dec 20, 2016
    164
    105
    10
    When you create a VM with VirtualBox, you have various format options: VDI (default) but also VHD. When you create the VM using VHD you can later mount the volume with Disk Manager (included with Windows), which will allow you to capture it. Once you've created and configured the VM with VHD you can go ahead and install Windows as you would; after last boot during Windows install, don't customize anything regarding the user account, only press keys CTRL-SHIFT-F3. Then Windows will reboot into audit mode. Once OS loads, the little sysprep dialogue pops up -- it will do this each time you reboot from here on, and each time you can exit (x) the sysprep dialogue (you only use this when the install is updated and you're ready to finalize). Then once you're done with updating the image, perhaps installing runtimes or some other things you want to include, you can then finalize by choosing OOBE->Generalize->Shutdown. Sysprep dialogue will show a progress bar until done and then the VM shuts down.

    You can then mount the VM (as it is VHD format) with Disk Manager. At this point several drive letters, one with mounted install, will show up in explorer. Personally I use some scripts and have very whittled down (couple of mb's) components from WAIK and WADK (Win7, 10, etc) that the scripts refer to, and upon running the scripts it'll start capturing the image. There are some good little apps you can use the capture, too, I have used my method so long I don't even look around anymore :) But this is the process in a nutshell.
     
  6. ceo54

    ceo54 MDL Addicted

    Aug 13, 2015
    867
    361
    30
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. parafer

    parafer MDL Member

    Dec 20, 2016
    164
    105
    10
    Yes. VB, upon creating of a VM will ask you which format you want to create, and this includes the VHD option. It's nice VB offers that option natively, no converting necessary. Like I said, you can just use Disk Manager within Windows to mount the VHD. Open Disk Manager, go to Action -> Attach VHD and navigate to the location of VB VM (by default %UserProfile%\VirtualBox VMs) and select the VHD, and it will then mount it. Looks like you have the rest under control, I also use DISM (as part of the WAIK/WADK files I mentioned) and use these switches to capture:
    Code:
    /Capture-Image /Compress:max /ImageFile:D:\install11Pro64-2021.09.17.wim /CaptureDir:I:\ /Name:"Windows 11 Pro"
    where in this instance D:\ stands for the drive it saves to, and I:\ stand for the drive letter of the mounted VHD; and of course the "install11Pro64-2021.09.17.wim" is just the name I give the wim to distinguish it but you could just name it install.wim.
     
  8. ceo54

    ceo54 MDL Addicted

    Aug 13, 2015
    867
    361
    30
    Many thanks for all the help parafer. Highly appreciated. Two questions though, does the VM's are created at the root of userprofiles orm like VMware in the documents folder? and what'ds this Disk manager you talk about? I haven't encountered it in my 8 years operating windows.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. parafer

    parafer MDL Member

    Dec 20, 2016
    164
    105
    10
    I said "Disk Manager" didn't I? :D I meant "Disk Management." Just go to Control Panel -> Administrative Tools -> Computer Management and then click Disk Management under Storage in the nav pane there. Or, just type in Disk Management in start menu search and it'll come up. I always run an automated start menu sorting that creates some shortcuts to the more "hidden" utils in the OS, so I always have a Disk Management shortcut in my start menu by default so I kind of forgot to mention how to get there :)

    As for the default location of VB VMs -- say your user profile is named ceo54, it'll be at this addess: C:\Users\ceo54\VirtualBox VMs

    PS: If you want to make a shortcut for Disk Management then this is the target: C:\Windows\System32\diskmgmt.msc
     
  10. ceo54

    ceo54 MDL Addicted

    Aug 13, 2015
    867
    361
    30
    Time to fire up another machine. Thanks parafer.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  11. ceo54

    ceo54 MDL Addicted

    Aug 13, 2015
    867
    361
    30
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  12. Tito

    Tito Super Mod / Adviser
    Staff Member

    Nov 30, 2009
    18,681
    18,589
    340
    @ceo54 and others

    Created a separate thread, please continue here.
     
  13. ceo54

    ceo54 MDL Addicted

    Aug 13, 2015
    867
    361
    30
    Thanks Tito, the title of the thread however should be capturing image using VirtualBox is what we're discussing.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  14. Carlos Detweiller

    Carlos Detweiller Emperor of Ice-Cream

    Dec 21, 2012
    6,342
    7,060
    210
    ImDisk can mount VDI, no problem here. I'm using ImageX for capturing to WIM.
     
  15. ceo54

    ceo54 MDL Addicted

    Aug 13, 2015
    867
    361
    30
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  16. Carlos Detweiller

    Carlos Detweiller Emperor of Ice-Cream

    Dec 21, 2012
    6,342
    7,060
    210
    Preferences, I guess. I mostly just figure out the correct command lines once and then reuse them over and over, again.
     
  17. ceo54

    ceo54 MDL Addicted

    Aug 13, 2015
    867
    361
    30
    This is the command I use with Dism, always have. Initial command has always been the same, added more switches as I learned more :)

    Code:
    dism /capture-image /imagefile:c:\temp\install.wim /capturedir:z:\ /name:2004_SINGLELANGUAGE_X64_EN-US /description:2004_SINGLELANGUAGE_X64_EN-US /ConfigFile:c:\wimscript.ini /compress:maximum /checkintegrity /verify /bootable
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  18. AeonX

    AeonX MDL Addicted

    May 24, 2013
    793
    719
    30
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  19. sonic9

    sonic9 MDL Member

    Aug 4, 2009
    151
    54
    10
    vhd is ok with vmware ( vhdx not supported yet ).
    it cannot create vhd but it works with existing vhd (eg: created from Disk Management).
    dism support offline image from mounted vhd. (dism doesn't like mounted vmdk by vmware)