Jump to content

Recommended Posts

Posted (edited)


Hello everyone. When I run the code below on my x64 computer, the results are zero. #AutoIt3Wrapper_UseX64=y When I add this command, it works, but I want to compile the script as x86. Can you help me? Sorry for my bad English. 

#RequireAdmin
;#AutoIt3Wrapper_UseX64=y ;;;Is there a way to run it without this command?

$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$strComputer = "localhost"

$Output=""
$Output = $Output & "Computer: " & $strComputer  & @CRLF
$Output = $Output & "==========================================" & @CRLF
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_WinSAT", "WQL", _
                                          $wbemFlagReturnImmediately + $wbemFlagForwardOnly)

If IsObj($colItems) then
   For $objItem In $colItems
      $Output = $Output & "CPUScore: " & $objItem.CPUScore & @CRLF
      $Output = $Output & "D3DScore: " & $objItem.D3DScore & @CRLF
      $Output = $Output & "DiskScore: " & $objItem.DiskScore & @CRLF
      $Output = $Output & "GraphicsScore: " & $objItem.GraphicsScore & @CRLF
      $Output = $Output & "MemoryScore: " & $objItem.MemoryScore & @CRLF
      $Output = $Output & "TimeTaken: " & $objItem.TimeTaken & @CRLF
      $Output = $Output & "WinSATAssessmentState: " & $objItem.WinSATAssessmentState & @CRLF
      $Output = $Output & "WinSPRLevel: " & $objItem.WinSPRLevel & @CRLF
      if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop
      $Output=""
   Next
Else
   Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_WinSAT" )
Endif
Edited by ufukkreis853
Posted (edited)
4 hours ago, ufukkreis853 said:

Can you help me?

https://learn.microsoft.com/en-us/windows/win32/api/winsatcominterfacei/ne-winsatcominterfacei-winsat_assessment_state

https://www.windowsdigitals.com/winsat-windows-experience-index-score-windows-11/

Microsoft Windows [Version 10.0.26100.2033]
(c) Microsoft Corporation. All rights reserved.

C:\Windows\System32>winsat formal
Windows System Assessment Tool
Error: Unable to run inside of a Virtual Machine.  Please try again running directly on the native hardware.

 

Edited by argumentum

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted
9 hours ago, argumentum said:

https://learn.microsoft.com/en-us/windows/win32/api/winsatcominterfacei/ne-winsatcominterfacei-winsat_assessment_state

https://www.windowsdigitals.com/winsat-windows-experience-index-score-windows-11/

Microsoft Windows [Version 10.0.26100.2033]
(c) Microsoft Corporation. All rights reserved.

C:\Windows\System32>winsat formal
Windows System Assessment Tool
Error: Unable to run inside of a Virtual Machine.  Please try again running directly on the native hardware.

 

winsat /formal I get an error when using this command in powershell x86. It works when using it in x64, but there is no change in the script I created.

sshot-1.png

sshot-2.png

  • Solution
Posted

Based on previous post, I came up with this :

#include <Constants.au3>

Local $oWbem = ObjCreate("WbemScripting.SWbemNamedValueSet")
If Not IsObj($oWbem) Then Exit MsgBox($MB_OK, "Wbem", "Object not found")
$oWbem.Add("__ProviderArchitecture", 64)
$oWbem.Add("__RequiredArchitecture", True)
Local $oLoc = ObjCreate("Wbemscripting.SWbemLocator")
If Not IsObj($oLoc) Then Exit MsgBox($MB_OK, "Locator", "Object not found")
Local $oServer = $oLoc.ConnectServer(".", "root\cimV2", "", "", "", "", 0, $oWbem)
If Not IsObj($oServer) Then Exit MsgBox($MB_OK, "WMI server", "Object not found")

