Class Win32_OperatingSystem
The following properties are fetched: Caption, InstallDate, CSName, LastBootUpTime, LocalDateTime, Distributed, NumberOfUsers, Version, BootDevice, BuildNumber, BuildType, Manufacturer, OSArchitecture, MUILanguages, PortableOperatingSystem, Primary, RegisteredUser, SerialNumber, ServicePackMajorVersion, ServicePackMinorVersion, SystemDirectory, SystemDrive, WindowsDirectory
- Author:
- Egg-03
-
Method Summary
-
Method Details
-
getOSList
public static List<String> getOSList() throws IOException, IndexOutOfBoundsException, ShellException, InterruptedExceptionFetches a list of OS Names installed in the System. In case of Multi-Boot systems, more than one OS names may appear- Returns:
- a
List
of OS Names found in the system - Throws:
IOException
- re-throws the exception thrown byCIM_ML.getPropertyValue(String, String)
when there are I/O Errors during streaming of data from and to Powershell and other generated filesIndexOutOfBoundsException
- re-throws the exception thrown byCIM_ML.getPropertyValue(String, String)
when there is a parsing error of data fetched from Windows PowershellShellException
- if any internal command used in the powershell 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();While catching any of the Exceptions, you may return an empty List to avoid any
NullPointerException
that might get thrown because your variable might be expecting a string. However, this does not make you immune from the NullPointerExceptions that may be thrown in case of powershell output format changes in the future, causing the underlying parsing logic to fail.
-
getOSInfo
public static Map<String,String> getOSInfo(String OSName) throws IOException, IndexOutOfBoundsException, ShellException, InterruptedException Fetches a OS properties for a particular OS- Parameters:
OSName
- the iterative List fetched fromgetOSList()
- Returns:
- a
Map
of OS properties and their values mentioned in the class description - Throws:
IOException
- re-throws the exception thrown byCIM_ML.getPropertiesAndTheirValuesWhere(String, String, String, String)
when there are I/O Errors during streaming of data from and to Powershell and other generated filesIndexOutOfBoundsException
- re-throws the exception thrown byCIM_ML.getPropertiesAndTheirValuesWhere(String, String, String, String)
when there is a parsing error of data fetched from Windows PowershellShellException
- if any internal command used in the powershell 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();While catching any of the Exceptions, you may return an empty Map to avoid any
NullPointerException
that might get thrown because your variable might be expecting a string. However, this does not make you immune from the NullPointerExceptions that may be thrown in case of powershell output format changes in the future, causing the underlying parsing logic to fail.
-