#title CPU 정보 알아내는 Cscript [[TableOfContents]] ==== cscript ==== {{{ Dim objWMIService, colItems, objItem, strComputer, intSocketsTotal, strSocketsAll Const wbemFlagReturnImmediately = &h10 Const wbemFlagForwardOnly = &h20 strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Processor", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly) strSocketsAll = "" intSocketsTotal = 0 For Each objItem In colItems Wscript.Echo "Socket Name: " & objItem.SocketDesignation If Instr(strSocketsAll, objItem.SocketDesignation) = 0 Then intSocketsTotal = intSocketsTotal + 1 strSocketsAll = strSocketsAll & objItem.SocketDesignation End If Next WScript.Echo "Socket Count: " & intSocketsTotal set wmi_service = GetObject("winmgmts:\\" & server_name) set wmi_objectset = wmi_service.InstancesOf("Win32_Processor") for each wmi_object in wmi_objectset wscript.echo "Clock Speed: " & cstr(wmi_object.MaxClockSpeed) & " GHz" wscript.echo "Core Count: " & cstr(wmi_object.NumberOfCores) next set wmi_service = nothing }}} 실행예제 {{{ C:\>cscript cpucount2.vbs Microsoft (R) Windows Script Host 버전 5.7 Copyright (C) Microsoft Corporation 1996-2001. All rights reserved. Socket Name: Socket 775 Socket Count: 1 Clock Speed: 2400 GHz Core Count: 4 }}} * Socket Name: 소켓 이름이다. * Socket Count: 소켓이 1개. 즉, 물리적인 CPU개수를 말한다. * Clock Speed: CPU 스피드다. * Core Count: 코어수다. ==== sql ==== {{{ SELECT [value_in_use] AS [MAXDOP], os.* FROM sys.configurations, (SELECT COUNT (DISTINCT [parent_node_id]) AS [Nodes], COUNT (*) AS [Cores] FROM sys.dm_os_schedulers WHERE [status] = 'VISIBLE ONLINE') AS os WHERE [name] = 'max degree of parallelism'; GO }}} ==== 하이퍼 쓰레딩(hyper-threading) 확인까지 ==== {{{ wmic path Win32_processor get NumberOfCores, NumberOfLogicalProcessors }}} 결과: hyper threading이 enable된 경우 {{{ D:\>wmic path Win32_processor get NumberOfCores, NumberOfLogicalProcessors NumberOfCores NumberOfLogicalProcessors 4 8 D:\> }}} cmd에서 {{{ wmic }}} wmic의 shell(?)에서.. {{{ wmic:root\cli> CPU Get NumberOfCores,NumberOfLogicalProcessors /Format:List }}} attachment:CPU정보알아내는Cscript/hyper_threading.png