我正在尝试安装一个ISO,我想联系一个驱动器的字母与该安装。我想指定驱动器字母为Y:\以下不工作,谁能帮我。谢谢
#Variable Declaration
$isoImg = "P:\Software\Windows10CurrentVersion\Windows10.iso"
#Mount ISO and Gather Drive Letter
Mount-DiskImage -ImagePath $isoImg -PassThru | Out-Null
#Obtain Drive Letter
$driveletter = (Get-DiskImage $isoImg | Get-Volume).DriveLetter发布于 2020-05-01 10:55:31
您可以挂载ISO并接受(目前)自动分配的驱动器号。以后可以更改它,但是您需要作为管理员运行它:
# the full path to the ISO file
$isoPath = "P:\Software\Windows10CurrentVersion\Windows10.iso"
# mount the ISO, but first check if it is already mounted
$isoDrive = Get-DiskImage -ImagePath $isoPath
if (!$isoDrive) {
$isoDrive = Mount-DiskImage -ImagePath $isoPath -PassThru
}
# $isoDrive is a Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_DiskImage
# get the DriveLetter currently assigned to the drive (a single [char])
$isoLetter = ($isoDrive | Get-Volume).DriveLetter为这个驱动器重命名驱动程序。
此部分需要作为管理员运行
# find the volume by its automatically assigned driveletter and set the new drive letter
$drive = Get-WmiObject Win32_Volume -Filter ('DriveLetter = "{0}:"' -f $isoLetter)
$drive.DriveLetter = 'Y:'
$null = $drive.Put()若要卸下iso驱动器:
$isoDrive | Dismount-DiskImage | Out-Null希望这有帮助
发布于 2022-09-17 20:47:17
您可以挂载ISO映像,然后像下面这样分配驱动器号:
# ISO image - replace with path to ISO to be mounted
$isoImg = "P:\Software\Windows10CurrentVersion\Windows10.iso"
# Drive letter - use the required drive letter instead of Y:
$driveLetter = "Y:"
# Mount the ISO, without having a drive letter auto-assigned
$diskImg = Mount-DiskImage -ImagePath $isoImg -NoDriveLetter
# Get mounted ISO volume
$volInfo = $diskImg | Get-Disk | Get-Partition | Get-Volume
# Mount volume with specified drive letter (requires Administrator access)
mountvol $driveLetter $volInfo.UniqueIdhttps://stackoverflow.com/questions/61535306
复制相似问题