Detailed System Information with PowerShell

MicrosoftPowershellWindows

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.

PowerShell, the command-line shell and scripting language developed by Microsoft, serves as an essential tool for system administrators. Its ability to interact with system components via cmdlets allows for efficient automation and detailed information retrieval.

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

Open and text editior, copy and save the following script as RetrieveSystemInfo.ps1 or any name prefferred.

# 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
Pause

Running the Script

Before running the script, ensure that your PowerShell execution policy allows script execution. You can set it by running the powershell with admin rights and execute command below.

Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser

Script Breakdown

  1. General System Information:
    • Manufacturer
    • Model
  2. Operating System Information:
    • Caption
    • Version
  3. Processor Information:
    • Name
  4. Memory Information:
    • Capacity
  5. Hard Disk Information:
    • Device ID
    • Model
    • Capacity
  6. Network Adapter Information:
    • Description
    • MAC Address
    • IP Address(es)

Conclusion

PowerShell stands as a versatile tool for efficiently managing and retrieving information. This script provides a comprehensive overview of your system’s key components, gives you Detailed System Information with PowerShell, enabling administrators to make informed decisions and troubleshoot issues effectively.

Run the script, explore your system details, and enhance your understanding of the underlying infrastructure.

Leave a Reply

Your email address will not be published. Required fields are marked *