write new files to vhd

This topic contains 2 replies, has 2 voices, and was last updated by  Odie 3 years, 4 months ago.

  • Author
  • #22430


    I am trying to write a script to mount a vhd, write/copy the sysprep folder to the root of c: and then copy in an answerfile. I can mount the vhd using mount-vhd F:\test\test.vhdx and I can use get-volume to see that it is drive L: but how can I automate this so that I and mount the vhd and copy a file to it without intervention from me (or the user)? I don't know how to 'get' the drive letter and use that in a copy command.

  • #22432

    Craig Martin

    I've been doing just that, using Mount-WindowsImage:

    You assign a local path to the image, then just copy the file to that path, then dismount.

  • #22439


    Thanks for the quick reply Craig. So if I understand I would mount the vhd then copy the sysprep folder to the location specified in the -path parameter. Am I understanding?

You must be logged in to reply to this topic.