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

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

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

<#
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)

转载于:https://blog.51cto.com/msroger/2145291

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值