Skip to content

serverscom/ISOHelper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ISOHelper

ISOHelper is a PowerShell module for creating ISO image files from a source directory on Windows by using the native Windows IMAPI2 API.

Quick Start

Import the module and create an ISO in one command:

Import-Module .\ISOHelper.psd1
New-ISOImageFile -SourcePath 'C:\Files' -DestinationPath 'C:\Output\image.iso'

Features

  • Creates an ISO from a directory tree
  • Supports an optional volume label
  • Can include the source directory itself at the ISO root
  • Can overwrite an existing ISO file with -Force
  • Returns a FileInfo object for the created ISO

Requirements

  • Windows 10 or Windows Server 2016 or later
  • Windows PowerShell 5.1 or later, or Powershell 7.6.0 or later

This module utilizes a Windows-only API and is not supported on non-Windows platforms.

Installation

Install from PowerShell Gallery

Install-Module -Name ISOHelper -Scope CurrentUser

Install from a local folder

Clone or copy the module folder into a location on your system, then import it:

Import-Module .\ISOHelper.psd1

Or import the module file directly:

Import-Module .\ISOHelper.psm1

If the module is stored in a folder named ISOHelper, you can also import it by folder path:

Import-Module .\ISOHelper

Functions

ISOHelper exports one public function:

  • New-ISOImageFile

Usage

Create an ISO from the contents of a folder:

New-ISOImageFile -SourcePath 'C:\Files' -DestinationPath 'C:\Output\image.iso'

Create an ISO with a custom volume label and overwrite the destination if it already exists:

New-ISOImageFile -SourcePath 'C:\Files' -DestinationPath 'C:\Output\image.iso' -VolumeLabel 'MYDISC' -Force

Create an ISO where the source folder itself appears at the root of the image:

New-ISOImageFile -SourcePath 'C:\Files' -DestinationPath 'C:\Output\image.iso' -IncludeSourceDirectory

Parameters

SourcePath

Required. Path to the source directory whose contents will be added to the ISO.

DestinationPath

Required. Path to the ISO file to create. The parent directory must already exist.

VolumeLabel

Optional. Volume label for the ISO image. Default: cidata

IncludeSourceDirectory

Optional switch. When set, the source directory itself is added as a folder at the ISO root instead of only its contents.

Force

Optional switch. Overwrites an existing ISO file at the destination path.

BufferSizeMultiplier

Optional. Controls how many blocks are read per stream read call. Higher values may reduce overhead but use more memory. Default: 64

MediaType

Optional. Selects the media type used to determine default image settings. Default: IMAPI_MEDIA_TYPE_CDR

Supported values:

  • IMAPI_MEDIA_TYPE_CDR
  • IMAPI_MEDIA_TYPE_CDRW
  • IMAPI_MEDIA_TYPE_DVDRAM
  • IMAPI_MEDIA_TYPE_DVDPLUSR
  • IMAPI_MEDIA_TYPE_DVDPLUSRW
  • IMAPI_MEDIA_TYPE_DVDPLUSR_DUALLAYER
  • IMAPI_MEDIA_TYPE_DVDDASHR
  • IMAPI_MEDIA_TYPE_DVDDASHRW
  • IMAPI_MEDIA_TYPE_DVDDASHR_DUALLAYER
  • IMAPI_MEDIA_TYPE_DISK
  • IMAPI_MEDIA_TYPE_DVDPLUSRW_DUALLAYER
  • IMAPI_MEDIA_TYPE_BDR
  • IMAPI_MEDIA_TYPE_BDRE

Output

The function returns a FileInfo object for the created ISO file.

Notes

  • If the destination file already exists and -Force is not specified, the command fails.
  • The module uses a small internal C# helper to write the ISO stream to disk.
  • The destination path validation checks that the parent directory exists.
  • If another loaded module exports a function with the same name, you may need to call it by module-qualified name:
ISOHelper\New-ISOImageFile

License

This project is licensed under the terms of the included LICENSE file.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors