Mount an ISO on a Physical Server running Server Core

So you need to mount an ISO on a physical server that is running Windows Server 2012 R2 Server Core? If so, how would you accomplish that task without a graphical user interface?

With PowerShell of course, specifically the Mount-DiskImage PowerShell cmdlet:

mount-iso1

By default nothing is returned when using the Mount-DiskImage cmdlet and the ISO is mounted using the next available drive letter. The -PassThru parameter was specified in the previous example but notice there’s no property that that tells us which drive letter was assigned.

Let’s see if we can figure out a way to make it tell us what drive letter was assigned. Piping the previous command to Get-Member confirms that there isn’t a drive letter property:

mount-iso2

One thing to keep in mind is that if we didn’t use the -PassThru parameter to make the command produce output, piping it to Get-Member would generate an error because only commands that produce output can be piped to the Get-Member cmdlet.

Notice that piping the command to Get-Member as shown in the previous example also gave us the type of object that it produced which is specified after “TypeName:” and before the list of methods and properties.

Maybe there’s something we can pipe the results of Mount-DiskImage to that will tell us what drive letter is assigned? We can use Get-Command with the -ParameterType parameter to determine what cmdlets accept input from MSFT_DiskImage objects:

mount-iso3

Get-Volume looks promising, but let’s verify that it accepts MSFT_DiskImage objects via pipeline input because cmdlets that accept that type of object via parameter and/or pipeline input would show up in the previous set of results.

Looking at the “INPUTS” section of the help for Get-Volume confirms that it does indeed accept pipeline input for MSFT_DiskImage objects:

mount-iso5

Let’s pipe our Mount-DiskImage command to Get-Volume and see what happens:

mount-iso4

As you can see in the previous set of results, piping Mount-DiskImage to Get-Volume allows us to see what drive letter was assigned. In the previous example, drive letter ‘E’ was assigned to the ISO image that was mounted.

µ

2 Comments

  1. None

    Thank you very much for your detailed explanation and thought proceses to solve the problem. It Helped me a lot!

    Reply
  2. Peter

    Appreciate the insight here Mike!

    Reply

Leave a Reply

%d bloggers like this: