locked
Set-WMIInstance RRS feed

  • Question

  • I'm trying to setup a WMI value.   I use this command:  

    Set-WMIInstance -class "mbam_volume" -Namespace root\microsoft\mbam -argument @{ReasonsForNoncompliance=1}

    Which gives this error.  I've tried a few things but so far can't get this to work.   

    Set-WMIInstance : Unable to cast object of type 'System.Int32' to type 'System.Array'.


    mqh7

    Tuesday, March 19, 2019 5:12 PM

All replies

  • I don't have that wmi class.  I'm guessing try this from the error message:

    @{ReasonsForNoncompliance=@(1)}

    Or


    @{ReasonsForNoncompliance=[array]1}

    Converting int32 to array doesn't seem so hard to me...

    Tuesday, March 19, 2019 6:26 PM
  • Set instance cannot alter a class. It alters and instance of a class so you need to get an instance first.  If you have more than one volume the call will fail.


    \_(ツ)_/

    Tuesday, March 19, 2019 8:55 PM