Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can do this via a WMI query. The following script puts the SocketDesignation name for each logical CPU in a database table for the list of servers in the csv file. Once the table is populated running the following query will give you a count of physical and logical processors:</p> <pre><code>select servername, COUNT(cpuname) 'LogicalCPUCount', COUNT(distinct cpuname) 'PhysicalCPUCount' from tmp_cpu group by servername </code></pre> <p>***** WMI script - you will need to adjust connections and create the tmp_cpu table prior to running *****</p> <pre><code>$query = "delete sqlserverinventory.dbo.tmp_cpu" Invoke-Sqlcmd -Query $query -ServerInstance "xxxxxxxx" Invoke-Sqlcmd -Query "select servername from sqlserverinventory.dbo.server where servername in (select servername from sqlserverinventory.dbo.vw_Instance_Autoload);" -ServerInstance "xxxxxxxx" | out-file -filepath "v:\scripts\server_list.csv" (Get-Content v:\scripts\server_list.csv) | where {$_.readcount -gt 3} | Set-Content v:\scripts\server_list.csv $servers = Get-Content "V:\scripts\server_list.csv" ## $servers = Invoke-Sqlcmd -Query "select servername from sqlserverinventory.dbo.vw_Instance_Autoload;" -ServerInstance "xxxxxxxx" foreach ($server in $servers){ $server = $server.Trim() $SQLServices = Get-WmiObject -ComputerName $server -Namespace "root\CIMV2" -query "SELECT SocketDesignation FROM Win32_Processor where CPUStatus=1 or CPUStatus=4" forEach ($SQLService in $SQLServices) { $PhysicalCPU = $SQLService.SocketDesignation $insert_query = "INSERT INTO sqlserverinventory.dbo.tmp_cpu (ServerName,CPUName) VALUES('$server','$PhysicalCPU')" ## "sql - $insert_query" Invoke-Sqlcmd -Query $insert_query -ServerInstance "xxxxxxxx" } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload