Skip to main content
Delphix

Get-WmiObject Fails with Invalid Class MSiSCSIInitiator_SessionClass in LUN Mount Scripts (KBA1104)

 

KBA

KBA#1104

 

Applicable Delphix Versions

Click here to view the versions of the Delphix engine to which this article applies
Major Release All Sub Releases
6.0 6.0.0.0, 6.0.1.0, 6.0.1.1

5.3

5.3.0.0, 5.3.0.1, 5.3.0.2, 5.3.0.3, 5.3.1.0, 5.3.1.1, 5.3.1.2, 5.3.2.0, 5.3.3.0, 5.3.3.1, 5.3.4.0, 5.3.5.0 5.3.6.0, 5.3.7.0, 5.3.7.1, 5.3.8.0, 5.3.8.1

5.2

5.2.2.0, 5.2.2.1, 5.2.3.0, 5.2.4.0, 5.2.5.0, 5.2.5.1, 5.2.6.0, 5.2.6.1

5.1

5.1.0.0, 5.1.1.0, 5.1.2.0, 5.1.3.0, 5.1.4.0, 5.1.5.0, 5.1.5.1, 5.1.6.0, 5.1.7.0, 5.1.8.0, 5.1.8.1, 5.1.9.0, 5.1.10.0

5.0

5.0.1.0, 5.0.1.1, 5.0.2.0, 5.0.2.1, 5.0.2.2, 5.0.2.3, 5.0.3.0, 5.0.3.1, 5.0.4.0, 5.0.4.1 ,5.0.5.0, 5.0.5.1, 5.0.5.2, 5.0.5.3, 5.0.5.4

4.3

4.3.1.0, 4.3.2.0, 4.3.2.1, 4.3.3.0, 4.3.4.0, 4.3.4.1, 4.3.5.0

4.2

4.2.0.0, 4.2.0.3, 4.2.1.0, 4.2.1.1, 4.2.2.0, 4.2.2.1, 4.2.3.0, 4.2.4.0 , 4.2.5.0, 4.2.5.1

4.1

4.1.0.0, 4.1.2.0, 4.1.3.0, 4.1.3.1, 4.1.3.2, 4.1.4.0, 4.1.5.0, 4.1.6.0

Issue

On Windows platforms used as Delphix targets or staging environments for SQL Server virtualization there can be an issue where a Windows Management Interface (WMI) Object throws an invalid class or missing namespace/class exception when calling iSCSI APIs for LUN discovery. This can prevent operations such as VDB refreshes or Environment Discovery/Refreshes from succeeding causing downtime.

This example output can be executed on the affected machine to isolate the issue if the MSiSCSIInitiator_SessionClass is implicated in the error:

PS C:\Windows\system32> Get-WmiObject -Class MSiSCSIInitiator_SessionClass -Namespace root/wmi -ComputerName CUPWD02A001
0
Get-WmiObject : Invalid class "MSiSCSIInitiator_SessionClass"
At line:1 char:1
+ Get-WmiObject -Class MSiSCSIInitiator_SessionClass -Namespace root/wmi -Computer ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidType: (:) [Get-WmiObject], ManagementException
    + FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand

When this occurs, complete the following steps to resolve the issue so Delphix operations can proceed successfully.

A normal output of the command above looks like this:

PS C:\Windows\system32> Get-WmiObject -Class MSiSCSIInitiator_SessionClass -Namespace root/wmi -ComputerName .


__GENUS               : 2
__CLASS               : MSiSCSIInitiator_SessionClass
__SUPERCLASS          :
__DYNASTY             : MSiSCSIInitiator_SessionClass
__RELPATH             : MSiSCSIInitiator_SessionClass.SessionId="fffffa8006a92020-4000013700000004"
__PROPERTY_COUNT      : 8
__DERIVATION          : {}
__SERVER              : 10-43-5-235
__NAMESPACE           : root\wmi
__PATH                : \\10-43-5-235\root\wmi:MSiSCSIInitiator_SessionClass.SessionId="fffffa8006a92020-40000137000000
                        04"
ConnectionInformation : {1 0}
Devices               : {}
InitiatorName         : iqn.1991-05.com.microsoft:10-43-5-235.ad.delphix.com
ISID                  : {64, 0, 1, 55...}
SessionId             : fffffa8006a92020-4000013700000004
TargetName            : iqn.2008-07.com.delphix:02:555f540e-85c6-ee4f-f7d2-8fc4ba6c88ad
TargetNodeName        :
TSID                  : {8, 0}
PSComputerName        : 10-43-5-235
                                                                                   

Note with ComputerName you can run the command remotely, replacing "." with the remote hostname. Administrative access is likely required when running this command remotely. In general, the Delphix OS user for target environments (or staging) is going to run this command in the mount scripts such as DiscoverLunData.ps1 and MountLunData.ps1.  You are best to login as this user when troubleshooting the issue.

