I am currently having an error with getting the hardware id for a very specific PC, i have been using the following code and it has been working on a lot of PC's but suddenly the following error happened with 1 PC
The code that i am using:
hardware_id = subprocess.check_output('wmic csproduct get uuid').decode().split('\n')[1].strip()
I am compiling my python files using Pyinstaller and I get the following error with this specific PC:
csproduct - Alias not found
Traceback (most recent call last):
...
subprocess.CalledProcessError: Command 'wmic csproduct get uuid' returned returned non-zero exit status 44135
[8920] Failed to excute script app
I would appreciate it if someone tells me why this error is happening with this specific PC and how can I fix it
The OS for the PC I am talking about is Windows 10
First notice that WMIC is deprecated. You will eventually want to switch to PS cmdlets.
The next step to debug this would be to see what, if anything, is available from wmic csproduct
by calling wmic csproduct get
without specifying UUID as the key to get.
You will likely find that the UUID is not available to WMI. This is very likely because the customer of yours with the OS you don't control is using a hacked/modified/unlicensed copy of windows or a modified SMBIOS. There could be other explanations, but that's the most likely. Correcting that isn't really something within your power.
If you want to investigate further you could use PS:
Get-WmiObject -Class Win32_ComputerSystemProduct | Select-Object -Property UUID
However, you will find the UUID isn't there (otherwise wmic would have returned it).