Skip to content
/ WinMnt Public

Command-line interface utility to mount disk image files on Windows via REST API

License

Notifications You must be signed in to change notification settings

milcert/WinMnt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

WinMnt

WinMnt is a command-line interface utility that allows the mounting of image files on Windows via REST API.

  • Supported disk files: VHD(X), VMDK, RAW, WIM, XVA
  • Supported filesystems: FAT, NTFS, EXT, HFS, SquashFS, XFS, ISO9660, UDF

This project is based on the following open-source libraries:

Requirements

Usage example

  • Run the binary with the desired parameters (by default it listens on localhost:5000)
  • Mount a disk via the REST API, for example with Powershell
# Helper functions

function WinMnt-Request($method, $endpoint, $body) {
	$uri = "http://localhost:5000/api" + $endpoint
	$header = @{
		"Content-Type" = "application/json"
	}
	if ((!($body -is [string])) -and ($body -ne $null)) {
		$body = "'" + ($body | ConvertTo-Json) + "'"
	}
	return Invoke-RestMethod -Uri $uri -Method $method -Body $body -Headers $header
}

function WinMnt-IsOnline {
	try {
		WinMnt-Request "GET" "/status" $null | Out-Null
		return $true
	} catch {
		return $false
	}
}

# Test connection
if (!(WinMnt-IsOnline)) {
	Write-Host "WinMnt is not yet ready!"
	Exit 1
}

# Load an image
$r = WinMnt-Request "POST" "/image" @{
	FilePath = "Z:\\Disk.vmdk"
}

$id = $r.id
$id

# Get information about the partitions
$info = WinMnt-Request "GET" "/image/$id/info" $null
$info | fl *

# Mount all the volumes (to mount a specific volume set the index)
$r = WinMnt-Request "POST" "/image/$id/mount" @{
	VolumeIndex = -1
	ShowMetaFiles = $true
	ReadOnly = $true
}

# Show mounted volumes
$r = WinMnt-Request "GET" "/image/$id/mount" $null
$r | fl *

# Wait for user input
[System.Console]::ReadKey() | Out-Null

# Unmount volumes (to unmount all, use index -1)
$r = WinMnt-Request "POST" "/image/$id/unmount" @{
	VolumeIndex = -1
}

# Graceful shutdown
$r = WinMnt-Request "POST" "/service" @{
	Shutdown = $true
}

License

MIT License

About

Command-line interface utility to mount disk image files on Windows via REST API

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages