Hi,
For this I recommend using the CIM cmdlets instead of wmic. Example below:
$csProductName = (Get-CimInstance -ClassName Win32_ComputerSystemProduct).Name
Here is older Get-WmiObject equivalent of above:
$csProductName = (Get-WmiObject -Class Win32_ComputerSystemProduct).Name
Introduction to CIM Cmdlets
https://devblogs.microsoft.com/powershell/introduction-to-cim-cmdlets/
Win32_ComputerSystemProduct class
https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-computersystemproduct
If above is useful please Accept Answer.
Thanks.
-TP