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.
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.
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?