Retrrieve detailed System Information with PowerShell PowerShell, with its robust capabilities, provides a powerful solution for gathering detailed information about your computer. This article introduces a PowerShell script created to retrieve Detailed System Information with PowerShell, ranging from basic specifications to more advanced hardware and network information.
Purpose of the Script
The primary objective of the provided PowerShell script is to offer a consolidated view of your computer’s configuration. By leveraging various Win32 classes, the script fetches details about the computer system, operating system, processor, memory, hard disks, and network adapters.
Createing the Script to retrieve system information with PowerShell
# Retrieve Enhanced System Information with PowerShell
# Get general system information
$systemInfo = Get-CimInstance -ClassName Win32_ComputerSystem
if (-not $?) { Write-Host "Error retrieving system information. Check your permissions and try again." Pause exit
}
# Get operating system information
$osInfo = Get-CimInstance -ClassName Win32_OperatingSystem
if (-not $?) { Write-Host "Error retrieving operating system information." Pause exit
}
# Get processor information
$processorInfo = Get-CimInstance -ClassName Win32_Processor
if (-not $?) { Write-Host "Error retrieving processor information." Pause exit
}
# Get memory information
$memoryInfo = Get-CimInstance -ClassName Win32_PhysicalMemory
if (-not $?) { Write-Host "Error retrieving memory information." Pause exit
}
# Get hard disk information
$diskInfo = Get-CimInstance -ClassName Win32_DiskDrive
if (-not $?) { Write-Host "Error retrieving hard disk information." Pause exit
}
# Get network adapter information
$networkAdapters = Get-CimInstance -ClassName Win32_NetworkAdapterConfiguration | Where-Object { $_.IPEnabled -eq $true }
if (-not $?) { Write-Host "Error retrieving network adapter information." Pause exit
}
# Display system information
Write-Host "System Information:"
Write-Host "-------------------"
Write-Host "Manufacturer: $($systemInfo.Manufacturer)"
Write-Host "Model: $($systemInfo.Model)"
Write-Host "Device Name: $($systemInfo.Name)"
Write-Host "Device ID: $($systemInfo.DeviceID)"
Write-Host "Product ID: $($systemInfo.Product)"
Write-Host "System Type: $($systemInfo.SystemType)"
Write-Host "Windows Edition: $($osInfo.Caption)"
Write-Host "Windows Version: $($osInfo.Version)"
Write-Host "Processor: $($processorInfo.Name)"
Write-Host "Memory: $($memoryInfo.Capacity / 1GB) GB"
# Display hard disk information
Write-Host "`nHard Disk Information:"
Write-Host "------------------------"
foreach ($disk in $diskInfo) { Write-Host "Disk: $($disk.DeviceID)" Write-Host " Model: $($disk.Model)" Write-Host " Capacity: $($disk.Size / 1GB) GB"
}
# Display network adapter information
Write-Host "`nNetwork Adapter Information:"
Write-Host "----------------------------"
foreach ($adapter in $networkAdapters) { Write-Host "Adapter: $($adapter.Description)" Write-Host " MAC Address: $($adapter.MACAddress)" Write-Host " IP Address(es): $($adapter.IPAddress -join ', ')"
}
# Pause to allow users to see the output
PauseRunning the Script
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUserConclusion
Run the script, explore your system details, and enhance your understanding of the underlying infrastructure.


