Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
675 views
in Technique[技术] by (71.8m points)

com - Create ISO image using PowerShell: how to save IStream to file?

I want to create an ISO image, so a .iso file, on Windows. This is possible to do using COM component IMAPI2FS.MsftFileSystemImage, and I found instructions on how to do this using PowerShell in an MSDN blog post entitled "Writing optical discs using IMAPI 2 in powershell".

After step 3, those instructions say that "at this step you can stop and save resulted image to the local hard disc, this will be a pure iso image."

My question: How do I take $resultStream, i.e., a COM object that results from retrieving an ImageStream, in PowerShell and save its contents to a file?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You need to use FileStream writer. Check this link for an example of how it is done in c#. http://tools.start-automating.com/Install-ExportISOCommand/?-Download

The function there can be used to create cmdlets that help you create ISO. For example,

Run Install-ExportISOCommand This creates Export-Iso

Then, use Export-ISO to create an ISO.

Export-Iso -ISOPath C:dropboxest.iso -FileName C:DropboxScripts

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...