我正在使用wmic /node:NODENAME memlogical get totalpagefilespace
,但它不适用于所有 Windows 版本。有没有适用于所有 Windows 版本的命令?
笔记:无需安装任何第三方软件
答案1
PowerShell 可以解决这个问题:
gc c:\servers.txt | % {
$server = $_
$physicalmem = gwmi -computer $server Win32_ComputerSystem | % {$_.TotalPhysicalMemory}
gwmi -computer $server Win32_PageFile | select `
@{ Name = "Server" ; Expression = { $server.ToUpper() } },
@{ Name = "PageFileLocation" ; Expression = { $_.Name } },
@{ Name = "PageFileSize" ; Expression = { [Math]::Round($_.FileSize/1MB,0) } },
@{ Name = "PhysicalMemory" ; Expression = { [Math]::round($physicalmem/1MB,0) } }
}