Search code examples
powershellpowershell-3.0virtual-drive

How to check drive is it virtual, Powershell


How to check drive is it a virtual (created using subst command)?

Get-VirtualDisk doesn't work(powershell 3.0)


Solution

  • You could extract the first character from each line of subst output into an array and check if a particular drive is contained in that array:

    $substed = subst | % { $_.Substring(0,1) + ':' }
    
    if ( $substed -contains 'x:' ) {
      # do stuff
    }