none
Having trouble retrieving "DsmPathId" from the WMI Class "MPIO_DSM_PATH_V2" Namespace "wmi" RRS feed

  • General discussion

  • I've tried both the "Execquery" and "Get" methods Below is the skinny-down VBScript script I'm trying to create (below). I get back a "null" I'm trying to get the PathIDs for each "Disk drive" as seen under the Device Manager --> Disk drives (pick a drive). Open "Properties" select the "MPIO" tab, and under the DSM NAME "Microsoft DSM" in the "This device has the following paths:" (window) listed is the "PathId", "Path State", and the "Weight". This can also be seen using the MPClaim command specifying the disk ID. The purpose of this is to read both the number of paths recognized by MPIO and the Path Ids seen in DSM for each device presented from our SAN storage. We are having a problem when a leg is removed and restored DSM is not reading it to the available path list. It appears PNP realizes that the path is returned to the server and the MPIO captures that but DSM doesn't appear to automatically perform the addDevice and ultimately perform the IoAttachDeviceToDeviceStack. This is a relatively large SQL Farm Cluster 6 nodes with over 180 LUNs and aprox 60 SQL instances running. because of the time it takes to manually capture this information for every device when the individual path-legs are removed and re-added we have not been able to correctly trouble shoot the issue. I'm attempting to create a script through WMI that is faster that either manually of manipulating MPClaim results. This is where I am with the Script:

    Dim wmi
    Set wmi = GetObject("winmgmts://" + "." + "/root/WMI")
    Dim mpio_disks
    Set mpio_disks = wmi.ExecQuery("SELECT * FROM MPIO_DISK_INFO")

    For Each disk In mpio_disks
     WScript.Echo disk.NumberDrives
     WScript.Echo disk.InstanceName
            Dim mpio_drives
            mpio_drives = disk.DriveInfo
            For Each drive In mpio_drives
      Dim name
      name = drive.Name
      Dim numberpaths
      numberpaths = drive.NumberPaths
      Dim sn
      sn = drive.SerialNumber
      Dim space
      sp=" "
      WScript.Echo name & path & space & sn

      Dim objWMIService
      Set objWMIService = GetObject("winmgmts://" + "." + "/root/wmi") 
      Dim objItem
      wmiQuery = "mpio_dsm_path_v2"
      Set objItem = objWMIService.Get(wmiQuery)
      WScript.Echo objItem.DsmPathId     
            Next
    Next

    The first part of the script works I just having trouble with the MPIO_DSM_PATH_V2 section...

    By the way if this is Ed I'm grateful to you for your book Windows Scripting with WMI - Self paced Learning Guide...if you could point me to where I'm getting it wrong I greatly appreciate it.

    Thank you, -Doug

    Wednesday, June 13, 2018 9:26 PM

