溫馨提示×

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

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

PowerShell運(yùn)維人員常用命令收集整理

發(fā)布時(shí)間:2020-08-05 16:08:10 來源:網(wǎng)絡(luò) 閱讀:2905 作者:流星影shin 欄目:系統(tǒng)運(yùn)維

查看類:

查看powershell版本                                $PSVersionTable    

查看操作系統(tǒng)版本信息                             Get-CimInstance -ClassName  Win32_OperatingSystem -ComputerName . | Select-Object -Property  Build*,OSType,ServicePack*    

查看部分組策略                                        gpresult /Z

查看部分組策略(需要導(dǎo)出到文件)              secedit /export /cfg c:\sec_result

查看服務(wù)                                                  Get-Service 

查看運(yùn)行中服務(wù)                                        Get-Service | Where-Object {$_.Status -eq 'Running'}

查看IP                                                      ipconfig /all或者Get-NetipConfiguration

查看進(jìn)程                                                  Get-Process

查看已安裝補(bǔ)丁                                        Get-WmiObject -Class Win32_QuickFixEngineering或者wmic qfe list

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

查看CPU相關(guān)信息                                     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

查看系統(tǒng)版本/序列號(hào)                                gwmi win32_OperatingSystem

查看總內(nèi)存                                               Get-WmiObject win32_OperatingSystem TotalVisibleMemorySize

查看總內(nèi)存(單位GB)                             gwmi Win32_PhysicalMemory | %{$sum = 0} { $sum += $_.Capacity } {Write-Host ($sum / 1GB) "GB"}

查看空閑內(nèi)存                                            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) }

查看防火墻狀態(tài)                                         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     

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

查看一個(gè)文件夾內(nèi)的文件及目錄                 Get-ChildItem -Path C:\ -Force





管理類:

重啟服務(wù)器                                                Restart-Computer  或者 Restart-Computer -Force強(qiáng)制重啟

關(guān)閉服務(wù)器                                                stop-computer

停止spooler服務(wù)                                       Stop-Service -Name spooler    

啟動(dòng)spooler服務(wù)                                       Start-Service -Name spooler    

重啟spooler服務(wù)                                       Restart-Service -Name spooler    

停止某個(gè)進(jìn)程                                            stop-process -id 2792

鎖定服務(wù)器                                                rundll32.exe user32.dll,LockWorkStation    

新增注冊(cè)表項(xiàng)                                            New-Item -Path hkcu:\software_DeleteMe

刪除注冊(cè)表項(xiàng)                                            Remove-Item -Path hkcu:\Software_DeleteMe








向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI