Checking System Information with PowerShell Commands

Screenshot of PowerShell showing system information: CPU, memory, disk, network adapters, and OS details retrieved using Get-ComputerInfo, Get-WmiObject, Get-NetAdapter commands.v1

Checking System Information with PowerShell Commands
SPONSORED

Sponsor message — This article is made possible by Dargslan.com, a publisher of practical, no-fluff IT & developer workbooks.

Why Dargslan.com?

If you prefer doing over endless theory, Dargslan’s titles are built for you. Every workbook focuses on skills you can apply the same day—server hardening, Linux one-liners, PowerShell for admins, Python automation, cloud basics, and more.


Understanding your computer's system information isn't just a technical curiosity—it's fundamental to maintaining a healthy, secure, and efficient Windows environment. Whether you're troubleshooting performance issues, planning hardware upgrades, verifying warranty details, or ensuring security compliance, knowing exactly what's running under the hood empowers you to make informed decisions about your technology infrastructure.

PowerShell has emerged as the definitive tool for retrieving detailed system information on Windows platforms, offering far more depth and flexibility than traditional graphical interfaces. This command-line shell and scripting language provides direct access to the Windows Management Instrumentation (WMI) and Common Information Model (CIM) layers, delivering comprehensive hardware and software details in seconds.

In this comprehensive guide, you'll discover practical PowerShell commands to extract every conceivable piece of system information—from processor specifications and memory configurations to network settings and software inventories. You'll learn not just the commands themselves, but how to interpret the results, combine multiple queries for complex diagnostics, and automate information gathering across multiple systems.

Essential PowerShell Commands for Basic System Information

The foundation of system information gathering in PowerShell begins with understanding the core cmdlets that provide immediate access to critical hardware and operating system details. These commands serve as your first line of inquiry when assessing any Windows machine, whether you're performing routine maintenance, conducting security audits, or preparing documentation for IT asset management.

The Get-ComputerInfo cmdlet represents the most comprehensive single-command approach to retrieving system information. Introduced in PowerShell 5.1, this powerful command aggregates data from multiple sources and presents an extensive overview of your system in one consolidated output. When you execute this command, PowerShell queries various system components and returns hundreds of properties covering everything from BIOS details to Windows update configurations.

Get-ComputerInfo

This command returns an overwhelming amount of information, which makes it incredibly valuable but sometimes difficult to parse. The output includes operating system version, build numbers, installation dates, system manufacturer details, processor information, memory specifications, and much more. For targeted queries, you can filter specific properties using the Select-Object cmdlet or by accessing properties directly.

"The ability to quickly retrieve comprehensive system information through a single command transforms how IT professionals approach diagnostics and documentation, eliminating the need to navigate through multiple GUI windows or third-party tools."

For more focused queries, the systeminfo command provides a legacy but still highly effective alternative. While technically not a PowerShell-native cmdlet, it integrates seamlessly within PowerShell sessions and delivers formatted output that many administrators find more immediately readable than the property-based output of Get-ComputerInfo.

systeminfo

The systeminfo command presents information in a structured, label-value format that includes host name, OS name and version, system manufacturer and model, processor details, BIOS version, Windows directory, system boot time, and available physical memory. This command proves particularly valuable when you need to quickly assess a system's basic configuration without wading through extensive property lists.

Retrieving Specific System Properties

When you need targeted information rather than comprehensive dumps, PowerShell's filtering capabilities become essential. The Select-Object cmdlet allows you to extract specific properties from Get-ComputerInfo, creating customized reports that contain only the information relevant to your current task.

Get-ComputerInfo | Select-Object CsName, WindowsVersion, OsArchitecture, CsProcessors

This approach dramatically improves readability and makes it easier to incorporate system information into scripts, reports, or automated monitoring systems. You can select any combination of properties, format them as tables or lists, and even export them to various file formats for documentation purposes.

  • CsName – Returns the computer's network name, essential for identifying systems in multi-computer environments
  • WindowsVersion – Shows the specific Windows version number, critical for compatibility assessments
  • OsArchitecture – Indicates whether the system runs 32-bit or 64-bit Windows, affecting software installation decisions
  • OsInstallDate – Reveals when Windows was installed, useful for determining system age and planning migrations
  • OsLastBootUpTime – Shows when the system last started, important for uptime monitoring and troubleshooting

