Class CIM_SL

java.lang.Object
com.ferrumx.formatter.cim.CIM_SL

public class CIM_SL extends Object
This class queries all the WMI Classes based on the attributes passed to it's one of the four methods called by the methods in other packages.

Supports Single-line parsing of output from the power-shell Is recommend for extracting a single property only For multi-property extraction, see CIM_ML

Author:
Egg-03
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    getPropertyValue(String win32class, String property)
    Internally runs the command "Get-CimInstance -ClassName win32class | Select-Object property | Format-List where the parameters are provided by the calling methods
    static String
    getPropertyValueWhere(String win32class, String determinantProperty, String determinantValue, String extractProperty)
    Internally runs the command "Get-CimInstance -ClassName win32class | Where-Object {$_.determinantProperty -eq determinantValue |Select-Object extractProperty | Format-List where the parameters are provided by the calling methods

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getPropertyValue

      public static String getPropertyValue(String win32class, String property) throws IOException, IndexOutOfBoundsException, ShellException, InterruptedException
      Internally runs the command "Get-CimInstance -ClassName win32class | Select-Object property | Format-List where the parameters are provided by the calling methods
      Parameters:
      win32class - the class name passed to by the calling method
      property - a single property requested for a particular class. The property requested by the calling methods can be found in their respective class descriptions
      Returns:
      the value of the property passed in the parameter
      Throws:
      IOException - in case of general I/O errors
      IndexOutOfBoundsException - in case of text parsing issues from power-shell
      ShellException - if any internal command used in the power-shell throws errors
      InterruptedException - if the thread waiting for the process to exit, gets interrupted. When catching this exception, you may re-throw it's interrupted status by using Thread.currentThread().interrupt();
    • getPropertyValueWhere

      public static String getPropertyValueWhere(String win32class, String determinantProperty, String determinantValue, String extractProperty) throws IOException, IndexOutOfBoundsException, ShellException, InterruptedException
      Internally runs the command "Get-CimInstance -ClassName win32class | Where-Object {$_.determinantProperty -eq determinantValue |Select-Object extractProperty | Format-List where the parameters are provided by the calling methods
      Parameters:
      win32class - the class name passed to by the calling method
      determinantProperty - a filtering parameter, passed to by the calling method
      determinantValue - the value of the filtering parameter, also passed to by the calling method
      extractProperty - a single property requested for a particular class. The property requested by the calling methods can be found in their respective class descriptions
      Returns:
      a String of the attribute value requested by the calling method
      Throws:
      IOException - in case of general I/O errors
      IndexOutOfBoundsException - in case of text parsing issues from power-shell
      ShellException - if any internal command used in the power-shell throws errors
      InterruptedException - if the thread waiting for the process to exit, gets interrupted. When catching this exception, you may re-throw it's interrupted status by using Thread.currentThread().interrupt();