🙃
ConsoleWrite("- Is Windows 11: " & _IsWindows_11() & @CRLF)
;ConsoleWrite("- Is Windows Server 2022: " &_IsWindows_22() & @CRLF)
Func _IsWindows_11()
If StringInStr(@OSVersion, "11") Or StringInStr(_GetOS_Name(), "11") Then Return 1
Return 0
EndFunc ;==>_IsWindows_11
Func _IsWindows_22()
If StringInStr(@OSVersion, "22") Or StringInStr(_GetOS_Name(), "22") Then Return 1
Return 0
EndFunc ;==>_IsWindows_22
Func _GetOS_Name()
Local $OSname, $objItem = "", $strComputer = ".", $wbemFlagReturnImmediately = 0x10, $wbemFlagForwardOnly = 0x20
Local $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\")
Local $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem", "WQL", _
$wbemFlagReturnImmediately + $wbemFlagForwardOnly)
If IsObj($colItems) Then
For $objItem In $colItems
$OSname = $objItem.Caption
ConsoleWrite("> System: " & $OSname & @CRLF)
Return $OSname
Next
Else
ConsoleWrite("! No WMI Objects Found for class: Win32_OperatingSystem" & @CRLF)
Return SetError(1, 0, "")
EndIf
EndFunc ;==>_GetOS_Name
; DAO VAN TRONG - TRONG.LIVE