189 8069 5689

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 += $_.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 $_.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

管理类:


重启服务器                                                Restart-Computer 或者 Restart-Computer -Force强制重启

关闭服务器                         stop-computer

停止spooler服务                                      Stop-Service -Name spooler

启动spooler服务                                     Start-Service -Name spooler

重启spooler服务                                      Restart-Service -Name spooler

停止某个进程                                            stop-process -id 2792

锁定服务器                                               rundll32.exe user32.dll,LockWorkStation

新增注册表项                                            New-Item -Path hkcu:\software_DeleteMe

删除注册表项                                            Remove-Item -Path hkcu:\Software_DeleteMe

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


本文标题:PowerShell运维人员常用命令收集整理-创新互联
网址分享:http://cdxtjz.cn/article/iehpi.html

其他资讯