All replies

  • Let's remove all of the unneeded code and junk.

    Set wmi = GetObject("winmgmts://" + "." + "/root/WMI")
    Set mpio_disks = wmi.ExecQuery("SELECT * FROM MPIO_DISK_INFO")
    
    For Each disk In mpio_disks
    
    	WScript.Echo disk.NumberDrives
    	WScript.Echo disk.InstanceName
    	
    	For Each drive In disk.DriveInfo
    	
    		WScript.Echo drive.Name, drive.SerialNumber, drive.NumberPaths
    		
    		Set objItem = wmi.Get("mpio_dsm_path_v2")
       		WScript.Echo objItem.DsmPathId
       		  
    	Next
    Next
    

    Based no this what is your issue?  Saying you have "a problem" is of no help.  Remember that we don't have your system and cannot see your screen.


    \_(ツ)_/

    Wednesday, June 13, 2018 9:42 PM
  • The following will help clarify MPIO class usage:

    http://wutils.com/wmi/root/wmi/mpio_disk_info/vbscript-samples.html


    \_(ツ)_/

    Wednesday, June 13, 2018 9:45 PM
  • Unfortunately I'm unable to include images to better present my problem. Possibly a Microsoft security housekeeping policy. I get a warning  that I cannot add "[...]images or links until my account is verified". If you know...Who can I reach out to to be verified?

    Without images below I'll try again to better explain my problem.  

    First, Thank you very much for responding so quickly and showing me how to simplify my script...the result I get with your script is the same as the result I got with my original script. To your point the problem I'm having is I can't seem to collect the information I'm looking for - the list of PathIDs associsated with each SAN LUN, and according to every thing I've read they should be under "DsmPathId". Below is a partial image of the result showing devices with 1 path and devices with 8 paths.

    [Image1 removed] - My image showed the following out out:

    Type, DiskID, wwn, Number of paths and below each the the resulting "null"  where I would have expected the list of pathIDs

    eg.

    MPIO  Disk0  60000970000192605679533031333341 8

    null

    MPIO  Disk1  60000970000192605679533031333342 1

    null

    I'm trying to collect each "PathId" for each LUN presented to the server. Iwas expecting them to list under the line with the wwn and number of paths. The Path IDs appear under the Device Manager, under Properties, under the MPIO tab as seen in the below image.

    [Image2 removed] This was an image showing the "Disk Drive" list in Device Manager right clicking on one of them and selecting properties...then selecting the MPIO tab to list the MPIO information revealing the PathID(s) list.

    This information can also be gathered using the MPClaim command below

    [Image3 removed] This image show the two MPClaim commands to capture the PathID list for a single LUN device

    As mentioned before the purpose of this script is to capture the state of these LUNs (all of them) both what MPIO sees and what DSM sees between maintenance work where we remove a path leg away and restore it one leg at a time. We have found that although PNP appears to recognizing the paths and updating MPIO it is not being restored to Microsoft Default DSM correctly. 

    I hope this is clearer...I'm not sure why I can't include the images at this time - will try and figure that out - and thank you again! –Doug

    Thursday, June 14, 2018 3:41 PM
  • You don't need images. Copy and paste the output and/or errors as text. (I personally strongly dislike images that contain screen shots of errors because you can't copy and paste from them to get the error text.)

    -- Bill Stewart [Bill_Stewart]

    Thursday, June 14, 2018 3:53 PM
    Moderator
  • OK...

    parcel output from current script...

    C:\Scripts\MPIO_Active_Paths>cscript NewMPIOPathStatus.vbs
    Microsoft (R) Windows Script Host Version 5.8
    Copyright (C) Microsoft Corporation. All rights reserved.

    20
    Root\MPIO\0000_0
    MPIO Disk0 60000970000192605652533030374245 8
    null
    MPIO Disk1 60000970000192605652533030374534 8
    null
    MPIO Disk2 60000970000192605652533030374538 8
    null
    MPIO Disk3 60000970000192605652533030374543 8
    null
    MPIO Disk4 60000970000192605652533030304338 1
    null
    MPIO Disk5 60000970000192605652533030304339 1
    null
    MPIO Disk6 60000970000192605652533030304341 1
    null
    MPIO Disk7 60000970000192605652533030304342 1
    null
    MPIO Disk8 60000970000192605652533030304330 1
    null
    MPIO Disk9 60000970000192605652533030304331 1
    null
    MPIO Disk10 60000970000192605652533030304332 1
    null
    MPIO Disk11 60000970000192605652533030304333 1

    Unable to show Windows "Device Manager" properties

    the following are the tow MPClaim commands to get to the PathIDs

    Command 1 and results

    C:\Users\caldwed>MPClaim -s -d

    For more information about a particular disk, use 'mpclaim -s -d #' where # is the MPIO disk number.

    MPIO Disk    System Disk  LB Policy    DSM Name
    -------------------------------------------------------------------------------
    MPIO Disk19  Disk 19      RR           Microsoft DSM
    MPIO Disk18  Disk 18      RR           Microsoft DSM
    MPIO Disk17  Disk 17      RR           Microsoft DSM
    MPIO Disk16  Disk 16      RR           Microsoft DSM
    MPIO Disk15  Disk 15      RR           Microsoft DSM
    MPIO Disk14  Disk 14      RR           Microsoft DSM
    MPIO Disk13  Disk 13      RR           Microsoft DSM
    MPIO Disk12  Disk 12      RR           Microsoft DSM
    MPIO Disk11  Disk 11      RR           Microsoft DSM
    MPIO Disk10  Disk 10      RR           Microsoft DSM
    MPIO Disk9   Disk 9       RR           Microsoft DSM
    MPIO Disk8   Disk 8       RR           Microsoft DSM
    MPIO Disk7   Disk 7       RR           Microsoft DSM
    MPIO Disk6   Disk 6       RR           Microsoft DSM
    MPIO Disk5   Disk 5       RR           Microsoft DSM
    MPIO Disk4   Disk 4       RR           Microsoft DSM
    MPIO Disk3   Disk 3       RR           Microsoft DSM
    MPIO Disk2   Disk 2       RR           Microsoft DSM
    MPIO Disk1   Disk 1       RR           Microsoft DSM
    MPIO Disk0   Disk 0       RR           Microsoft DSM

    second command selecting a single Disk number

    C:\Users\caldwed>MPClaim -s -d 1

    MPIO Disk1: 08 Paths, Round Robin, ALUA Not Supported
        Controlling DSM: Microsoft DSM
        SN: 60000970000192605652533030374534
        Supported Load Balance Policies: FOO RR RRWS LQD WP LB

        Path ID          State              SCSI Address      Weight
        ---------------------------------------------------------------------------
        0000000077010003 Active/Optimized   001|000|003|001   0
        0000000077010002 Active/Optimized   001|000|002|001   0
        0000000077010001 Active/Optimized   001|000|001|001   0
        0000000077010000 Active/Optimized   001|000|000|001   0
        0000000077000003 Active/Optimized   000|000|003|001   0
        0000000077000002 Active/Optimized   000|000|002|001   0
        0000000077000001 Active/Optimized   000|000|001|001   0
        0000000077000000 Active/Optimized   000|000|000|001   0

    Thursday, June 14, 2018 5:02 PM
  • I'm closer...

    Script

    Set wmi = GetObject("winmgmts://" + "." + "/root/WMI")
    Set mpio_disks = wmi.ExecQuery("SELECT * FROM MPIO_DISK_INFO")

    For Each disk In mpio_disks

     WScript.Echo disk.NumberDrives
     WScript.Echo disk.InstanceName
     
     For Each drive In disk.DriveInfo
     
      WScript.Echo drive.Name, drive.SerialNumber, drive.NumberPaths
      
      Set objItems = wmi.ExecQuery("SELECT * FROM MPIO_Path_INFORMATION")
         For Each objItem in objItems
       WScript.Echo objItem.numberPaths
       WScript.Echo ObjItem.PathList
      Next
     Next
    Next

    Result:

    C:\Scripts\MPIO_Active_Paths>cscript NewMPIOPathStatus_ExecQuery.vbs
    Microsoft (R) Windows Script Host Version 5.8
    Copyright (C) Microsoft Corporation. All rights reserved.

    20
    Root\MPIO\0000_0
    MPIO Disk0 60000970000192605652533030374245 8
    8
    C:\Scripts\MPIO_Active_Paths\NewMPIOPathStatus_ExecQuery.vbs(16, 4) Microsoft VBScript runtime error: Type mismatch

    Thursday, June 14, 2018 5:52 PM
  • No Longer using the MPIO_DSM_Path_V2 class I'm now using the MPIO_PATH_INFORMATION class and as you can see under the first LUN wwn instance I'm collecting the number of paths and getting a mismatch error.

    -Doug

    Thursday, June 14, 2018 5:56 PM
  • This is your issue.

     Set objItem = objWMIService.Get(wmiQuery)

    To use get to get a singleton you must use the singletons name.

    wmiQuery = "root\WMI\mpio_dsm_path_v2: Name ='MPIO DISK NAME'"


    \_(ツ)_/

    Thursday, June 14, 2018 6:16 PM
  • Well, Ive been at it for a while and I wasn't able to figure it out yet based on the above last two posts....I didn't see a lot in my book about "singletons". Just a quick section on "isSingleton"...I'll keep looking. Thank you
    Friday, June 15, 2018 5:42 AM