Troubleshooting

As an example - this issue can throw the following text during a failed action, in this case an Environment refresh:

Action Information : ACTION-981542
 Action                        981542
 Work Source Ref               USER-2                    : 
 Action Type                   ENVIRONMENT_CREATE
 Work Source                   WEBSERVICE
 Start Time                    2020-04-03 21:03:12 UTC
 State                         FAILED
 End Time                      2020-04-03 21:03:19 UTC
 Parent Action                 ACTION-981540
 Parent Job                    JOB-35038
 User Agent                    None
 Description ID                event.action.environment.create
 Description Params            ["Windows_Target_Host.com"]
 Description Message           Create environment "Windows_Target_Host.com".
 Fail Message ID               exception.windowshost.iscsi.add.persistent_target.failed
 Fail Message Params           (2)                           
  Windows_Target_Host.com       
  Microsoft iSCSI Initiator Version 10.0 Build 17763

  The operation completed successfully.
  Microsoft iSCSI Initiator Version 10.0 Build 17763

  The operation completed successfully.

  Microsoft DiskPart version 10.0.17763.1

  Copyright (C) Microsoft Corporation.
  On computer: Windows_Target_Host

  Please wait while DiskPart scans your configuration...

  DiskPart has finished scanning your configuration.

  Leaving DiskPart...
  Microsoft iSCSI Initiator Version 10.0 Build 17763

  The target has already been logged in via an iSCSI session.
  Get-WmiObject : Invalid class "MSiSCSIInitiator_PersistentLoginClass"
  At C:\Program Files\Delphix\DelphixConnector\discovery\422d9737-b637-4d74-d345-c6d548620e42-WINDOWS_HOST_ENVIRONMENT-18\AddPersistentLoginTarget.ps1:88 char:15
  + ...   $object = Get-WmiObject -namespace root/wmi -query "select Initiato ...
  +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : InvalidType: (:) [Get-WmiObject], ManagementException
      + FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand

  Get-WmiObject : Invalid class "MSiSCSIInitiator_SessionClass"
  At C:\Program Files\Delphix\DelphixConnector\discovery\422d9737-b637-4d74-d345-c6d548620e42-WINDOWS_HOST_ENVIRONMENT-18\AddPersistentLoginTarget.ps1:110 char:8
  + $obj = Get-WmiObject -namespace root/wmi -query "select SessionId fro ...
  +        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : InvalidType: (:) [Get-WmiObject], ManagementException
      + FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand

  die : Error: Login to target 192.168.196.50 (port 3260) failed: -268500929
  At C:\Program Files\Delphix\DelphixConnector\discovery\422d9737-b637-4d74-d345-c6d548620e42-WINDOWS_HOST_ENVIRONMENT-18\AddPersistentLoginTarget.ps1:26 char:9
  +         die "$($args[0])"
  +         ~~~~~~~~~~~~~~~~~
      + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
      + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,die


 Fail Message Desc             Failed to add or update the iSCSI persistent login target on host "Windows_Target_Host.com".

We can see that this script is failing:

C:\Program Files\Delphix\DelphixConnector\discovery\422d9737-b637-4d74-d345-c6d548620e42-WINDOWS_HOST_ENVIRONMENT-18\AddPersistentLoginTarget.ps1

This is found under the DelphixConnector installation on the target host.  You can open this script and you can copy the command that is failing.  We can see in the above sample there are a few commands failing.  You can look for the text indicated in the exception to determine the entire command, since the exception text is truncated:

Get-WmiObject : Invalid class "MSiSCSIInitiator_PersistentLoginClass"
  At C:\Program Files\Delphix\DelphixConnector\discovery\422d9737-b637-4d74-d345-c6d548620e42-WINDOWS_HOST_ENVIRONMENT-18\AddPersistentLoginTarget.ps1:88 char:15
  + ...   $object = Get-WmiObject -namespace root/wmi -query "select Initiato ...
  +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : InvalidType: (:) [Get-WmiObject], ManagementException
      + FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand

Open the script and look for the text - either above that is bolded - and copy the command and also the @targetiqn variable:

@targetiqn:

  $targetiqn = "iqn.2008-07.com.delphix:02:14664fec-531a-493f-f2d3-9167cc5a3c02" 

The command query from this function:

function getInitiator($targetiqn) {

    $object = Get-WmiObject -namespace root/wmi -query "select InitiatorInstance from MSiSCSIInitiator_PersistentLoginClass where TargetName='$targetiqn'"
    $initiatorInstance = $object.InitiatorInstance
    if ($initiatorInstance -ne $null) {
       return $initiatorInstance
    }
    return $null
}

