Use PowerShell to Get System Summary
To get a summary of your system’s hardware and software configuration using PowerShell, you can use various cmdlets and scripts to gather detailed information. Here’s a PowerShell script that provides a comprehensive system summary, including details about the operating system, processor, memory, disk, and network configuration.
PowerShell Script to Get System Summary
# Get Operating System Information
$os = Get-WmiObject -Class Win32_OperatingSystem
Write-Host "Operating System: $($os.Caption)"
Write-Host "Version: $($os.Version)"
Write-Host "Build Number: $($os.BuildNumber)"
Write-Host "Architecture: $($os.OSArchitecture)"
Write-Host "Last Boot Time: $($os.LastBootUpTime)"
Write-Host ""
# Get Processor Information
$cpu = Get-WmiObject -Class Win32_Processor
Write-Host "Processor Information:"
foreach ($processor in $cpu) {
Write-Host " Name: $($processor.Name)"
Write-Host " Cores: $($processor.NumberOfCores)"
Write-Host " Logical Processors: $($processor.NumberOfLogicalProcessors)"
Write-Host " Clock Speed: $($processor.MaxClockSpeed) MHz"
}
Write-Host ""
# Get Memory Information
$memory = Get-WmiObject -Class Win32_ComputerSystem
Write-Host "Memory Information:"
Write-Host " Total Physical Memory: $([math]::round($memory.TotalPhysicalMemory / 1GB, 2)) GB"
Write-Host " Available Physical Memory: $([math]::round($memory.FreePhysicalMemory / 1MB, 2)) MB"
Write-Host " Total Virtual Memory: $([math]::round($memory.TotalVirtualMemorySize / 1GB, 2)) GB"
Write-Host " Available Virtual Memory: $([math]::round($memory.FreeVirtualMemory / 1MB, 2)) MB"
Write-Host ""
# Get Disk Information
$disks = Get-WmiObject -Class Win32_LogicalDisk -Filter "DriveType=3"
Write-Host "Disk Information:"
foreach ($disk in $disks) {
Write-Host " Drive: $($disk.DeviceID)"
Write-Host " File System: $($disk.FileSystem)"
Write-Host " Total Size: $([math]::round($disk.Size / 1GB, 2)) GB"
Write-Host " Free Space: $([math]::round($disk.FreeSpace / 1GB, 2)) GB"
}
Write-Host ""
# Get Network Information
$networkAdapters = Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter "IPEnabled=True"
Write-Host "Network Information:"
foreach ($adapter in $networkAdapters) {
Write-Host " Adapter: $($adapter.Description)"
Write-Host " IP Address: $($adapter.IPAddress -join ', ')"
Write-Host " MAC Address: $($adapter.MACAddress)"
}
Write-Host ""
# Get System Uptime
$uptime = (Get-Date) - (gcim Win32_OperatingSystem).LastBootUpTime
Write-Host "System Uptime: $([math]::round($uptime.TotalDays, 2)) days"
How to Use This Script:
- Open Notepad and paste the script above.
- Save the file with a
.ps1
extension, e.g.,SystemSummary.ps1
. - Run the script by opening PowerShell as an Administrator:
- Right-click the Start button and select Windows PowerShell (Admin).
- Navigate to the directory where you saved the script using
cd
. - Execute the script by typing:
powershell .\SystemSummary.ps1
Explanation:
- Operating System Information: Retrieves details about the OS, including version, architecture, and last boot time.
- Processor Information: Provides details about the CPU, including name, core count, logical processors, and clock speed.
- Memory Information: Shows physical and virtual memory details, including total and available memory.
- Disk Information: Displays information about each disk drive, including size and free space.
- Network Information: Lists network adapters, IP addresses, and MAC addresses.
- System Uptime: Calculates and displays the system’s uptime since the last boot.
This script provides a quick and comprehensive overview of your system’s configuration and status.