Powershell: Comandos para extraer hardware
Empezamos el año 2024 con un poco de “comandeo”…
Hoy os traigo una entrada en la que revisaremos comandos de Powershell para extraer información del hardware de nuestros equipos.
Comando Powershell para extraer datos de CPU
Si queremos extraer información general:
1 2 3 4 5 6 7 8 9 |
PS C:\WINDOWS\system32> Get-WmiObject CIM_Processor Caption : Intel64 Family 6 Model 158 Stepping 10 DeviceID : CPU0 Manufacturer : GenuineIntel MaxClockSpeed : 2400 Name : Intel(R) Core(TM) i5-9300H CPU @ 2.40GHz SocketDesignation : U3E1 |
Si queremos extraer la familia de nuestro procesador podemos usar:
1 2 |
PS C:\WINDOWS\system32> (Get-WmiObject Win32_Processor).caption Intel64 Family 6 Model 158 Stepping 10 |
El tipo de arquitectura:
1 2 |
PS C:\WINDOWS\system32> (Get-WmiObject Win32_ComputerSystem).SystemType x64-based PC |
Nombre procesador:
1 2 |
PS C:\WINDOWS\system32> (Get-WmiObject Win32_Processor).name Intel(R) Core(TM) i5-9300H CPU @ 2.40GHz |
Velocidad procesador:
1 2 |
PS C:\WINDOWS\system32> ((Get-WmiObject Win32_Processor).name).split("@")[1] 2.40GHz |
Extraer número de cores:
1 2 3 4 5 |
PS C:\WINDOWS\system32> Get-WmiObject -Class Win32_Processor | Select -Property Name, Number* Name NumberOfCores NumberOfEnabledCore NumberOfLogicalProcessors ---- ------------- ------------------- ------------------------- Intel(R) Core(TM) i5-9300H CPU @ 2.40GHz 4 4 8 |
Carga procesador:
1 2 3 4 5 6 7 8 9 10 11 12 |
PS C:\WINDOWS\system32> Get-WmiObject win32_processor | Select-Object LoadPercentage LoadPercentage -------------- 4 PS C:\WINDOWS\system32> Get-WmiObject win32_processor | Select-Object LoadPercentage LoadPercentage -------------- 3 |
Comando Powershell para extraer datos de Memoria
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
PS C:\WINDOWS\system32> Get-WmiObject CIM_PhysicalMemory | Select-Object BankLabel, Manufacturer, PartNumber, SerialNumber, Capacity, Speed, ConfiguredClockSpeed, ConfiguredVoltage BankLabel : BANK 0 Manufacturer : 859B PartNumber : CT16G4SFRA32A.M16FR SerialNumber : E7E32CE2 Capacity : 17179869184 Speed : 3200 ConfiguredClockSpeed : 2667 ConfiguredVoltage : 1200 BankLabel : BANK 2 Manufacturer : 859B PartNumber : CT16G4SFRA32A.M16FR SerialNumber : E7E3300D Capacity : 17179869184 Speed : 3200 ConfiguredClockSpeed : 2667 ConfiguredVoltage : 1200 |
Extraer la suma en GB:
1 2 3 |
PS C:\WINDOWS\system32> $ramtotal = Get-WmiObject CIM_PhysicalMemory | Select-Object -ExpandProperty Capacity | Measure-Object -Sum PS C:\WINDOWS\system32> $ramtotal.Sum/1GB 32 |
Extraer datos de memoria caché:
1 2 3 4 5 6 7 8 9 10 |
Get-WmiObject Win32_AssociatedProcessorMemory Get-WmiObject Win32_CacheMemory PS C:\WINDOWS\system32> Get-WmiObject Win32_CacheMemory | Select-Object DeviceID,MaxCacheSize DeviceID MaxCacheSize -------- ------------ Cache Memory 0 256 Cache Memory 1 1024 Cache Memory 2 8192 |
Otros datos:
1 2 3 4 5 6 7 8 9 |
Get-WmiObject Win32_MemoryArray Get-WmiObject Win32_MemoryArrayLocation Get-WmiObject Win32_MemoryDevice Get-WmiObject Win32_MemoryDeviceArray Get-WmiObject Win32_MemoryDeviceLocation Get-WmiObject Win32_PhysicalMemory Get-WmiObject Win32_PhysicalMemoryArray Get-WmiObject Win32_PhysicalMemoryLocation Get-WmiObject Win32_SMBIOSMemory |
Comando Powershell para extraer datos chip TPM
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
PS C:\WINDOWS\system32> Get-WmiObject -Namespace root/cimv2/security/microsofttpm -Class Win32_TPM __GENUS : 2 __CLASS : Win32_Tpm __SUPERCLASS : __DYNASTY : Win32_Tpm __RELPATH : Win32_Tpm=@ __PROPERTY_COUNT : 10 __DERIVATION : {} __SERVER : NUCEXTREME9 __NAMESPACE : root\cimv2\security\microsofttpm __PATH : \\NUCEXTREME9\root\cimv2\security\microsofttpm:Win32_Tpm=@ IsActivated_InitialValue : True IsEnabled_InitialValue : True IsOwned_InitialValue : True ManufacturerId : 1229870100 ManufacturerIdTxt : INTC ManufacturerVersion : 403.1.0.0 ManufacturerVersionFull20 : 403.1.0.0 ManufacturerVersionInfo : Intel PhysicalPresenceVersionInfo : 1.3 SpecVersion : 2.0, 0, 1.38 PSComputerName : NUCEXTREME9 |
Comando Powershell para extraer número de serie
1 |
Get-WmiObject Win32_Bios | Select-Object -ExpandProperty Serialnumber |
Comando Powershell para extraer información general Sistema Operativo
1 |
Get-ComputerInfo -Property "os*" |
Comando powershell para extraer datos de la bios
1 2 3 4 5 6 7 8 |
PS C:\WINDOWS\system32> Get-CimInstance -ClassName Win32_BIOS SMBIOSBIOSVersion : QXCFL579.0071.2022.1130.1331 Manufacturer : Intel Corp. Name : QXCFL579.0071.2022.1130.1331 SerialNumber : JRQN0000000S Version : INTEL - 47 |
Comando Powershell para extraer datos placa base
1 2 3 4 5 6 7 8 9 |
PS C:\WINDOWS\system32> Get-WmiObject win32_baseboard Manufacturer : Intel Corporation Model : Name : Placa base SerialNumber : KNQN000000J4 SKU : Product : NUC9i5QNB |
Comando que combina mucha información del sistema:
1 |
Get-WmiObject win32_baseboard; Get-WmiObject Win32_Bios; Get-WmiObject win32_physicalmemory | Select Manufacturer,Banklabel,Configuredclockspeed,Devicelocator,Capacity,Serialnumber; Get-ComputerInfo OSName, OsArchitecture |
Comando Poweshell extraer datos tarjetas de red
Tarjetas de red activas:
1 2 3 4 5 6 |
PS C:\WINDOWS\system32> Get-NetAdapter -physical| where status -eq 'up' Name InterfaceDescription ifIndex Status MacAddress LinkSpeed ---- -------------------- ------- ------ ---------- --------- LAN01 Intel(R) I210 Gigabit Network Connec... 14 Up A4-AE-11-1E-CB-71 1 Gbps LAN02 Intel(R) Ethernet Connection (7) I21... 7 Up A4-AE-11-1E-CB-72 1 Gbps |
Información de todas las tarjetas de red de sistemas:
1 2 3 4 5 6 7 8 9 10 |
PS C:\WINDOWS\system32> netsh interface ipv4 show interfaces Índ Mét MTU Estado Nombre --- ---------- ---------- ------------ --------------------------- 1 75 4294967295 connected Loopback Pseudo-Interface 1 21 50 1500 disconnected WLAN01 13 25 1500 disconnected Conexión de área local* 1 10 25 1500 disconnected Conexión de área local* 2 8 65 1500 disconnected Conexión de red Bluetooth 5 20 1500 connected LANTEAMING |
Te ha gustado la entrada SGUENOS EN TWITTER O INVITANOS A UN CAFE?