虚位以待(AD)
虚位以待(AD)
首页 > 脚本专栏 > Powershell > 使用PowerShell获取当前主机内存使用量和总量的方法

使用PowerShell获取当前主机内存使用量和总量的方法
类别:Powershell   作者:码皇   来源:互联网   点击:

这篇文章主要介绍了使用PowerShell获取当前主机内存使用量和总量的方法,需要的朋友可以参考下

群里一个小兄弟的提问
用PowerShell来写比c#要简单太多了,WMI直接提供了方法,调用即可。

    #made by kukisama$a=(get-wmiobject -class Win32_PhysicalMemory -namespace "rootcimv2").Capacity$b=(get-wmiobject -class Win32_PerfFormattedData_PerfOS_Memory -namespace "rootcimv2").AvailableMBytes$c=$a/1024/1024$d=$c-$bclsecho 您当前总内存$c 可用内存$b 已用内存$d

本文出自 “九叔-微软私有云” 博客

相关热词搜索: 主机内存使用量 总量