Hardware Information Discovery Through PowerShell

Understanding your hardware configuration forms the backbone of effective system management, capacity planning, and troubleshooting. PowerShell provides multiple approaches to querying hardware components, each offering different levels of detail and formatting options. The choice between using WMI classes, CIM cmdlets, or specialized commands depends on your specific requirements and the PowerShell version available on your system.

Processor Information Retrieval

The central processing unit represents the computational heart of any system, and knowing its specifications helps you understand performance capabilities, power consumption characteristics, and upgrade possibilities. PowerShell offers several methods to retrieve detailed processor information, with the Get-CimInstance cmdlet providing the most modern and efficient approach.

Get-CimInstance -ClassName Win32_Processor | Select-Object Name, NumberOfCores, NumberOfLogicalProcessors, MaxClockSpeed

This command queries the Win32_Processor WMI class and returns essential processor characteristics. The Name property provides the processor's marketing name (such as "Intel Core i7-9700K"), while NumberOfCores indicates physical cores and NumberOfLogicalProcessors shows the total thread count when considering technologies like Intel's Hyper-Threading or AMD's Simultaneous Multithreading. The MaxClockSpeed property reports the processor's rated frequency in megahertz.

"Direct access to processor specifications through PowerShell eliminates guesswork when assessing whether a system meets application requirements or when planning virtualization deployments that depend on specific CPU features."

For systems with multiple processors (common in servers), this command returns information for each physical processor separately. You can further refine the output by adding properties like Manufacturer, Architecture, ProcessorId, or CurrentClockSpeed to understand the full processor landscape.

Memory Configuration Analysis

Random Access Memory (RAM) directly impacts system performance, multitasking capabilities, and application responsiveness. PowerShell enables you to examine both the total installed memory and the configuration of individual memory modules, providing insights crucial for troubleshooting memory-related issues or planning upgrades.

Get-CimInstance -ClassName Win32_PhysicalMemory | Select-Object Manufacturer, Capacity, Speed, DeviceLocator

