找回密码
 加入
搜索
查看: 1111|回复: 1

[网络通信] 【已解决】请问如何返回计算机配置?

[复制链接]
发表于 2021-8-12 11:10:50 | 显示全部楼层 |阅读模式
本帖最后由 ac5474012 于 2021-8-12 12:42 编辑

cpu,内存,硬盘数量以及每块硬盘的容量。
 楼主| 发表于 2021-8-12 12:41:53 | 显示全部楼层
找到了
TrayTip("提示","开始登记电脑的信息!",100,1)
$objWMI = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
$objItems = $objWMI.ExecQuery("SELECT * FROM Win32_SystemEnclosure")
For $ComputerSystem In $objItems
        If  $ComputerSystem.SMBIOSAssetTag<>"" Then
        Global $AssetTag = $ComputerSystem.SMBIOSAssetTag
        Else
        $AssetTag = StringTrimLeft(@ComputerName,7)
        EndIf
Next
        $objItems = ""
    
 ;获取bios信息
    $objItems = $objWMI.ExecQuery("Select * from Win32_BIOS")
    
    For $objabc In $objItems
        Global $sn = $objabc.Caption
    Next
    $objItems = ""

;获取主板信息
  $objItems = $objWMI.ExecQuery("SELECT * FROM Win32_BaseBoard")
For $objabc In $objItems
        Global $zhuban = $objabc.Product
Next
$objItems = ""
;获取显卡信息
$objItems = $objWMI.ExecQuery("Select * from Win32_VideoController")
For $objabc In $objItems
        Global $xianka = $objabc.Description
Next
$objItems = ""

;获取声卡
$objItems = $objWMI.ExecQuery("Select * from Win32_SoundDevice")
For $objabc In $objItems
        Global $shengka = $objabc.Description
Next
$objItems = ""

;获取网卡信息(只能有一张活动的网卡)
$objItems = $objWMI.ExecQuery("Select * from Win32_NetworkAdapter WHERE Netconnectionstatus = 2")
For $objabc In $objItems
        Global $wangka = $objabc.name
        Global $mac = $objabc.MACAddress
Next
$objItems = ""
;获取ip地址
$ip = @IPAddress1

;获取内存信息
$objItems = $objWMI.ExecQuery("Select * from Win32_ComputerSystem")
For $objabc In $objItems
        Global $neicun = Round($objabc.totalphysicalmemory / (1024 * 1024) & " Mb")
Next
$objItems = ""


;获取系统信息
  $objItems = $objWMI.ExecQuery("Select * from Win32_operatingsystem")
    For $objabc In $objItems
    Global  $xitong = $objabc.Caption
    Next
   $objItems = ""

        
 ;获取cpu型号
    $objItems = $objWMI.ExecQuery("Select * from Win32_processor")
    For $objabc In $objItems
        $cpu = $objabc.Name
    Next
    $objItems = ""
 
 ;获取硬盘大小
    $objItems = $objWMI.ExecQuery("Select * from Win32_diskdrive")
    $disk = ""
    For $objabc In $objItems
        If $disk = "" Then
    Global   $disk = Round($objabc.Size / 1073741824, 2)
        EndIf
    Next
    $objItems = ""

  ;获取计算机名字 
    $objItems = $objWMI.ExecQuery("Select * from Win32_ComputerSystem")
    For $objabc In $objItems
        $ram = Round($objabc.totalphysicalmemory / 1073741824, 1)
        Global  $username = @UserName ;当前登录的用户名
        Global   $hostname = @ComputerName
        Next
    $objItems = ""
        
;~         MsgBox(0,"",$hostname&@LF&$cpu&@LF&$sn&@LF&$zhuban&@LF&$xianka&@LF&$shengka&@LF&$wangka&@LF&$neicun&@LF&$xitong&@LF&$ip&@LF&$mac&@LF&$disk)
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-12-22 22:52 , Processed in 0.084763 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表