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

回复 18# newswan


    谢谢,我学习学习。

TOP

返回列表