一键查询系统Windows基本信息的PowerShell脚本

2021-03-28 20:24

阅读:411

标签:percent   root   memory   信息   src   技术   mem   技术分享   col   

直接发一个简单的查询系统基本信息的PS脚本吧,无聊写的,我用的语法都是通俗易懂的。应该没有难得地方,唯一一个就是调用了ws的窗口。

技术分享图片

Simple System Info tool
Author: Roger, Zhang
Version: 1.0
#>

$disk = Get-WmiObject Win32_LogicalDisk -ComputerName ‘localhost‘ -Filter "DeviceID=‘C:‘"
$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脚本

标签:percent   root   memory   信息   src   技术   mem   技术分享   col   

原文地址:http://blog.51cto.com/msroger/2145291


评论


亲,登录后才可以留言!