一键查询系统Windows基本信息的PowerShell脚本
2021-03-28 20:24
标签:percent root memory 信息 src 技术 mem 技术分享 col Simple System Info tool $disk = Get-WmiObject Win32_LogicalDisk -ComputerName ‘localhost‘ -Filter "DeviceID=‘C:‘" 一键查询系统Windows基本信息的PowerShell脚本 标签:percent root memory 信息 src 技术 mem 技术分享 col 原文地址:http://blog.51cto.com/msroger/2145291
Author: Roger, Zhang
Version: 1.0
#>
$drive = $disk.DeviceID
$free = $disk.freespace
$size = $disk.size
$used = 1-$free/$size
$percent = “{0:0.0%}” -f $used
$os = Get-WmiObject -Class Win32_OperatingSystem
$version = $os.version
$ip = (Get-NetIPAddress -interfacealias Ethernet* -AddressFamily IPv4).ipaddress
$user = $env:USERNAME
$a=(get-wmiobject -class Win32_PhysicalMemory -namespace "root\cimv2").Capacity /1gb
$b= "{0:0.0}" -f (((get-wmiobject -class Win32_PerfFormattedData_PerfOS_Memory -namespace "root\cimv2").AvailableMBytes) / 1014)
$mem=$a-$b
$cpus = (Get-WmiObject Win32_Processor).count
$msg = "
User ‘$user‘
Hostname ‘$env:computername‘
CPU: $cpus Core
Memory free $mem of $a GB
IPaddress ‘$ip‘
Drive‘$drive‘used‘$percent‘
OS ‘Windows$version‘
"
write-host $msg
$ws = New-Object -ComObject wscript.shell
$wsr = $ws.popup("$msg","999","SystemInfo",0 + 64)
文章标题:一键查询系统Windows基本信息的PowerShell脚本
文章链接:http://soscw.com/index.php/essay/69196.html