$info = @() # 獲取內存插槽信息 $memorySlots = Get-WmiObject Win32_PhysicalMemoryArray | Select-Object -ExpandProperty MemoryDevices $installedMemory = Get-WmiObject Win32_PhysicalMemory | Measure-Object -Property Capacity -Sum $memoryInfo = Get-WmiObject Win32_PhysicalMemory | Format-Table DeviceLocator, @{Name="Capacity (GB)"; Expression={[math]::Round($_.Capacity / 1GB, 2)}}, Speed -AutoSize | Out-String $info += "內存插槽總數: $memorySlots`n" $info += "已安裝內存總容量: $($installedMemory.Sum / 1GB) GB`n" $info += "內存詳細信息:`n$memoryInfo" # 獲取主板信息 $motherboard = Get-WmiObject Win32_BaseBoard | Format-Table Manufacturer, Product, SerialNumber -AutoSize | Out-String $info += "主板信息:`n$motherboard" # 獲取CPU信息 $cpu = Get-WmiObject Win32_Processor | Format-Table Name, @{Name="Cores"; Expression={$_.NumberOfCores}}, @{Name="Max Clock Speed (MHz)"; Expression={$_.MaxClockSpeed}} -AutoSize | Out-String $info += "CPU信息:`n$cpu" # 獲取顯卡信息及其內存容量 $gpu = Get-WmiObject Win32_VideoController | Format-Table Name, DriverVersion, VideoProcessor, @{Name="Memory Capacity (GB)"; Expression={[math]::Round($_.AdapterRAM / 1GB, 2)}} -AutoSize | Out-String $info += "顯卡信息:`n$gpu" # 獲取硬盤信息 $disk = Get-WmiObject Win32_DiskDrive | Format-Table Model, @{Name="Type"; Expression={$_.MediaType}}, @{Name="Size (GB)"; Expression={[math]::Round($_.Size / 1GB, 2)}} -AutoSize | Out-String $info += "硬盤信息:`n$disk" # 將信息組合成一個字符串,然後覆制到剪貼板 $info $info -join "`n" | Set-Clipboard # 顯示已將信息覆制到剪貼板 Write-Host "已將系統信息覆制到剪貼板。"