Local $oItems = $oServer.ExecQuery("SELECT * FROM Win32_WinSAT")
If Not IsObj($oItems) Then Exit MsgBox($MB_OK, "WMI Output", "No WMI Objects Found for class: Win32_WinSAT")
Local $sOutput
For $oItem In $oItems
  $sOutput = $sOutput & "CPUScore: " & $oItem.CPUScore & @CRLF
  $sOutput = $sOutput & "D3DScore: " & $oItem.D3DScore & @CRLF
  $sOutput = $sOutput & "DiskScore: " & $oItem.DiskScore & @CRLF
  $sOutput = $sOutput & "GraphicsScore: " & $oItem.GraphicsScore & @CRLF
  $sOutput = $sOutput & "MemoryScore: " & $oItem.MemoryScore & @CRLF
  $sOutput = $sOutput & "TimeTaken: " & $oItem.TimeTaken & @CRLF
  $sOutput = $sOutput & "WinSATAssessmentState: " & $oItem.WinSATAssessmentState & @CRLF
  $sOutput = $sOutput & "WinSPRLevel: " & $oItem.WinSPRLevel & @CRLF
Next

MsgBox($MB_OK, "WMI Output", $sOutput)

Not sure if this will work for you, but it does for me.  Any case, you got something to work with...

Posted
12 minutes ago, Nine said:

Önceki yazıyı temel alarak şunu düşündüm :

#include <Constants.au3>

Yerel  $oWbem  =  ObjCreate ( "WbemScripting.SWbemNamedValueSet" ) IsObj Değilse ( $oWbem ) MsgBox'tan Çık ( $ 
MB_OK ,  " Wbem " , " Nesne bulunamadı " ) $ oWbem.Add ( " __ProviderArchitecture " , 64 ) $ oWbem.Add ( " __RequiredArchitecture" , True ) Yerel $ oLoc = ObjCreate ( "Wbemscripting.SWbemLocator" ) IsObj Değilse ( $ oLoc ) MsgBox'tan Çık ( $ MB_OK , "Konum Belirleyici" , "Nesne bulunamadı" ) Yerel $ oServer = $ oLoc . ConnectServer ( "." , "root\cimV2" , "" , "" , "" , "" , 0 , $oWbem ) Eğer Değilse IsObj ( $oServer ) Sonra Çık MsgBox ( $MB_OK , "WMI sunucusu" , "Nesne bulunamadı" )      
 
 
   
       
          
       

Yerel  $oItems  =  $oServer . ExecQuery ( "SELECT * FROM Win32_WinSAT" ) 
Eğer  Değilse  IsObj ( $oItems )  Then  Exit  MsgBox ( $MB_OK ,  "WMI Çıktısı" ,  "Sınıf için WMI Nesnesi Bulunamadı: Win32_WinSAT" ) 
Yerel  $sÇıktı 
$oItem İçin  $oItems İçinde $sÇıktı = $sÇıktı & "CPUSPuanı: " & $oItem . CPUPuanı & @CRLF $sÇıktı = $sÇıktı & "D3DSPuanı: " & $oItem . D3DSPuanı & @CRLF $sÇıktı = $sÇıktı & "DiskPuanı: " & $oItem . DiskScore & @CRLF $sÇıktı = $sÇıktı & "GrafikPuanı: " & $oItem . GraphicsScore & @CRLF $sOutput = $sOutput & "MemoryScore: " & $oItem . MemoryScore & @CRLF $sOutput = $sOutput & "TimeTaken: " & $oItem . TimeTaken & @CRLF $sOutput = $sOutput & "WinSATAssessmentState: " & $oItem . WinSATAssessmentState & @CRLF $sOutput = $sOutput & "WinSPRLevel: " & $oItem . WinSPRLevel & @CRLF Sonraki  
          
          
          
          
          
          
          
          


MsgBox ( $MB_OK ,  "WMI Çıktısı" ,  $sÇıktısı )

Bunun sizin için işe yarayıp yaramayacağından emin değilim ama benim için işe yarıyor. Her durumda, işe yarayacak bir şeyiniz var...

thank you very much

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...