Package com.ferrumx.formatter.cim
Class CIM_SL
java.lang.Object
com.ferrumx.formatter.cim.CIM_SL
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 TypeMethodDescriptionstatic 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 methodsstatic 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
-
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 methodproperty
- 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 errorsIndexOutOfBoundsException
- in case of text parsing issues from power-shellShellException
- if any internal command used in the power-shell throws errorsInterruptedException
- 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 methoddeterminantProperty
- a filtering parameter, passed to by the calling methoddeterminantValue
- the value of the filtering parameter, also passed to by the calling methodextractProperty
- 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 errorsIndexOutOfBoundsException
- in case of text parsing issues from power-shellShellException
- if any internal command used in the power-shell throws errorsInterruptedException
- 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();
-