powershell基本命令

查看powershell版本                                $PSVersionTable

查看操作系统版本信息                             Get-CimInstance -ClassName  Win32_OperatingSystem -ComputerName . | Select-Object -Property  Build*,OSType,ServicePack*

查看部分组策略                                        gpresult /Z

查看部分组策略(需要导出到文件)              secedit /export /cfg c:\sec_result

查看服务                                                  Get-Service

查看运行中服务                                        Get-Service | Where-Object {$_.Status -eq ‘Running’}

查看IP                                                      ipconfig /all或者Get-NetipConfiguration

查看进程                                                  Get-Process

查看已安装补丁                                        Get-WmiObject -Class Win32_QuickFixEngineering或者wmic qfe list

查看使用Windows Installer安装的程序    Get-WmiObject -Class Win32_Product | Format-Wide -Column 1

查看CPU相关信息                                     get-wmiobject win32_processor

查看CPU使用率2008/2012通用                Get-WmiObject win32_processor  | select SystemName, LoadPercentage

查看CPU使用率排名前20                          Get-Counter -ComputerName localhost ‘\Process(*)% Processor Time’ | Select-Object -ExpandProperty countersamples | Select-Object -Property instancename, cookedvalue| Sort-Object -Property cookedvalue -Descending| Select-Object -First 20| ft InstanceName,@{L=‘CPU’;E={($_.Cookedvalue/100).toString(‘P’)}} -AutoSize

查看系统版本/序列号                                gwmi win32_OperatingSystem

查看总内存                                               Get-WmiObject win32_OperatingSystem TotalVisibleMemorySize

查看总内存(单位GB)                             gwmi Win32_PhysicalMemory | %{$sum = 0} { $sum += KaTeX parse error: Expected 'EOF', got '}' at position 12: _.Capacity }̲ {Write-Host (sum / 1GB) “GB”}

查看空闲内存                                            Get-WmiObject win32_OperatingSystem FreePhysicalMemory

查看磁盘总空间(单位MB)                      Get-WMIObject Win32_LogicalDisk |Where-Object{$.Size}|Foreach-Object { ‘Disk {0} has {1:0.0} MB totalspace’ -f . C a p t i o n , ( _.Caption, ( .Caption,(.Size / 1MB) }

查看防火墙状态                                         netsh advfirewall show currentprofile

查看BIOS信息                                           Get-WMIObject -Class Win32_BIOS

查看主板信息                                            Get-WMIObject -Class Win32_Baseboard

查看逻辑磁盘信息                                     Get-WMIObject -Class Win32_LogicalDisk

查看物理磁盘信息                                     Get-WMIObject -Class Win32_DiskDrive

查看桌面设置(屏保是否设置)                     Get-CimInstance -ClassName Win32_Desktop

查看一个文件夹内的文件及目录    ​    ​    ​    ​ Get-ChildItem -Path C:\ -Force

作者:流星影shin
来源:CSDN
原文:https://blog.csdn.net/shinshin1982/article/details/82911851
版权声明:本文为博主原创文章,转载请附上博文链接!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值