Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have some virtual hard disks mounted on my company's web server, but any time I have to reboot it to install Windows Updates, I have to manually reattach the VHDs. I'm guessing there's no built-in way to tell the OS to persist VHD attachments across reboots, so is there a command line interface I can use to create a batch script that will reattach them on reboot? Or what is the best solution to this issue?

share|improve this question

diskpart is the command-line interface for managing VHDs (along with many other facets of the Windows disk subsystem).

For your specific question, put these lines in a file:

select vdisk file=<full path to VHD>
attach vdisk

and then run it with type <filename> | diskpart.

That said, there may well be a way to persist these connections, but I don't know of one.

share|improve this answer

maybe diskparts automount enable command.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.