溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

PowerShell運維人員常用命令收集整理

發布時間:2020-08-05 16:08:10 來源:網絡 閱讀:2916 作者:流星影shin 欄目:系統運維

查看類:

查看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








向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女