File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -681,11 +681,9 @@ def _get_gpu_info():
681681def _get_total_memory ():
682682 """Return the total memory of the system in bytes."""
683683 if platform .system () == "Windows" :
684+ ps = shutil .which ("pwsh" ) or shutil .which ("powershell" )
684685 o = subprocess .check_output (
685- [
686- "powershell.exe" ,
687- "(Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory" ,
688- ]
686+ [ps , "-c" , "(Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory" ]
689687 ).decode ()
690688 # Can get for example a "running scripts is disabled on this system"
691689 # error where "o" will be a long string rather than an int
@@ -708,8 +706,9 @@ def _get_total_memory():
708706def _get_cpu_brand ():
709707 """Return the CPU brand string."""
710708 if platform .system () == "Windows" :
709+ ps = shutil .which ("pwsh" ) or shutil .which ("powershell" )
711710 o = subprocess .check_output (
712- ["powershell.exe " , "(Get-CimInstance Win32_Processor).Name" ]
711+ [ps , "-c " , "(Get-CimInstance Win32_Processor).Name" ]
713712 ).decode ()
714713 cpu_brand = o .strip ().splitlines ()[- 1 ]
715714 elif platform .system () == "Linux" :
You can’t perform that action at this time.
0 commit comments