Skip Ribbon Commands
Skip to main content

Ondrej Sevecek's English Pages


Engineering and troubleshooting by Directory Master!
MCM: Directory

Quick Launch

Ondrej Sevecek's English Pages > Posts > The best ever sollution on how to write a file into virtual floppy diskette (VFD) in PowerShell
January 17
The best ever sollution on how to write a file into virtual floppy diskette (VFD) in PowerShell

Am I not a genius? You cannot mount Hyper-V VFD files programatically on any Windows edition with libraries that come from-the-box. So how do you plug a custom autounattend.xml or anything else into a VFD file that you need to attach to a VM?

You just create an empty VFD file from a VM. You then creaft a textual file with an appropriate name (such as the autounattend.xml in my case). You first create the empty file on harddisk where you open it and fill it with some marker character, such as XXXXXXX in my case. You fill it up to some reasonable size to accomodate the biggest data that you might possibly intend to inject into the VFD floppy diskette in the future.

Then you take the file full with the selected marker character and copy it into the floppy diskette. The file does not get fragmented, as the diskette is empty and you just copied it onto it in a sequential manner. You dismount the VFD from your VM and here you go. Now you have a VFD file which contains monolythic block of your marker character bytes.

Then you develop a simple script in PowerShell that rewrites the marker bytes (in the offline VFD file) with whatever data you want to inject inito the diskette. If the source data to be injected is smaller than the marker block, you just pad it with something valid from the file perspective, such as spaces in case of my XML file.

Yeeeees. Call me genius!

If you were interested in a sample source code, I have a function called Replace-MarkerSequence included within my ADLAB library here.



can i get some more help on this i searching for these type of thing but i am very new to powershell or any type of programming can i get some help more detailed on this with some screen shots

mail me on please
 on 19/10/2015 07:36

Add Comment

Sorry comments are disable due to the constant load of spam *

This simple antispam field seems to work well. Just put here the number.


You do not need to provide any value this column. It will automatically fill with the name of the article itself.

Author *

Body *