| function Get_CurrentDateTime() { |
| [void]$info.add( "信息提取时间:" + (Get-Date).ToString('yyyy-MM-dd HH:mm:ss') ) |
| [void]$info.add( "" ) |
| } |
| |
| |
| |
| function Get_Info_system() { |
| $osInfo = Get-CimInstance -ClassName Win32_OperatingSystem |
| [void]$info.add( "OS:" ) |
| [void]$info.add( " Name :$( $osInfo.Caption ) 【 $( $osInfo.OSArchitecture ) 】" ) |
| [void]$info.add( " Version :$( $osInfo.Version )" ) |
| [void]$info.add( " 安装日期 :$( $osInfo.InstallDate.ToString('yyyy-MM-dd') )" ) |
| [void]$info.add( " BIOS Mode : $env:firmware_type" ) |
| [void]$info.add( "" ) |
| } |
| |
| |
| function Get_Info_Product() { |
| $productInfo = Get-CimInstance -ClassName Win32_ComputerSystemProduct |
| [void]$info.add( "产品:" ) |
| [void]$info.add( " 供应商:" + $productInfo.Vendor ) |
| [void]$info.add( " 系列 :" + $productInfo.Name ) |
| [void]$info.add( " 型号 :" + $productInfo.Version ) |
| [void]$info.add( " 序列号:" + $productInfo.IdentifyingNumber ) |
| [void]$info.add( "" ) |
| } |
| |
| |
| function Get_Info_BaseBoard() { |
| $baseboardInfo = Get-CimInstance -ClassName Win32_BaseBoard |
| [void]$info.add( "主板:" ) |
| [void]$info.add( " 制造商:" + $baseboardInfo.Manufacturer ) |
| [void]$info.add( " 产品 :" + $baseboardInfo.Product ) |
| [void]$info.add( " 序列号:" + $baseboardInfo.SerialNumber ) |
| [void]$info.add( "" ) |
| } |
| |
| |
| function Get_Info_Processor() { |
| $processorInfo = Get-CimInstance -ClassName Win32_Processor |
| [void]$info.add( "CPU :【 $( ($processorInfo | Measure-Object).Count ) 】" ) |
| foreach ($processor in $processorInfo) { |
| [void]$info.add( " 名称: $( $processor.Name ) 【 $( $processor.NumberOfCores ) 核 $( $processor.NumberOfLogicalProcessors ) 线程 】" ) |
| [void]$info.add( " 主频:" + $processor.MaxClockSpeed ) |
| } |
| [void]$info.add( "" ) |
| } |
| |
| |
| function Get_Info_Memory() { |
| $memoryInfo = Get-CimInstance -ClassName Win32_PhysicalMemory |
| [void]$info.add( "内存:【 $( ($memoryInfo | Measure-Object).Count ) 】" ) |
| [void]$info.add( " 总容量: {0} GB" -f $( ( $memoryInfo | Measure-Object -Property Capacity -Sum ).Sum / 1GB ) ) |
| foreach ($memory in $memoryInfo) { |
| |
| [void]$info.add( " # 插槽 : $( $memory.DeviceLocator )" ) |
| [void]$info.add( " 品牌 : $( $memory.Manufacturer )" ) |
| [void]$info.add( " 序列号 : $( $memory.SerialNumber )" ) |
| [void]$info.add( " 容量 : $( $memory.Capacity / 1GB ) GB" ) |
| [void]$info.add( " 最高频率: $( $memory.Speed )" ) |
| } |
| [void]$info.add( "" ) |
| } |
| |
| |
| function Get_Info_Disk() { |
| $diskInfo = Get-CimInstance -ClassName Win32_DiskDrive | Where-Object { $_.MediaType -eq 'Fixed hard disk media' } |
| foreach ($disk in $diskInfo) { |
| $physicalDisk = Get-PhysicalDisk | Where-Object { ('\\.\PHYSICALDRIVE' + $_.DeviceID ) -eq $disk.DeviceID } |
| Add-Member -InputObject $disk -MemberType NoteProperty -Name BusType -Value $physicalDisk.BusType |
| } |
| [void]$info.add( "硬盘:【 $( ($diskInfo | Measure-Object).Count ) 】" ) |
| foreach ($disk in $diskInfo) { |
| [void]$info.add( " # DeviceID: $( $disk.DeviceID )" ) |
| [void]$info.add( " BusType : $( $disk.BusType )" ) |
| [void]$info.add( " 型号 : $( $disk.Model )" ) |
| [void]$info.add( " 序列号 : $( $disk.SerialNumber )" ) |
| [void]$info.add( " 容量 : $( [int]($disk.Size / 1GB) ) GB" ) |
| } |
| [void]$info.add( "" ) |
| } |
| |
| |
| function Get_Info_Video() { |
| $videoInfo = Get-CimInstance -ClassName Win32_VideoController |
| [void]$info.add( "显示适配器:" ) |
| foreach ($video in $videoInfo) { |
| [void]$info.add( " # 名称 : " + $video.Name ) |
| [void]$info.add( " 显存 : " + $( $video.AdapterRAM / 1GB ) + " GB" ) |
| [void]$info.add( " 当前刷新率: " + $video.CurrentRefreshRate ) |
| [void]$info.add( " 最高刷新率: " + $video.MaxRefreshRate ) |
| [void]$info.add( " 当前分辨率: " + $video.VideoModeDescription ) |
| } |
| [void]$info.add( "" ) |
| } |
| |
| |
| function Get_Info_NetAdapter() { |
| $nicInfo = Get-NetAdapter -Physical |
| [void]$info.add( "网络适配器:【 $( ($nicInfo | Measure-Object).Count ) 】" ) |
| foreach ( $nic in $nicInfo ) { |
| [void]$info.add( " # 名称 : $( $nic.DriverDescription )" ) |
| [void]$info.add( " MacAddress: $( $nic.MacAddress )" ) |
| } |
| [void]$info.add( "" ) |
| } |
| |
| |
| |
| function Get_Info_BIOS() { |
| $biosInfo = Get-CimInstance -ClassName Win32_BIOS |
| [void]$info.add( "BIOS:" ) |
| [void]$info.add( " 制造商 : " + $biosInfo.Manufacturer ) |
| [void]$info.add( " 名称 : " + $biosInfo.Name ) |
| [void]$info.add( " 版本 : " + $biosInfo.Version ) |
| [void]$info.add( " BIOS 版本: " + $biosInfo.BIOSVersion ) |
| [void]$info.add( " SMBIOS版本: " + $biosInfo.SMBIOSBIOSVersion ) |
| [void]$info.add( " 固件日期 : " + $biosInfo.ReleaseDate.ToString('yyyy-MM-dd') ) |
| [void]$info.add( " 序列号 : " + $biosInfo.SerialNumber ) |
| [void]$info.add( "" ) |
| } |
| |
| $info = [System.Collections.ArrayList]@() |
| |
| Get_CurrentDateTime |
| Get_Info_system |
| Get_Info_Product |
| Get_Info_BaseBoard |
| Get_Info_BIOS |
| Get_Info_Processor |
| Get_Info_Memory |
| Get_Info_Disk |
| Get_Info_NetAdapter |
| Get_Info_Video |
| |
| $info | Out-File "info.txt" |
| |
| pauseCOPY |