title: MPIO Disk active path
body: <p>I was using the below mentioned VBScript to collect the MPIO Disk active path information from multiple servers. I was trying to convert the VBScript to a PowerShell module, but am unable to find the appropriate class or get the values as expected.</p>
  
  <pre class="lang-vb prettyprint-override"><code>Dim oFSO, oTSIn, oTSOut
  Set oFSO = CreateObject("Scripting.FileSystemObject")
  Set oTSOut = oFSO.CreateTextFile("results.txt")
  Set oTSIn = oFSO.OpenTextFile("servers.txt")
  
  Do Until oTSIn.AtEndOfStream
      sServerName = oTSIn.ReadLine
      intFreeSpace6=sServerName
      oTSOut.WriteLine intFreeSpace6
  
      On Error Resume Next
      Const wbemFlagReturnImmediately = &amp;h10
      Const wbemFlagForwardOnly = &amp;h20
  
      Dim wmi
      Set wmi = GetObject("winmgmts://" + sServerName + "/root/WMI")
  
      Dim mpio_disks
      Set mpio_disks = wmi.ExecQuery("SELECT * FROM MPIO_DISK_INFO")
  
      For Each disk In mpio_disks
          Dim mpio_drives
          mpio_drives = disk.DriveInfo
  
          For Each drive In mpio_drives
              Dim name
              name = drive.Name
  
              Dim paths
              paths = drive.NumberPaths
  
              Dim space
              space="= "
  
              oTSOut.WriteLine name &amp; space &amp; paths
  
              'WScript.Echo  name &amp; paths 
          Next
      Next
  Loop
  
  oTSIn.Close
  oTSOut.Close
  MsgBox "Finished!"
  </code></pre>
  
  <p>PowerShell command tried is below but not able to get the path information:</p>
  
  <pre class="lang-psh prettyprint-override"><code>$MPIODisks = Get-WmiObject -Namespace "root\wmi" -Class mpio_disk_info -ComputerName "$Server" |
               Select-Object "DriveInfo"
  
  Write-Host "Host Name : " $Server
  
  foreach ($Disk in $MPIODisks) {
      $mpiodrives = $disk.DriveInfo
  
      foreach ($Drive in $mpiodrives) {
          Write-Host "Drive : " $Drive.Name
          Write-Host "Path : " $Drive.Numberpath
      }
  }
  </code></pre>
  
  <p>It is giving output as mentioned below:</p>
  
  <pre class="lang-none prettyprint-override"><code>Drive :  MPIO Disk0
  Path :
  Drive :  MPIO Disk1
  Path :
  Drive :  MPIO Disk2
  Path :
  Drive :  MPIO Disk3
  Path :
  Drive :  MPIO Disk4
  Path :
  Drive :  MPIO Disk6
  Path :
  Drive :  MPIO Disk7
  Path :
  Drive :  MPIO Disk8
  Path :
  Drive :  MPIO Disk10
  Path :
  </code></pre>