Copy the bolded query, substitute the @targetiqn variable with the actual value and execute.  Here is a sample from a live Windows host:

Get-WmiObject -namespace root/wmi -query "select InitiatorInstance from MSiSCSIInitiator_PersistentLoginClass where TargetName='iqn.2008-07.com.delphix:02:14664fec-531a-493f-f2d3-9167cc5a3c02'"

You can expect output similar to the following if the class is present and not in a corrupted state:

 PS C:\Program Files\Delphix\DelphixConnector\discovery\42014938-7059-8d2d-cf36-23d9fa6e58d5-WINDOWS_HOST_ENVIRONMENT-1> Get-WmiObject -namespace root/wmi -query "select InitiatorInstance from MSiSCSIInitiator_PersistentLoginClass where TargetName='iqn.2008-07.com.delphix:02:14664fec-531a-493f-f2d3-9167cc5a3c02'"

__GENUS           : 2
__CLASS           : MSiSCSIInitiator_PersistentLoginClass
__SUPERCLASS      : 
__DYNASTY         : 
__RELPATH         : 
__PROPERTY_COUNT  : 1
__DERIVATION      : {}
__SERVER          : 
__NAMESPACE       : 
__PATH            : 
InitiatorInstance : ROOT\ISCSIPRT\0000_0
PSComputerName    :  

 

Resolution

This is likely an issue with the Windows host and will require the Windows administrator to resolve.

Provided here are the suggestions from Microsoft Technet that can provide relief but this must be reviewed and sanctioned by the Windows administrator.

There are two blogs to review:

First is this MSFT blog on repairing things with the  WMI Objects.

https://blogs.technet.microsoft.com/askperf/2014/08/11/wmi-missing-or-failing-wmi-providers-or-invalid-wmi-class/

Title is "WMI: Missing or Failing WMI Providers or Invalid WMI class"

Before following instructions to recompile the "cob" file (to recompile into repository), the Admin (someone with the elevated privileges) can run wbemtest:

  1. Click Connect.
  2. In namespace field type root\wmi, and then click Connect.

wbemtest01.png

  1. Click Enum Classes.
  2. Select Recursive, and then click OK.

wbemtest02.png

  1. All top level classes display - scroll through and look for "MSiSCSIInitiator_SessionClass"

wbemtest3.png

If the class is missing then you can recompile it running the following command on the missing repository, iscsidsc.mof.  You can change to the "C:\windows\system32\wbem" directory to make sure the mof file, iscsidsc.mof, is there.  If it is not then the Windows administrator needs to be engaged in that portion of discovering and installing the software

Recompiling the missing class

PS C:\windows\system32\wbem> mofcomp.exe iscsidsc.mof
Microsoft (R) MOF Compiler Version 6.2.9200.16384
Copyright (c) Microsoft Corp. 1997-2006. All rights reserved.
Parsing MOF file: iscsidsc.mof
MOF file has been successfully parsed
Storing data in the repository...
Done!

This blog provides more information about the iscsidsc.mof file:

https://msdn.microsoft.com/en-us/library/windows/desktop/ee676434(v=vs.85).aspx

The mof name is: Iscsidsc.mof

The blog explains how to run the compile command - from a command prompt with admin and elevated privileges.  Even if the class is present in the listing, you may still consider running the recompile. However, you can also consult with Microsoft support to provide more peace of mind.

The Second option for troubleshooting that is more complicated and involves a test script to run the query is the download for a visual basic script, Scriptomatic 2.2.  This tool can be used to check if the class is present or working. Again, this is for the Windows administrator/expert to review and determine if it is the best course of action.

https://gallery.technet.microsoft.com/scriptcenter/Scriptomatic-21-aka-shame-9cdc28b5

[Readme of original version]: https://technet.microsoft.com/en-us/scriptcenter/dd939957.aspx

This tool can be used to load the ROOT\WMI and check the class list to see if the MSiSCSIInitiator_SessionClass class is present or not.

You run ScriptomaticV2.2.hta with Microsoft HTML Application Host. From file explorer, you can use "Open with" and select it.)

Here's an example of using it to check for the class (In this sample the class is available):

script01.png

You'll select root\WMI from WMI Namespace pulldown. Then select MSiSCSIInitiator_SessionClass from the WMI Class pulldown.  If the class is not available then it is likely missing and you can review the steps above on recompiling the WMIObject that is missing.

script02.png

Sometimes while loading the classes you see this popup. Click No and repeat. It may happen 5 or more times:

script03.png

When the class script is visible click Run and you should see output like this:

script04.png

These suggestions provide you with a means to determine if the MSiSCSIInitiator_SessionClass class is missing or not. Also, if present, you can test execution to determine if there is some issue with the WMI repository with the specified class given in the exception text.

Additional Information

 

External Links