一键查询系统Windows基本信息的PowerShell脚本
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了一键查询系统Windows基本信息的PowerShell脚本相关的知识,希望对你有一定的参考价值。
直接发一个简单的查询系统基本信息的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 "rootcimv2").Capacity /1gb
$b= "{0:0.0}" -f (((get-wmiobject -class Win32_PerfFormattedData_PerfOS_Memory -namespace "rootcimv2").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脚本的主要内容,如果未能解决你的问题,请参考以下文章
SVN到Git的一键迁移脚本(保留所有分支、Tag及提交记录)