[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
回复 1# gfd


建议改成 powershell

TOP

回复 4# gfd


    晚点试试ai

TOP

回复 5# ppll2030


有资产管理软件,aida64 也许可以

TOP

  1. PowerShell脚本相对于批处理脚本具有许多优势和劣势。
  2. 优势:
  3. 强大的对象模型:PowerShell是基于对象的脚本语言,可以轻松地处理和操作对象,而不仅仅是文本流。
  4. 内置的.NET集成:PowerShell可以直接访问.NET Framework,因此可以利用.NET库中的丰富功能。
  5. 更丰富的功能:PowerShell具有更多的内置功能和命令,可以更轻松地执行系统管理任务。
  6. 更好的错误处理:PowerShell提供了更强大的错误处理和调试功能,使得编写和调试脚本更加容易。
  7. 更好的安全性:PowerShell具有更多的安全功能和策略,可以更好地控制脚本的执行和访问权限。
  8. 劣势:
  9. 学习曲线:对于习惯了批处理脚本的用户来说,学习PowerShell可能需要一些时间。
  10. 兼容性:某些较旧的Windows系统可能不支持PowerShell,因此在这些系统上可能无法运行PowerShell脚本。
  11. 执行速度:相对于简单的批处理脚本,PowerShell脚本可能会有更长的启动时间和执行时间。
  12. 总的来说,PowerShell脚本在系统管理和自动化方面具有更多的优势,但对于简单的任务和较旧的系统,批处理脚本可能仍然是一个更简单和直接的选择。
复制代码

TOP

  1. # 获取操作系统信息
  2. $osInfo = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object Caption, InstallDate, OSArchitecture, Version
  3. $osInfo.InstallDate = $osInfo.InstallDate.ToString("yyyyMMddHHmmss")
  4. Write-Host "信息提取时间:" (Get-Date).ToString("yyyy-MM-dd HH:mm:ss")
  5. Write-Host "Windows_信息:" ($osInfo.Caption + $osInfo.Version) + " 【" + $osInfo.OSArchitecture + "】 安装日期:" + $osInfo.InstallDate.Substring(0, 4) + "年" + $osInfo.InstallDate.Substring(4, 2) + "月" + $osInfo.InstallDate.Substring(6, 2) + "日_" + $osInfo.InstallDate.Substring(8, 2) + "点" + $osInfo.InstallDate.Substring(10, 2) + "分" + $osInfo.InstallDate.Substring(12, 2) + "秒"
  6. Write-Host ""
  7. # 获取产品信息
  8. $productInfo = Get-CimInstance -ClassName Win32_ComputerSystemProduct | Select-Object IdentifyingNumber, Name, Vendor, Version
  9. Write-Host "产品:"
  10. Write-Host "    供应商:" $productInfo.Vendor
  11. Write-Host "    系  列:" $productInfo.Name
  12. Write-Host "    型  号:" $productInfo.Version
  13. Write-Host "    序列号:" $productInfo.IdentifyingNumber
  14. Write-Host ""
  15. # 获取主板信息
  16. $baseboardInfo = Get-CimInstance -ClassName Win32_BaseBoard | Select-Object Manufacturer, Product, SerialNumber
  17. Write-Host "主板:"
  18. Write-Host "    制造商:" $baseboardInfo.Manufacturer
  19. Write-Host "    产  品:" $baseboardInfo.Product
  20. Write-Host "    序列号:" $baseboardInfo.SerialNumber
  21. Write-Host ""
  22. # 获取处理器信息
  23. $processorInfo = Get-CimInstance -ClassName Win32_Processor | Select-Object Name, MaxClockSpeed, NumberOfCores, NumberOfLogicalProcessors
  24. Write-Host "CPU :【" + ($processorInfo.Count) + " 颗】"
  25. foreach ($processor in $processorInfo) {
  26.     Write-Host "    名  称:" $processor.Name + "【" + $processor.NumberOfCores + "核" + $processor.NumberOfLogicalProcessors + "线程】"
  27.     Write-Host "    主  频:" $processor.MaxClockSpeed
  28. }
  29. Write-Host ""
  30. # 获取内存信息
  31. $memoryInfo = Get-CimInstance -ClassName Win32_PhysicalMemory
  32. Write-Host "内存:【" + ($memoryInfo.Count) + " 条】"
  33. $totalMemory = ($memoryInfo | Measure-Object -Property Capacity -Sum).Sum / 1GB
  34. Write-Host "    总容量:" $totalMemory "GB"
  35. foreach ($memory in $memoryInfo) {
  36.     Write-Host "    内存:" ($memory.Capacity / 1GB) "GB"
  37.     Write-Host "        品    牌:" $memory.Manufacturer
  38.     Write-Host "        序 列 号:" $memory.SerialNumber
  39.     Write-Host "        最高频率:" $memory.Speed
  40. }
  41. Write-Host ""
  42. # 获取硬盘信息
  43. $diskInfo = Get-CimInstance -ClassName Win32_DiskDrive | Where-Object { $_.MediaType -eq 'Fixed hard disk media' }
  44. Write-Host "硬盘:【" + ($diskInfo.Count) + " 块】"
  45. foreach ($disk in $diskInfo) {
  46.     Write-Host "    硬盘:" $disk.Model
  47.     Write-Host "    序列号:" $disk.SerialNumber
  48.     Write-Host "    容  量:" ($disk.Size / 1GB) "GB"
  49. }
  50. Write-Host ""
  51. # 获取显示信息
  52. $videoInfo = Get-CimInstance -ClassName Win32_VideoController | Select-Object CurrentRefreshRate, MaxRefreshRate, Name, VideoModeDescription
  53. Write-Host "显示:"
  54. foreach ($video in $videoInfo) {
  55.     Write-Host "    当前刷新率:" $video.CurrentRefreshRate
  56.     Write-Host "    最高刷新率:" $video.MaxRefreshRate
  57.     Write-Host "    显卡  名称:" $video.Name
  58.     Write-Host "    当前分辨率:" $video.VideoModeDescription
  59. }
  60. Write-Host ""
  61. # 获取BIOS信息
  62. $biosInfo = Get-CimInstance -ClassName Win32_BIOS | Select-Object BIOSVersion, Manufacturer, Name, ReleaseDate, SerialNumber, SMBIOSBIOSVersion, Version
  63. $biosInfo.ReleaseDate = $biosInfo.ReleaseDate.ToString("yyyyMMdd")
  64. Write-Host "BIOS:"
  65. Write-Host "    制  造  商:" $biosInfo.Manufacturer
  66. Write-Host "    名      称:" $biosInfo.Name
  67. Write-Host "    版      本:" $biosInfo.Version
  68. Write-Host "    BIOS  版本:" $biosInfo.BIOSVersion
  69. Write-Host "    SMBIOS版本:" $biosInfo.SMBIOSBIOSVersion
  70. Write-Host "    固件  日期:" $biosInfo.ReleaseDate.Substring(0, 4) + "年" + $biosInfo.ReleaseDate.Substring(4, 2) + "月" + $biosInfo.ReleaseDate.Substring(6, 2) + "日"
  71. Write-Host "    序  列  号:" $biosInfo.SerialNumber
复制代码

TOP

上面的是 ai 改写的

TOP

整理过的
  1. Write-Host "信息提取时间:" (Get-Date).ToString('yyyy-MM-dd HH:mm:ss')
  2. Write-Host ""
  3. # 获取操作系统信息
  4. $osInfo = Get-CimInstance -ClassName Win32_OperatingSystem
  5. Write-Host "系统版本:$($osInfo.Caption) $($osInfo.Version) 【 $($osInfo.OSArchitecture) 】"
  6. Write-Host "安装日期:$( $osInfo.InstallDate.ToString('yyyy-MM-dd') )"
  7. Write-Host ""
  8. # 获取产品信息
  9. $productInfo = Get-CimInstance -ClassName Win32_ComputerSystemProduct
  10. Write-Host "产品:"
  11. Write-Host "    供应商:" $productInfo.Vendor
  12. Write-Host "    系  列:" $productInfo.Name
  13. Write-Host "    型  号:" $productInfo.Version
  14. Write-Host "    序列号:" $productInfo.IdentifyingNumber
  15. Write-Host ""
  16. # 获取主板信息
  17. $baseboardInfo = Get-CimInstance -ClassName Win32_BaseBoard
  18. Write-Host "主板:"
  19. Write-Host "    制造商:" $baseboardInfo.Manufacturer
  20. Write-Host "    产  品:" $baseboardInfo.Product
  21. Write-Host "    序列号:" $baseboardInfo.SerialNumber
  22. Write-Host ""
  23. # 获取处理器信息
  24. $processorInfo = Get-CimInstance -ClassName Win32_Processor
  25. Write-Host "CPU :【 $( ($processorInfo | Measure-Object).Count ) 颗 】"
  26. foreach ($processor in $processorInfo) {
  27.     Write-Host "    名  称: $($processor.Name) 【 $($processor.NumberOfCores) 核 $($processor.NumberOfLogicalProcessors) 线程 】"
  28.     Write-Host "    主  频:" $processor.MaxClockSpeed
  29. }
  30. Write-Host ""
  31. # 获取内存信息
  32. $memoryInfo = Get-CimInstance -ClassName Win32_PhysicalMemory
  33. Write-Host "内存:【 $( ($memoryInfo | Measure-Object).Count ) 条 】"
  34. Write-Host "    总容量: $(($memoryInfo | Measure-Object -Property Capacity -Sum).Sum / 1GB) GB"
  35. foreach ($memory in $memoryInfo) {
  36.     Write-Host "    内存: $($memory.Capacity / 1GB) GB"
  37.     Write-Host "        品    牌: $($memory.Manufacturer)"
  38.     Write-Host "        序 列 号: $($memory.SerialNumber)"
  39.     Write-Host "        最高频率: $($memory.Speed)"
  40. }
  41. Write-Host ""
  42. # 获取硬盘信息
  43. $diskInfo = Get-CimInstance -ClassName Win32_DiskDrive | Where-Object { $_.MediaType -eq 'Fixed hard disk media' }
  44. Write-Host "硬盘:【 $( ($diskInfo | Measure-Object).Count ) 块 】"
  45. foreach ($disk in $diskInfo) {
  46.     Write-Host "    硬盘: $($disk.Model)"
  47.     Write-Host "    序列号: $($disk.SerialNumber)"
  48.     Write-Host "    容  量: $($disk.Size / 1GB) GB"
  49. }
  50. Write-Host ""
  51. # 获取显示信息
  52. $videoInfo = Get-CimInstance -ClassName Win32_VideoController
  53. Write-Host "显示:"
  54. foreach ($video in $videoInfo) {
  55.     Write-Host "    当前刷新率: "$video.CurrentRefreshRate
  56.     Write-Host "    最高刷新率: "$video.MaxRefreshRate
  57.     Write-Host "    显卡  名称: "$video.Name
  58.     Write-Host "    当前分辨率: "$video.VideoModeDescription
  59. }
  60. Write-Host ""
  61. # 获取BIOS信息
  62. $biosInfo = Get-CimInstance -ClassName Win32_BIOS
  63. Write-Host "BIOS:"
  64. Write-Host "    制  造  商: "$biosInfo.Manufacturer
  65. Write-Host "    名      称: "$biosInfo.Name
  66. Write-Host "    版      本: "$biosInfo.Version
  67. Write-Host "    BIOS  版本: "$biosInfo.BIOSVersion
  68. Write-Host "    SMBIOS版本: "$biosInfo.SMBIOSBIOSVersion
  69. Write-Host "    固件  日期: "$biosInfo.ReleaseDate.ToString('yyyy-MM-dd')
  70. Write-Host "    序  列  号: "$biosInfo.SerialNumber
  71. Write-Host ""
  72. pause
复制代码

TOP

加 nvme 识别
  1. Write-Host "信息提取时间:" (Get-Date).ToString('yyyy-MM-dd HH:mm:ss')
  2. Write-Host ""
  3. # 获取操作系统信息
  4. $osInfo = Get-CimInstance -ClassName Win32_OperatingSystem
  5. Write-Host "系统版本:$($osInfo.Caption) $($osInfo.Version) 【 $($osInfo.OSArchitecture) 】"
  6. Write-Host "安装日期:$( $osInfo.InstallDate.ToString('yyyy-MM-dd') )"
  7. Write-Host ""
  8. # 获取产品信息
  9. $productInfo = Get-CimInstance -ClassName Win32_ComputerSystemProduct
  10. Write-Host "产品:"
  11. Write-Host "    供应商:" $productInfo.Vendor
  12. Write-Host "    系  列:" $productInfo.Name
  13. Write-Host "    型  号:" $productInfo.Version
  14. Write-Host "    序列号:" $productInfo.IdentifyingNumber
  15. Write-Host ""
  16. # 获取主板信息
  17. $baseboardInfo = Get-CimInstance -ClassName Win32_BaseBoard
  18. Write-Host "主板:"
  19. Write-Host "    制造商:" $baseboardInfo.Manufacturer
  20. Write-Host "    产  品:" $baseboardInfo.Product
  21. Write-Host "    序列号:" $baseboardInfo.SerialNumber
  22. Write-Host ""
  23. # 获取处理器信息
  24. $processorInfo = Get-CimInstance -ClassName Win32_Processor
  25. Write-Host "CPU :【 $( ($processorInfo | Measure-Object).Count ) 颗 】"
  26. foreach ($processor in $processorInfo) {
  27.     Write-Host "    名  称: $($processor.Name) 【 $($processor.NumberOfCores) 核 $($processor.NumberOfLogicalProcessors) 线程 】"
  28.     Write-Host "    主  频:" $processor.MaxClockSpeed
  29. }
  30. Write-Host ""
  31. # 获取内存信息
  32. $memoryInfo = Get-CimInstance -ClassName Win32_PhysicalMemory
  33. Write-Host "内存:【 $( ($memoryInfo | Measure-Object).Count ) 条 】"
  34. Write-Host "    总容量: $(($memoryInfo | Measure-Object -Property Capacity -Sum).Sum / 1GB) GB"
  35. foreach ($memory in $memoryInfo) {
  36.     Write-Host "    内存: $($memory.Capacity / 1GB) GB"
  37.     Write-Host "        品    牌: $($memory.Manufacturer)"
  38.     Write-Host "        序 列 号: $($memory.SerialNumber)"
  39.     Write-Host "        最高频率: $($memory.Speed)"
  40. }
  41. Write-Host ""
  42. # 获取硬盘信息
  43. $diskInfo = Get-CimInstance -ClassName Win32_DiskDrive | Where-Object { $_.MediaType -eq 'Fixed hard disk media' }
  44. foreach ($disk in $diskInfo) {
  45.     $physicalDisk = Get-PhysicalDisk | Where-Object { $_.DeviceID -eq $disk.DeviceID.Substring(17) }
  46.     Add-Member -InputObject $disk -MemberType NoteProperty -Name BusType -Value $physicalDisk.BusType
  47. }
  48. Write-Host "硬盘:【 $( ($diskInfo | Measure-Object).Count ) 块 】"
  49. foreach ($disk in $diskInfo) {
  50.     Write-Host "    BusType: $($BusType)"
  51.     Write-Host "    硬  盘: $($disk.Model)"
  52.     Write-Host "    序列号: $($disk.SerialNumber)"
  53.     Write-Host "    容  量: $($disk.Size / 1GB) GB"
  54. }
  55. Write-Host ""
  56. # 获取显示信息
  57. $videoInfo = Get-CimInstance -ClassName Win32_VideoController
  58. Write-Host "显示:"
  59. foreach ($video in $videoInfo) {
  60.     Write-Host "    当前刷新率: "$video.CurrentRefreshRate
  61.     Write-Host "    最高刷新率: "$video.MaxRefreshRate
  62.     Write-Host "    显卡  名称: "$video.Name
  63.     Write-Host "    当前分辨率: "$video.VideoModeDescription
  64. }
  65. Write-Host ""
  66. # 获取BIOS信息
  67. $biosInfo = Get-CimInstance -ClassName Win32_BIOS
  68. Write-Host "BIOS:"
  69. Write-Host "    制  造  商: "$biosInfo.Manufacturer
  70. Write-Host "    名      称: "$biosInfo.Name
  71. Write-Host "    版      本: "$biosInfo.Version
  72. Write-Host "    BIOS  版本: "$biosInfo.BIOSVersion
  73. Write-Host "    SMBIOS版本: "$biosInfo.SMBIOSBIOSVersion
  74. Write-Host "    固件  日期: "$biosInfo.ReleaseDate.ToString('yyyy-MM-dd')
  75. Write-Host "    序  列  号: "$biosInfo.SerialNumber
  76. Write-Host ""
  77. pause
复制代码

TOP

  1. function Get_CurrentDateTime() {
  2. $str = [System.Collections.ArrayList]@()
  3. $str += "信息提取时间:"  + (Get-Date).ToString('yyyy-MM-dd HH:mm:ss')
  4. $str += ""
  5. return $str
  6. }
  7. # 获取操作系统信息
  8. function Get_Info_system() {
  9. $str = [System.Collections.ArrayList]@()
  10. $osInfo = Get-CimInstance -ClassName Win32_OperatingSystem
  11. $str += "系统版本:$($osInfo.Caption) $($osInfo.Version) 【 $($osInfo.OSArchitecture) 】"
  12. $str += "安装日期:$( $osInfo.InstallDate.ToString('yyyy-MM-dd') )"
  13. $str += ""
  14. return $str
  15. }
  16. # 获取产品信息
  17. function Get_Info_Product() {
  18. $str = [System.Collections.ArrayList]@()
  19. $productInfo = Get-CimInstance -ClassName Win32_ComputerSystemProduct
  20. $str += "产品:"
  21. $str += "    供应商:" + $productInfo.Vendor
  22. $str += "    系  列:" + $productInfo.Name
  23. $str += "    型  号:" + $productInfo.Version
  24. $str += "    序列号:" + $productInfo.IdentifyingNumber
  25. $str += ""
  26. return $str
  27. }
  28. # 获取主板信息
  29. function Get_Info_BaseBoard() {
  30. $str = [System.Collections.ArrayList]@()
  31. $baseboardInfo = Get-CimInstance -ClassName Win32_BaseBoard
  32. $str += "主板:"
  33. $str += "    制造商:" + $baseboardInfo.Manufacturer
  34. $str += "    产  品:" + $baseboardInfo.Product
  35. $str += "    序列号:" + $baseboardInfo.SerialNumber
  36. $str += ""
  37. return $str
  38. }
  39. # 获取处理器信息
  40. function Get_Info_Processor() {
  41. $str = [System.Collections.ArrayList]@()
  42. $processorInfo = Get-CimInstance -ClassName Win32_Processor
  43. $str += "CPU :【 $( ($processorInfo | Measure-Object).Count ) 颗 】"
  44. foreach ($processor in $processorInfo) {
  45. $str += "    名  称: $($processor.Name) 【 $($processor.NumberOfCores) 核 $($processor.NumberOfLogicalProcessors) 线程 】"
  46. $str += "    主  频:" + $processor.MaxClockSpeed
  47. }
  48. $str += ""
  49. return $str
  50. }
  51. # 获取内存信息
  52. function Get_Info_Memory() {
  53. $str = [System.Collections.ArrayList]@()
  54. $memoryInfo = Get-CimInstance -ClassName Win32_PhysicalMemory
  55. $str += "内存:【 $( ($memoryInfo | Measure-Object).Count ) 条 】"
  56. $str += "    总容量: $(($memoryInfo | Measure-Object -Property Capacity -Sum).Sum / 1GB) GB"
  57. foreach ($memory in $memoryInfo) {
  58. $str += "    内存: $($memory.Capacity / 1GB) GB"
  59. $str += "        品    牌: $($memory.Manufacturer)"
  60. $str += "        序 列 号: $($memory.SerialNumber)"
  61. $str += "        最高频率: $($memory.Speed)"
  62. }
  63. $str += ""
  64. return $str
  65. }
  66. # 获取硬盘信息
  67. function Get_Info_Disk() {
  68. $str = [System.Collections.ArrayList]@()
  69. $diskInfo = Get-CimInstance -ClassName Win32_DiskDrive | Where-Object { $_.MediaType -eq 'Fixed hard disk media' }
  70. foreach ($disk in $diskInfo) {
  71. $physicalDisk = Get-PhysicalDisk | Where-Object { $_.DeviceID -eq $disk.DeviceID.Substring(17) }
  72. Add-Member -InputObject $disk -MemberType NoteProperty -Name BusType -Value $physicalDisk.BusType
  73. }
  74. $str += "硬盘:【 $( ($diskInfo | Measure-Object).Count ) 块 】"
  75. foreach ($disk in $diskInfo) {
  76. $str += "    DeviceID: $($DeviceID)"
  77. $str += "    BusType: $($BusType)"
  78. $str += "    硬  盘: $($disk.Model)"
  79. $str += "    序列号: $($disk.SerialNumber)"
  80. $str += "    容  量: $($disk.Size / 1GB) GB"
  81. }
  82. $str += ""
  83. return $str
  84. }
  85. # 获取显示信息
  86. function Get_Info_Video() {
  87. $str = [System.Collections.ArrayList]@()
  88. $videoInfo = Get-CimInstance -ClassName Win32_VideoController
  89. $str += "显示:"
  90. foreach ($video in $videoInfo) {
  91. $str += "    当前刷新率: " + $video.CurrentRefreshRate
  92. $str += "    最高刷新率: " + $video.MaxRefreshRate
  93. $str += "    显卡  名称: " + $video.Name
  94. $str += "    当前分辨率: " + $video.VideoModeDescription
  95. }
  96. $str += ""
  97. return $str
  98. }
  99. # 获取BIOS信息
  100. function Get_Info_BIOS() {
  101. $str = [System.Collections.ArrayList]@()
  102. $biosInfo = Get-CimInstance -ClassName Win32_BIOS
  103. $str += "BIOS:"
  104. $str += "    制  造  商: " + $biosInfo.Manufacturer
  105. $str += "    名      称: " + $biosInfo.Name
  106. $str += "    版      本: " + $biosInfo.Version
  107. $str += "    BIOS  版本: " + $biosInfo.BIOSVersion
  108. $str += "    SMBIOS版本: " + $biosInfo.SMBIOSBIOSVersion
  109. $str += "    固件  日期: " + $biosInfo.ReleaseDate.ToString('yyyy-MM-dd')
  110. $str += "    序  列  号: " + $biosInfo.SerialNumber
  111. $str += ""
  112. return $str
  113. }
  114. $info = [System.Collections.ArrayList]@()
  115. $info += Get_CurrentDateTime
  116. $info += Get_Info_system
  117. $info += Get_Info_Product
  118. $info += Get_Info_BaseBoard
  119. $info += Get_Info_BIOS
  120. $info += Get_Info_Processor
  121. $info += Get_Info_Memory
  122. $info += Get_Info_Disk
  123. $info += Get_Info_Video
  124. $info | Out-File "info.txt"
  125. pause
复制代码

TOP

可以保存文件,其他有空了再来

TOP

  1. function Get_CurrentDateTime() {
  2. [void]$info.add( "信息提取时间:" + (Get-Date).ToString('yyyy-MM-dd HH:mm:ss') )
  3. [void]$info.add( "" )
  4. }
  5. # 获取操作系统信息
  6. function Get_Info_system() {
  7. $osInfo = Get-CimInstance -ClassName Win32_OperatingSystem
  8. [void]$info.add( "OS:" )
  9. [void]$info.add( "    Name      :$( $osInfo.Caption ) 【 $( $osInfo.OSArchitecture ) 】" )
  10. [void]$info.add( "    Version   :$( $osInfo.Version )" )
  11. [void]$info.add( "    安装日期  :$( $osInfo.InstallDate.ToString('yyyy-MM-dd') )" )
  12. [void]$info.add( "    BIOS Mode : $env:firmware_type" )
  13. [void]$info.add( "" )
  14. }
  15. # 获取产品信息
  16. function Get_Info_Product() {
  17. $productInfo = Get-CimInstance -ClassName Win32_ComputerSystemProduct
  18. [void]$info.add( "产品:" )
  19. [void]$info.add( "    供应商:" + $productInfo.Vendor )
  20. [void]$info.add( "    系列  :" + $productInfo.Name )
  21. [void]$info.add( "    型号  :" + $productInfo.Version )
  22. [void]$info.add( "    序列号:" + $productInfo.IdentifyingNumber )
  23. [void]$info.add( "" )
  24. }
  25. # 获取主板信息
  26. function Get_Info_BaseBoard() {
  27. $baseboardInfo = Get-CimInstance -ClassName Win32_BaseBoard
  28. [void]$info.add( "主板:" )
  29. [void]$info.add( "    制造商:" + $baseboardInfo.Manufacturer )
  30. [void]$info.add( "    产品  :" + $baseboardInfo.Product )
  31. [void]$info.add( "    序列号:" + $baseboardInfo.SerialNumber )
  32. [void]$info.add( "" )
  33. }
  34. # 获取处理器信息
  35. function Get_Info_Processor() {
  36. $processorInfo = Get-CimInstance -ClassName Win32_Processor
  37. [void]$info.add( "CPU :【 $( ($processorInfo | Measure-Object).Count ) 】" )
  38. foreach ($processor in $processorInfo) {
  39. [void]$info.add( "    名称: $( $processor.Name ) 【 $( $processor.NumberOfCores ) 核 $( $processor.NumberOfLogicalProcessors ) 线程 】" )
  40. [void]$info.add( "    主频:" + $processor.MaxClockSpeed )
  41. }
  42. [void]$info.add( "" )
  43. }
  44. # 获取内存信息
  45. function Get_Info_Memory() {
  46. $memoryInfo = Get-CimInstance -ClassName Win32_PhysicalMemory
  47. [void]$info.add( "内存:【 $( ($memoryInfo | Measure-Object).Count ) 】" )
  48. [void]$info.add( "    总容量: {0} GB" -f $( ( $memoryInfo | Measure-Object -Property Capacity -Sum ).Sum / 1GB ) )
  49. foreach ($memory in $memoryInfo) {
  50. #$( $memory.BankLabel )
  51. [void]$info.add( "    #   插槽    : $( $memory.DeviceLocator )" )
  52. [void]$info.add( "        品牌    : $( $memory.Manufacturer )" )
  53. [void]$info.add( "        序列号  : $( $memory.SerialNumber )" )
  54. [void]$info.add( "        容量    : $( $memory.Capacity / 1GB ) GB" )
  55. [void]$info.add( "        最高频率: $( $memory.Speed )" )
  56. }
  57. [void]$info.add( "" )
  58. }
  59. # 获取硬盘信息
  60. function Get_Info_Disk() {
  61. $diskInfo = Get-CimInstance -ClassName Win32_DiskDrive | Where-Object { $_.MediaType -eq 'Fixed hard disk media' }
  62. foreach ($disk in $diskInfo) {
  63. $physicalDisk = Get-PhysicalDisk | Where-Object { ('\\.\PHYSICALDRIVE' + $_.DeviceID ) -eq $disk.DeviceID }
  64. Add-Member -InputObject $disk -MemberType NoteProperty -Name BusType -Value $physicalDisk.BusType
  65. }
  66. [void]$info.add( "硬盘:【 $( ($diskInfo | Measure-Object).Count ) 】" )
  67. foreach ($disk in $diskInfo) {
  68. [void]$info.add( "    #   DeviceID: $( $disk.DeviceID )" )
  69. [void]$info.add( "        BusType : $( $disk.BusType )" )
  70. [void]$info.add( "        型号    : $( $disk.Model )" )
  71. [void]$info.add( "        序列号  : $( $disk.SerialNumber )" )
  72. [void]$info.add( "        容量    : $( [int]($disk.Size / 1GB) ) GB" )
  73. }
  74. [void]$info.add( "" )
  75. }
  76. # 获取显示信息
  77. function Get_Info_Video() {
  78. $videoInfo = Get-CimInstance -ClassName Win32_VideoController
  79. [void]$info.add( "显示适配器:" )
  80. foreach ($video in $videoInfo) {
  81. [void]$info.add( "    #   名称      : " + $video.Name )
  82. [void]$info.add( "        显存      : " + $( $video.AdapterRAM / 1GB ) + " GB" )
  83. [void]$info.add( "        当前刷新率: " + $video.CurrentRefreshRate )
  84. [void]$info.add( "        最高刷新率: " + $video.MaxRefreshRate )
  85. [void]$info.add( "        当前分辨率: " + $video.VideoModeDescription )
  86. }
  87. [void]$info.add( "" )
  88. }
  89. # 获取网卡信息
  90. function Get_Info_NetAdapter() {
  91. $nicInfo = Get-NetAdapter -Physical
  92. [void]$info.add( "网络适配器:【 $( ($nicInfo | Measure-Object).Count ) 】" )
  93. foreach ( $nic in $nicInfo ) {
  94. [void]$info.add( "    #   名称      : $( $nic.DriverDescription )" )
  95. [void]$info.add( "        MacAddress: $( $nic.MacAddress )" )
  96. }
  97. [void]$info.add( "" )
  98. }
  99. # 获取BIOS信息
  100. function Get_Info_BIOS() {
  101. $biosInfo = Get-CimInstance -ClassName Win32_BIOS
  102. [void]$info.add( "BIOS:" )
  103. [void]$info.add( "    制造商    : " + $biosInfo.Manufacturer )
  104. [void]$info.add( "    名称      : " + $biosInfo.Name )
  105. [void]$info.add( "    版本      : " + $biosInfo.Version )
  106. [void]$info.add( "    BIOS  版本: " + $biosInfo.BIOSVersion )
  107. [void]$info.add( "    SMBIOS版本: " + $biosInfo.SMBIOSBIOSVersion )
  108. [void]$info.add( "    固件日期  : " + $biosInfo.ReleaseDate.ToString('yyyy-MM-dd') )
  109. [void]$info.add( "    序列号    : " + $biosInfo.SerialNumber )
  110. [void]$info.add( "" )
  111. }
  112. $info = [System.Collections.ArrayList]@()
  113. Get_CurrentDateTime
  114. Get_Info_system
  115. Get_Info_Product
  116. Get_Info_BaseBoard
  117. Get_Info_BIOS
  118. Get_Info_Processor
  119. Get_Info_Memory
  120. Get_Info_Disk
  121. Get_Info_NetAdapter
  122. Get_Info_Video
  123. $info | Out-File "info.txt"
  124. pause
复制代码

TOP

返回列表