Skip to content

Instantly share code, notes, and snippets.

@SteveL-MSFT
Created December 12, 2025 18:54
Show Gist options
  • Select an option

  • Save SteveL-MSFT/ae3131b6632dcfdf338fa6e11f40913e to your computer and use it in GitHub Desktop.

Select an option

Save SteveL-MSFT/ae3131b6632dcfdf338fa6e11f40913e to your computer and use it in GitHub Desktop.
$out = @{}
$cpus = Get-CimInstance win32_processor -Property Name,NumberOfCores,MaxClockSpeed,NumberOfEnabledCore
$hyperThreadEnabled = $cpus[0].NumberOfCores -ne $cpus[0].NumberOfEnabledCore
$out.Compute = @{
Name = $cpus[0].Name
Cores = $cpus[0].NumberOfCores
MaxClockSpeedMHz = $cpus[0].MaxClockSpeed
HyperThreadingEnabled = $hyperThreadEnabled
Count = $cpus.Count
}
$out.Network = @()
$nics = Get-CimInstance Win32_NetworkAdapter -Filter 'NetConnectionStatus = 2'
foreach ($nic in $nics) {
$nicconfig = $nic | Get-CimAssociatedInstance -ResultClassName Win32_NetworkAdapterConfiguration
$out.Network += @{
Name = $nic.Name
MACAddress = $nicconfig.MACAddress
IPAddresses = $nicconfig.IPAddress
DHCPServer = $nicconfig.DHCPServer
DNSServers = $nicconfig.DNSServerSearchOrder
IPSubnetMasks = $nicconfig.IPSubnet
DefaultGateways = $nicconfig.DefaultIPGateway
}
}
$out | ConvertTo-Json -Depth 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment