write new files to vhd

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of Odie Odie 1 year, 9 months ago.

  • Author
    Posts
  • #22430
    Profile photo of Odie
    Odie
    Participant

    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
    Profile photo of Craig Martin
    Craig Martin
    Member

    I've been doing just that, using Mount-WindowsImage:
    https://technet.microsoft.com/en-us/library/hh852120.aspx

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

  • #22439
    Profile photo of Odie
    Odie
    Participant

    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.