This command interrogates each physical memory module installed in your system. The Capacity property returns memory size in bytes (you'll need to divide by 1GB to convert to gigabytes), while Speed indicates the module's rated frequency in megahertz. The DeviceLocator property identifies which physical slot houses each module, invaluable information when planning memory expansions or troubleshooting faulty modules.

Property Description Typical Values
Capacity Size of the memory module in bytes 8589934592 (8GB), 17179869184 (16GB)
Speed Memory frequency in MHz 2400, 2666, 3200, 3600
Manufacturer Company that produced the memory module Samsung, Crucial, Corsair, Kingston
DeviceLocator Physical slot identifier on the motherboard DIMM 0, DIMM 1, ChannelA-DIMM0
MemoryType Type of memory technology 24 (DDR3), 26 (DDR4), 34 (DDR5)

To quickly calculate total installed memory in gigabytes, you can use a more sophisticated command that sums all module capacities and performs the conversion automatically:

(Get-CimInstance -ClassName Win32_PhysicalMemory | Measure-Object -Property Capacity -Sum).Sum / 1GB

Storage Device Enumeration

Modern systems often contain multiple storage devices—SSDs, HDDs, NVMe drives—each with different performance characteristics and capacities. PowerShell provides comprehensive commands to inventory all storage devices, examine their properties, and assess available space across all volumes.

Get-PhysicalDisk | Select-Object DeviceId, FriendlyName, MediaType, Size

The Get-PhysicalDisk cmdlet returns information about physical storage devices connected to your system. The MediaType property distinguishes between SSD, HDD, and other storage technologies, while Size reports the total capacity. This command proves particularly useful for identifying which drives are solid-state (offering superior performance) versus traditional spinning disks.

For examining logical volumes and their space utilization, the Get-Volume cmdlet provides a clearer picture of how storage is partitioned and used:

Get-Volume | Select-Object DriveLetter, FileSystemLabel, FileSystem, Size, SizeRemaining

This command displays all volumes with assigned drive letters, showing their labels, file systems (NTFS, ReFS, FAT32), total size, and remaining free space. The output helps you quickly identify volumes approaching capacity limits, which could impact system performance or application functionality.

Operating System and Software Information

Beyond hardware specifications, understanding the software environment—including the operating system version, installed updates, running services, and application inventory—provides essential context for security assessments, compatibility planning, and troubleshooting. PowerShell excels at retrieving this information through both native cmdlets and WMI/CIM queries.

Windows Version and Build Information

Windows versioning can be confusing, with marketing names (Windows 10, Windows 11) often obscuring the underlying build numbers and update levels that determine actual feature availability and security posture. PowerShell cuts through this confusion by providing precise version information.

Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object Caption, Version, BuildNumber, OSArchitecture

The Caption property returns the Windows edition name (such as "Microsoft Windows 11 Pro"), while Version provides the internal version number. BuildNumber indicates the specific build, which changes with feature updates and is crucial for determining whether a system has received recent updates. OSArchitecture confirms whether you're running 32-bit or 64-bit Windows.

"Knowing the exact Windows build number transforms vague update status into actionable intelligence, enabling administrators to quickly identify systems requiring security patches or feature updates."

For even more detailed version information, including the release ID and display version, you can query the registry directly through PowerShell:

Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" | Select-Object ProductName, ReleaseId, DisplayVersion, CurrentBuild

Installed Software Inventory

Maintaining an accurate inventory of installed applications serves multiple purposes: license compliance, security vulnerability management, and troubleshooting software conflicts. PowerShell can query the Windows Registry to enumerate installed applications, though the approach differs slightly between 32-bit and 64-bit applications on 64-bit systems.

Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate

This command retrieves information from the standard uninstall registry key, returning application names, versions, publishers, and installation dates. However, on 64-bit systems, 32-bit applications register in a different location, requiring an additional query:

Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate

Combining both queries provides a complete application inventory. You can filter the results to find specific applications, sort by installation date to identify recently added software, or export the entire list for documentation purposes.

Windows Update History

Understanding which updates have been applied to a system helps assess security posture and troubleshoot issues that may have emerged after recent patches. PowerShell provides access to the Windows Update history through the Microsoft.Update.Session COM object.

$Session = New-Object -ComObject Microsoft.Update.Session
$Searcher = $Session.CreateUpdateSearcher()
$HistoryCount = $Searcher.GetTotalHistoryCount()
$Searcher.QueryHistory(0, $HistoryCount) | Select-Object Title, Date, @{Name="Operation"; Expression={switch($_.operation){1 {"Installation"}; 2 {"Uninstallation"}; 3 {"Other"}}}}

This more complex script creates an update session object, queries the complete update history, and formats the results to show update titles, installation dates, and operations performed. The output helps you correlate system behavior changes with specific updates, essential for troubleshooting post-update issues.

Network Configuration Discovery

Network connectivity underpins virtually all modern computing scenarios, making network configuration information critical for troubleshooting connectivity issues, security assessments, and infrastructure documentation. PowerShell offers extensive cmdlets for examining network adapters, IP configurations, DNS settings, and routing tables.

Network Adapter Information

Modern systems often have multiple network adapters—physical Ethernet ports, Wi-Fi adapters, virtual adapters for VPNs or virtualization—each with its own configuration and status. The Get-NetAdapter cmdlet provides comprehensive information about all network interfaces.

Get-NetAdapter | Select-Object Name, InterfaceDescription, Status, LinkSpeed, MacAddress

This command returns the adapter name (as Windows identifies it), a description of the hardware or virtual adapter, current status (Up, Down, Disabled), connection speed, and MAC address. The Status property quickly identifies which adapters are currently active, while LinkSpeed indicates the negotiated connection rate for wired adapters or the current wireless connection speed.

IP Configuration Details

Beyond adapter status, understanding IP addressing, subnet configuration, default gateways, and DNS servers proves essential for troubleshooting connectivity and ensuring proper network communication. The Get-NetIPConfiguration cmdlet consolidates this information in an easily readable format.

Get-NetIPConfiguration -Detailed

The -Detailed parameter ensures you receive comprehensive information including IPv4 and IPv6 addresses, subnet prefix lengths, default gateways, DNS servers, and DHCP status. This single command replaces the older ipconfig command with more structured, PowerShell-friendly output that's easier to parse programmatically.

"Network troubleshooting efficiency increases dramatically when you can retrieve complete IP configuration details in a structured format that's immediately usable in scripts and automated diagnostics."

For even more granular control, you can query specific IP address information using Get-NetIPAddress, which allows filtering by address family (IPv4/IPv6), interface, or address state:

Get-NetIPAddress -AddressFamily IPv4 | Select-Object InterfaceAlias, IPAddress, PrefixLength, AddressState

DNS Configuration and Resolution Testing

Domain Name System configuration directly impacts internet connectivity and internal network resource access. PowerShell provides cmdlets to examine DNS client settings and test name resolution, helping diagnose connectivity issues related to DNS failures.

Get-DnsClientServerAddress | Select-Object InterfaceAlias, ServerAddresses

This command displays which DNS servers each network interface uses, revealing whether systems rely on organizational DNS servers, ISP-provided servers, or public DNS services like Google's 8.8.8.8 or Cloudflare's 1.1.1.1. Incorrect DNS configuration commonly causes connectivity problems that appear as general internet failures.

To actively test DNS resolution, the Resolve-DnsName cmdlet performs DNS queries and displays the results, helping verify that name resolution functions correctly:

Resolve-DnsName -Name www.microsoft.com -Type A

BIOS and Firmware Information

The Basic Input/Output System (BIOS) or its modern replacement, Unified Extensible Firmware Interface (UEFI), represents the fundamental software layer that initializes hardware during system startup. Understanding BIOS/UEFI version, manufacturer, and configuration helps with security assessments (firmware vulnerabilities), compatibility planning (TPM requirements for Windows 11), and troubleshooting boot issues.

Get-CimInstance -ClassName Win32_BIOS | Select-Object Manufacturer, Name, SerialNumber, Version, ReleaseDate

This command retrieves BIOS information including the manufacturer (often the motherboard or system manufacturer), BIOS version, system serial number, and release date. The serial number proves particularly valuable for warranty lookups and asset management, while the version and release date help determine whether firmware updates might address known issues or security vulnerabilities.

For UEFI-specific information and to determine whether a system uses traditional BIOS or UEFI firmware, you can check additional properties:

Get-CimInstance -ClassName Win32_BIOS | Select-Object SMBIOSBIOSVersion, SMBIOSMajorVersion, SMBIOSMinorVersion

Advanced System Information Queries

Beyond basic system information, PowerShell enables sophisticated queries that combine multiple data sources, perform calculations, and present information in customized formats tailored to specific administrative needs. These advanced techniques transform PowerShell from a simple information retrieval tool into a powerful system analysis platform.

Combining Multiple Information Sources

Real-world administrative tasks often require correlating information from multiple system components. PowerShell's pipeline architecture makes it straightforward to combine data from different sources into unified reports. For example, you might want to create a comprehensive system profile that includes hardware, operating system, and network information in a single output.

$SystemInfo = @{
  ComputerName = $env:COMPUTERNAME
  OSVersion = (Get-CimInstance Win32_OperatingSystem).Caption
  Processor = (Get-CimInstance Win32_Processor).Name
  RAM = [math]::Round((Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory / 1GB, 2)
  IPAddress = (Get-NetIPAddress -AddressFamily IPv4 | Where-Object {$_.InterfaceAlias -notlike "*Loopback*"}).IPAddress
}
New-Object PSObject -Property $SystemInfo

This script creates a custom PowerShell object containing key system information from multiple sources. The hashtable approach allows you to define exactly which properties appear in the output and how they're named, creating consistent reports regardless of the underlying system configuration.

Performance and Resource Utilization

Static system information tells you what hardware exists, but understanding current resource utilization reveals how the system performs under actual workloads. PowerShell provides access to performance counters that monitor CPU usage, memory consumption, disk activity, and network throughput in real-time.

Get-Counter '\Processor(_Total)\% Processor Time', '\Memory\Available MBytes', '\PhysicalDisk(_Total)\% Disk Time'

The Get-Counter cmdlet retrieves performance counter data, allowing you to monitor system resources programmatically. The example above checks overall CPU utilization, available memory, and disk activity. You can sample these counters continuously to monitor trends or capture snapshots during troubleshooting sessions.

"Performance counter access through PowerShell enables administrators to move beyond anecdotal performance assessments to data-driven analysis of system behavior and resource constraints."

Service and Process Information

Understanding which services and processes run on a system helps with troubleshooting, security analysis, and performance optimization. PowerShell provides dedicated cmdlets for examining both services (background processes managed by Windows) and regular processes (running applications and executables).

Get-Service | Where-Object {$_.Status -eq "Running"} | Select-Object Name, DisplayName, StartType

This command lists all currently running services, showing their internal names, display names, and startup types (Automatic, Manual, Disabled). You can modify the filter to find stopped services, services set to start automatically, or specific services by name.

For process information, including resource consumption by individual applications, the Get-Process cmdlet provides detailed insights:

Get-Process | Sort-Object CPU -Descending | Select-Object -First 10 Name, CPU, WorkingSet, Id

This command identifies the top ten processes by CPU consumption, displaying their names, total CPU time consumed, memory usage (WorkingSet), and process IDs. Such information proves invaluable when investigating performance issues or identifying resource-intensive applications.

Cmdlet Primary Purpose Key Properties
Get-Service Enumerate and manage Windows services Name, Status, StartType, DisplayName
Get-Process List running processes and their resource usage Name, CPU, WorkingSet, Id, Path
Get-EventLog Query Windows event logs for system events TimeGenerated, EntryType, Source, Message
Get-HotFix List installed Windows updates and patches HotFixID, Description, InstalledOn
Get-LocalUser Enumerate local user accounts Name, Enabled, LastLogon, PasswordRequired

Remote System Information Gathering

PowerShell's true power emerges when managing multiple systems remotely, eliminating the need to physically access or remotely desktop into each machine. PowerShell Remoting enables you to execute commands on remote computers, gather information from entire fleets of systems, and centralize administrative tasks that would otherwise require visiting each system individually.

Enabling PowerShell Remoting

Before you can query remote systems, PowerShell Remoting must be enabled on the target computers. This one-time configuration establishes the necessary Windows Remote Management (WinRM) services and firewall rules to accept remote PowerShell connections.

Enable-PSRemoting -Force

Running this command on target systems (requires administrative privileges) configures WinRM, sets the service to start automatically, creates firewall exceptions, and establishes the default session configurations. The -Force parameter suppresses confirmation prompts, useful when enabling remoting through Group Policy or automated deployment scripts.

Querying Remote Systems

Once remoting is enabled, most PowerShell cmdlets support a -ComputerName parameter that directs the command to execute on remote systems rather than locally. This approach works particularly well with CIM cmdlets, which were designed with remoting in mind.

Get-CimInstance -ClassName Win32_OperatingSystem -ComputerName Server01, Server02, Server03 | Select-Object PSComputerName, Caption, Version, LastBootUpTime

This command queries operating system information from three servers simultaneously, with the PSComputerName property identifying which server each result came from. You can specify computer names individually, provide them as an array variable, or read them from a text file for large-scale queries.

Persistent Remote Sessions

For multiple commands against the same remote system, establishing a persistent session improves performance by reusing the connection rather than establishing new connections for each command. The New-PSSession cmdlet creates these persistent sessions.

$Session = New-PSSession -ComputerName Server01
Get-CimInstance -ClassName Win32_Processor -CimSession $Session
Get-CimInstance -ClassName Win32_PhysicalMemory -CimSession $Session
Remove-PSSession -Session $Session

This approach creates a session to Server01, executes multiple queries through that session, and then properly closes the session when finished. Persistent sessions reduce connection overhead and maintain state between commands, enabling more complex remote administrative scenarios.

"Remote system information gathering transforms PowerShell from a local administration tool into an enterprise-scale management platform capable of assessing hundreds of systems in minutes rather than days."

Exporting and Formatting System Information

Retrieving system information serves little purpose if you can't effectively use that information for documentation, reporting, or analysis. PowerShell provides extensive capabilities for formatting output, exporting data to various file formats, and integrating with other tools and systems.

Console Formatting Options

PowerShell offers several cmdlets specifically designed to control how information appears in the console. The Format-Table and Format-List cmdlets represent the most commonly used formatting options, each suited to different types of data.

Get-Service | Format-Table Name, Status, StartType -AutoSize

Format-Table works best for displaying multiple objects with a limited number of properties, creating columnar output that's easy to scan. The -AutoSize parameter adjusts column widths to fit the data, preventing truncation of values.

For detailed information about individual objects, Format-List presents each property on a separate line, making it easier to read objects with many properties:

Get-ComputerInfo | Format-List CsName, WindowsVersion, OsArchitecture, CsProcessors, CsTotalPhysicalMemory

Exporting to Files

PowerShell supports exporting data to multiple file formats, each with different characteristics and use cases. The most common export cmdlets include Export-Csv, Export-Clixml, and Out-File.

Get-CimInstance -ClassName Win32_ComputerSystem | Export-Csv -Path "C:\Reports\SystemInfo.csv" -NoTypeInformation

CSV exports create comma-separated value files that open easily in Excel, database tools, or text editors. The -NoTypeInformation parameter suppresses the type information header that PowerShell normally includes, creating cleaner CSV files compatible with more tools.

For preserving complete PowerShell object structures including all properties and types, Export-Clixml creates XML-based files that can be reimported into PowerShell later:

Get-CimInstance -ClassName Win32_Processor | Export-Clixml -Path "C:\Reports\ProcessorInfo.xml"

HTML Report Generation

PowerShell includes built-in capability to generate HTML reports, perfect for creating web-based documentation or email-friendly system reports. The ConvertTo-Html cmdlet transforms PowerShell objects into HTML tables with optional styling.

$SystemReport = Get-ComputerInfo | Select-Object CsName, WindowsVersion, OsArchitecture, CsProcessors | ConvertTo-Html -Title "System Information Report" -PreContent "<h1>System Configuration</h1>"
$SystemReport | Out-File -FilePath "C:\Reports\SystemReport.html"

This approach creates a complete HTML document including headers and basic formatting. You can enhance these reports with custom CSS styling, multiple tables combining different information sources, and embedded images or logos for professional documentation.

Security and Permissions Considerations

Retrieving system information through PowerShell requires appropriate permissions, and different commands demand different privilege levels. Understanding these requirements helps avoid frustrating access denied errors and ensures your scripts function reliably across different security contexts.

Most basic system information queries work with standard user privileges. Commands like Get-ComputerInfo, Get-Process, Get-Service (for status only), and network configuration cmdlets typically don't require administrative rights. However, certain information—particularly hardware details, BIOS information, and detailed memory configurations—requires elevated privileges.

Start-Process powershell -Verb RunAs

This command launches a new PowerShell window with administrative privileges, enabling access to information that requires elevation. When developing scripts that need administrative access, you can detect whether the current session runs elevated and prompt for elevation if necessary.

"Understanding permission requirements for different system information queries prevents script failures and helps design administrative tools that gracefully handle privilege limitations."

For remote queries, the account executing commands must have administrative privileges on the target systems. PowerShell Remoting uses Windows authentication, respecting existing security boundaries and permissions. When querying domain-joined systems, domain administrator accounts or accounts specifically granted remote management permissions can execute remote queries successfully.

Practical Applications and Use Cases

Understanding PowerShell system information commands gains real value when applied to actual administrative challenges. These practical scenarios demonstrate how system information gathering solves common IT problems and streamlines routine tasks.

🔍 Hardware Inventory for Asset Management

Organizations need accurate hardware inventories for asset tracking, warranty management, and capacity planning. PowerShell can automate inventory collection across entire environments, creating comprehensive databases of hardware configurations without manual data entry or expensive third-party tools.

$Computers = Get-Content "C:\Lists\Computers.txt"
$Inventory = foreach ($Computer in $Computers) {
  Get-CimInstance -ClassName Win32_ComputerSystem -ComputerName $Computer | Select-Object @{N="ComputerName";E={$Computer}}, Manufacturer, Model, @{N="RAM_GB";E={[math]::Round($_.TotalPhysicalMemory / 1GB, 2)}}
}
$Inventory | Export-Csv -Path "C:\Reports\HardwareInventory.csv" -NoTypeInformation

🔍 Security Compliance Verification

Security policies often mandate specific configurations—operating system versions, patch levels, enabled security features like BitLocker or Windows Defender. PowerShell scripts can audit systems against these requirements, identifying non-compliant machines that require remediation.

$ComplianceCheck = @{
  ComputerName = $env:COMPUTERNAME
  OSBuild = (Get-CimInstance Win32_OperatingSystem).BuildNumber
  BitLockerEnabled = (Get-BitLockerVolume -MountPoint "C:").ProtectionStatus -eq "On"
  DefenderEnabled = (Get-MpComputerStatus).AntivirusEnabled
  LastBootDays = ((Get-Date) - (Get-CimInstance Win32_OperatingSystem).LastBootUpTime).Days
}
New-Object PSObject -Property $ComplianceCheck

🔍 Performance Troubleshooting

When users report slow performance, system information helps identify bottlenecks—insufficient memory, high CPU usage, disk space issues, or network problems. PowerShell enables rapid assessment of resource utilization and configuration issues that impact performance.

$PerfReport = @{
  CPULoad = (Get-Counter '\Processor(_Total)\% Processor Time').CounterSamples.CookedValue
  AvailableMemoryGB = [math]::Round((Get-Counter '\Memory\Available MBytes').CounterSamples.CookedValue / 1024, 2)
  DiskQueueLength = (Get-Counter '\PhysicalDisk(_Total)\Current Disk Queue Length').CounterSamples.CookedValue
  TopProcessByCPU = (Get-Process | Sort-Object CPU -Descending | Select-Object -First 1).Name
}
New-Object PSObject -Property $PerfReport

🔍 Pre-Migration Assessment

Before migrating systems to new operating systems or hardware platforms, administrators need detailed information about current configurations to plan migrations and identify potential compatibility issues. PowerShell provides comprehensive pre-migration inventories.

$MigrationAssessment = @{
  ComputerName = $env:COMPUTERNAME
  CurrentOS = (Get-CimInstance Win32_OperatingSystem).Caption
  Architecture = (Get-CimInstance Win32_OperatingSystem).OSArchitecture
  TPMPresent = (Get-Tpm).TpmPresent
  SecureBootEnabled = Confirm-SecureBootUEFI
  RAM_GB = [math]::Round((Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory / 1GB, 2)
  DiskSpace_GB = [math]::Round((Get-Volume -DriveLetter C).SizeRemaining / 1GB, 2)
}
New-Object PSObject -Property $MigrationAssessment

🔍 Automated Documentation Generation

Maintaining accurate system documentation often falls behind as environments change. PowerShell can automatically generate comprehensive documentation, ensuring technical records remain current without manual effort.

$Documentation = @"
<html>
<head><title>System Documentation - $env:COMPUTERNAME</title></head>
<body>
<h1>System Configuration Report</h1>
<h2>Generated: $(Get-Date)</h2>
$(Get-ComputerInfo | Select-Object CsName, WindowsVersion, OsArchitecture | ConvertTo-Html -Fragment)
<h2>Hardware Configuration</h2>
$(Get-CimInstance Win32_Processor | Select-Object Name, NumberOfCores | ConvertTo-Html -Fragment)
$(Get-CimInstance Win32_PhysicalMemory | Select-Object @{N="Capacity_GB";E={$_.Capacity / 1GB}}, Speed | ConvertTo-Html -Fragment)
<h2>Network Configuration</h2>
$(Get-NetIPConfiguration | Select-Object InterfaceAlias, IPv4Address | ConvertTo-Html -Fragment)
</body>
</html>
"@
$Documentation | Out-File "C:\Reports\SystemDoc_$env:COMPUTERNAME.html"

Troubleshooting Common Issues

Even straightforward system information queries sometimes encounter problems—permissions issues, WMI corruption, remoting failures, or unexpected output. Understanding common problems and their solutions helps you work through obstacles efficiently.

WMI/CIM Query Failures

When Get-CimInstance or Get-WmiObject commands fail with access denied errors or timeout messages, several potential causes exist. First, verify that the Windows Management Instrumentation service runs on the target system. You can check and start this service through PowerShell:

Get-Service -Name Winmgmt | Start-Service

If WMI appears corrupted (returning inconsistent results or failing entirely), rebuilding the WMI repository sometimes resolves issues. This process requires stopping the WMI service, deleting the repository, and allowing Windows to rebuild it on next service start.

PowerShell Remoting Connection Problems

Remote queries failing with "WinRM cannot complete the operation" or similar messages typically indicate remoting isn't enabled, firewall rules block connections, or network connectivity issues exist. Test basic connectivity first:

Test-WSMan -ComputerName Server01

This command verifies that WinRM responds on the target system. If it fails, check that Enable-PSRemoting has been executed on the target, firewall rules permit WinRM traffic (TCP ports 5985 for HTTP, 5986 for HTTPS), and no network-level firewalls block these ports.

"Systematic troubleshooting of PowerShell remoting issues—verifying service status, testing connectivity, checking firewall rules—resolves most remote query failures within minutes."

Incomplete or Missing Information

Occasionally, system information queries return null values or incomplete data. This typically occurs when hardware doesn't properly report information to Windows, drivers lack complete implementation of management interfaces, or virtual environments present abstracted hardware details. When encountering missing information, try alternative query methods or properties:

# If Win32_Processor doesn't return expected details, try Win32_ComputerSystem
Get-CimInstance -ClassName Win32_ComputerSystem | Select-Object NumberOfProcessors, NumberOfLogicalProcessors

How do I find my computer's serial number using PowerShell?

You can retrieve the computer's serial number by querying the Win32_BIOS class with the command: Get-CimInstance -ClassName Win32_BIOS | Select-Object SerialNumber. This returns the manufacturer-assigned serial number, which is useful for warranty lookups and asset management. On some systems, particularly virtual machines, this may return generic values rather than unique serial numbers.

What's the difference between Get-WmiObject and Get-CimInstance?

Get-CimInstance represents the modern replacement for Get-WmiObject, introduced in PowerShell 3.0. Get-CimInstance uses the WS-Management protocol instead of DCOM, provides better performance, supports more robust remoting, and works on non-Windows systems. Microsoft recommends using Get-CimInstance for all new scripts, though Get-WmiObject remains available for backward compatibility with older scripts and systems.

Can I retrieve system information from computers running older PowerShell versions?

Yes, though available cmdlets vary by PowerShell version. PowerShell 2.0 and later support Get-WmiObject for system information queries, while Get-CimInstance requires PowerShell 3.0 or newer. The Get-ComputerInfo cmdlet requires PowerShell 5.1 or later. For maximum compatibility across mixed environments, use Get-WmiObject or systeminfo, which work on all PowerShell versions and even pre-PowerShell Windows systems.

How can I check if my system uses BIOS or UEFI?

You can determine the firmware type by checking the environment variable with: $env:firmware_type. If this returns "UEFI", the system uses UEFI firmware; if it returns nothing or "Legacy", the system uses traditional BIOS. Alternatively, use Get-CimInstance -ClassName Win32_ComputerSystem | Select-Object BootupState and check for UEFI-related values, though the environment variable method provides more reliable results.

What permissions do I need to run system information commands remotely?

Remote system information queries typically require administrative privileges on the target computers. Your account must be a member of the local Administrators group on remote systems, or you must have been explicitly granted remote management permissions through Group Policy or WinRM configuration. Domain administrator accounts automatically have these permissions on domain-joined computers. For specific commands, permissions requirements remain the same remotely as locally—if a command requires elevation locally, it requires administrative access remotely.

How do I export system information for multiple computers to a single report?

Use a foreach loop to iterate through multiple computers, collecting information from each, and then export the combined results. Example: $Computers = "Server01","Server02","Server03"; $Results = foreach ($Computer in $Computers) { Get-CimInstance Win32_OperatingSystem -ComputerName $Computer | Select PSComputerName, Caption, Version }; $Results | Export-Csv "C:\Report.csv" -NoTypeInformation. This approach creates a single CSV file containing information from all specified computers with the computer name identifying each entry.