1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > python使用wmi模块获取windows下的系统信息 监控系统

python使用wmi模块获取windows下的系统信息 监控系统

时间:2024-02-18 04:50:53

相关推荐

python使用wmi模块获取windows下的系统信息 监控系统

后端开发|Python教程

python_wmi模块,python_wmi

后端开发-Python教程

Python用WMI模块获取Windows系统的硬件信息:硬盘分区、使用情况,内存大小,CPU型号,当前运行的进程,自启动程序及位置,系统的版本等信息。

api调用程序源码,ubuntu解释不了域名,如何启动四个tomcat,爬虫软件案件,php多线程操作教程,seo期末作业lzw

本文实例讲述了python使用wmi模块获取windows下的系统信息 监控系统

科技公司源码 pc 手机,加快vscode启动速度,ubuntu 之scp,宝塔启动tomcat,同步sqlite 数据库,前端工程师应该要学哪些框架,爬虫扫码查看手机号,图片下载php,无锡seo哪个强,织梦网站防止注入,大家最喜欢的美妆静态网页源码,帝国 免费模板lzw

#!/usr/bin/env python # -*- coding: utf- -*- #/liu-ke/ import wmi import os import sys import platform import time def sys_version(): c = wmi.WMI () #获取操作系统版本 for sys in c.Win_OperatingSystem():print "Version:%s" % sys.Caption.encode("UTF"),"Vernum:%s" % sys.BuildNumberprint sys.OSArchitecture.encode("UTF")#系统是位还是位的print sys.NumberOfProcesses #当前系统运行的进程总数 def cpu_mem(): c = wmi.WMI () #CPU类型和内存 for processor in c.Win_Processor():#print "Processor ID: %s" % processor.DeviceIDprint "Process Name: %s" % processor.Name.strip() for Memory in c.Win_PhysicalMemory():print "Memory Capacity: %.fMB" %(int(Memory.Capacity)/) def disk(): c = wmi.WMI ()#获取硬盘分区 for physical_disk in c.Win_DiskDrive ():for partition in physical_disk.associators ("Win_DiskDriveToDiskPartition"): for logical_disk in partition.associators ("Win_LogicalDiskToPartition"):print physical_disk.Caption.encode("UTF"), partition.Caption.encode("UTF"), logical_disk.Caption #获取硬盘使用百分情况 for disk in c.Win_LogicalDisk (DriveType=):print disk.Caption, "%.f%% free" % (. * long (disk.FreeSpace) / long (disk.Size)) def network(): c = wmi.WMI ()#获取MAC和IP地址 for interface in c.Win_NetworkAdapterConfiguration (IPEnabled=):print "MAC: %s" % interface.MACAddress for ip_address in interface.IPAddress:print "ip_add: %s" % ip_address print def main(): sys_version() cpu_mem() #disk() #network() if __name__ == \__main__: main() print platform.system() print platform.release() print platform.version() print platform.platform() print platform.machine()

在线福利资源源码,vscode编辑器怎么样,ubuntu 去除源,对tomcat实现负载均衡,Python爬虫月薪,php redis 微博,锦州本地seo优化多少钱lzw

以上内容是关于python使用wmi模块获取windows下的系统信息 监控系统的相关知识,希望对大家有所帮助。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。