import wmi
import socket
w
= wmi
.WMI
()
for CS
in w
.Win32_ComputerSystem
():
print("电脑名称: %s" % CS
.Caption
)
print("使用者: %s" % CS
.UserName
)
print("制造商: %s" % CS
.Manufacturer
)
print("系统信息: %s" % CS
.SystemFamily
)
print("工作组: %s" % CS
.Workgroup
)
print("机器型号: %s" % CS
.model
)
print("")
for OS
in w
.Win32_OperatingSystem
():
print("操作系统: %s" % OS
.Caption
)
print("语言版本: %s" % OS
.MUILanguages
)
print("系统位数: %s" % OS
.OSArchitecture
)
print("注册人: %s" % OS
.RegisteredUser
)
print("系统驱动: %s" % OS
.SystemDevice
)
print("系统目录: %s" % OS
.SystemDirectory
)
print("")
for address
in w
.Win32_NetworkAdapterConfiguration
(ServiceName
="e1dexpress"):
print("IP地址: %s" % address
.IPAddress
)
print("MAC地址: %s" % address
.MACAddress
)
print("网络描述: %s" % address
.Description
)
print("")
for processor
in w
.Win32_Processor
():
print("CPU型号: %s" % processor
.Name
.strip
())
print("CPU核数: %s" % processor
.NumberOfCores
)
print("")
for BIOS
in w
.Win32_BIOS
():
print("使用日期: %s" % BIOS
.Description
)
print("主板型号: %s" % BIOS
.SerialNumber
)
print("当前语言: %s" % BIOS
.CurrentLanguage
)
print("")
for memModule
in w
.Win32_PhysicalMemory
():
totalMemSize
= int(memModule
.Capacity
)
print("内存厂商: %s" % memModule
.Manufacturer
)
print("内存型号: %s" % memModule
.PartNumber
)
print("内存大小: %.2fGB" % (totalMemSize
/ 1024 ** 3))
print("")
for disk
in w
.Win32_DiskDrive
():
diskSize
= int(disk
.size
)
print("磁盘名称: %s" % disk
.Caption
)
print("硬盘型号: %s" % disk
.Model
)
print("磁盘大小: %.2fGB" % (diskSize
/ 1024 ** 3))
for xk
in w
.Win32_VideoController
():
print("显卡名称: %s" % xk
.name
)
print("")
hostname
= socket
.gethostname
()
ip
= socket
.gethostbyname
(hostname
)
print("计算机名称: %s" % hostname
)
print("IP地址: %s" % ip
)
转载请注明原文地址: https://lol.8miu.com/read-30500.html