Mount-DiskImage using -NoDriveLetter fails

Welcome Forums General PowerShell Q&A Mount-DiskImage using -NoDriveLetter fails

This topic contains 5 replies, has 3 voices, and was last updated by

 
Participant
1 month, 3 weeks ago.

  • Author
    Posts
  • #167941

    Participant
    Topics: 37
    Replies: 155
    Points: 479
    Helping Hand
    Rank: Contributor

    I'm trying to mount an iso without a drive letter, then specify the drive letter to use.

    It works on my Windows 10 desktop but not in Windows Server 2012 R2 Standard. It should according to the documentation. I've tried running as me (i'm a local admin), and using runas local admin.

    But using the -nodriveletter switch the iso is mounted but no information is returned by the mount to $diskImg and so the process fails.

    What am I missing ?

    # ISO image - replace with path to ISO to be mounted
    $isoImg = 'C:\Install\SQLSERVERBUILD\en_sql_server_2012_developer_edition_with_sp2_x64_dvd_4668513.iso'
    # Drive letter - use desired drive letter
    $driveLetter = "Z:"
    
    # Mount the ISO, without having a drive letter auto-assigned
    $diskImg = Mount-DiskImage -ImagePath $isoImg -NoDriveLetter
    
    # Get mounted ISO volume
    $volInfo = $diskImg | Get-Volume
    
    # Mount volume with specified drive letter (requires Administrator access)
    mountvol $driveLetter $volInfo.UniqueId
    
    

     

  • #167977

    Senior Moderator
    Topics: 8
    Replies: 1041
    Points: 3,439
    Helping Hand
    Rank: Community Hero

    I can see -PassThru parameter from the docs. So you will have to use it to get the output.

    • #167980

      Participant
      Topics: 37
      Replies: 155
      Points: 479
      Helping Hand
      Rank: Contributor

      I've tried that and get a value for $diskImg but no volume uniqueid returned.....

      
      $diskImg = Mount-DiskImage -ImagePath $isoImg -NoDriveLetter -PassThru
      PS C:\Users\ibarnetson> $diskImg
      
      Attached : True
      BlockSize : 0
      DevicePath : \\.\CDROM2
      FileSize : 4011923456
      ImagePath : C:\Install\SQLSERVERBUILD\en_sql_server_2012_developer_edition_with_sp2_x64_dvd_4668513.iso
      LogicalSectorSize : 2048
      Number : 2
      Size : 4011923456
      StorageType : 1
      PSComputerName :
      
      PS C:\Users\ibarnetson> $diskImg | Get-Volume
      
      DriveLetter FileSystemLabel FileSystem DriveType HealthStatus SizeRemaining Size
      ----------- --------------- ---------- --------- ------------ ------------- ----
      L CD-ROM Healthy 0 B 0 B
      
      PS C:\Users\ibarnetson> # Get mounted ISO volume
      $volInfo = $diskImg | Get-Volume
      PS C:\Users\ibarnetson> $volInfo.UniqueId
      PS C:\Users\ibarnetson>
      
      

       

      if I run it form my WinOS 10 desktop...I get a uniqueID

      
      $diskImg = Mount-DiskImage -ImagePath $isoImg -NoDriveLetter
      PS C:\Users\ibarnetson> $diskImg | Get-Volume
      
      DriveLetter FriendlyName FileSystemType DriveType HealthStatus OperationalStatus SizeRemaining Size
      ----------- ------------ -------------- --------- ------------ ----------------- ------------- ----
      SQLServer Unknown CD-ROM Healthy OK 0 B 3.74 GB
      
      PS C:\Users\ibarnetson> # Get mounted ISO volume
      $volInfo = $diskImg | Get-Volume
      PS C:\Users\ibarnetson> $volInfo.UniqueId
      \\?\Volume{a789b0a3-ae97-11e9-9157-f859717ec1a2}\
      
      
  • #168025

    Participant
    Topics: 37
    Replies: 155
    Points: 479
    Helping Hand
    Rank: Contributor

    The -UniqueID is not available in WinOS 2012R2

  • #168073

    Participant
    Topics: 0
    Replies: 44
    Points: 235
    Helping Hand
    Rank: Participant

    @Iain
    Can you Try below as well, I don't have a test machine to test it,
    the only difference in code below is that I am also passing Storage Type with Mount-DiskImage

    # ISO image – replace with path to ISO to be mounted
    $isoImg = 'C:\Install\SQLSERVERBUILD\en_sql_server_2012_developer_edition_with_sp2_x64_dvd_4668513.iso'

    # Drive letter – use the desired drive letter
    $driveLetter = "Z:"

    # Mount the ISO, without having a drive letter auto-assigned
    Mount-DiskImage -ImagePath $isoImg  -StorageType ISO  -PassThru | Get-Volume

  • #168091

    Participant
    Topics: 37
    Replies: 155
    Points: 479
    Helping Hand
    Rank: Contributor

    Thanks Eliva, but it doesn't work.

    The Mounvol cmd requires the guid and that's not returned by mount-volume in WinOS 2012R2, only in WinOS 10 / 2016.

     

You must be logged in to reply to this topic.