I am developing a computer inventory program for the company where I work which is able to identify hardware and other features of the machine, however in the inventory it should go:
- windows distribution
- product id
- installed license and
- BIOS license
This last one has been impossible to obtain since I do not know how to find the OEM license of the BIOS of the PC, I have developed the program in JAVA.
I tried to use this code but it does not work, it stays in a kind of LOOP but I do not know why,
String comando = "powershell.exe (Get-WmiObject -query 'SELECT OEMStringArray FROM Win32_ComputerSystem').OA3xOriginalProductKey ";
Process p = Runtime.getRuntime().exec(comando);
String line;
System.out.println("Standard Output:");
BufferedReader stdout = new BufferedReader(new InputStreamReader(
p.getInputStream()));
while ((line = stdout.readLine()) != null) {
System.out.println("hola");
System.out.println(line);
}
stdout.close();
System.out.println("Standard Error:");
BufferedReader stderr = new BufferedReader(new InputStreamReader(
p.getErrorStream()));
while ((line = stderr.readLine()) != null) {
System.out.println(line);
}
stderr.close();
System.out.println("Done");