POWERSHELL46 cmd
PowerShell チート集
Windows インフラ運用で使う PowerShell のヘルプ、オブジェクトパイプ、サービス、プロセス、イベントログ、ネットワーク、Active Directory、WinRM、スクリプト基礎を整理したチート集。
- 更新日
- 2026-05-14
- 参照範囲
- 公式ドキュメント / man page / 主要ベンダーCLI
- 対象実装
- 主要 Linux / BSD / ネットワーク機器 CLI の一般的な実装
- 免責
- OS とバージョン差分は実環境で確認してください。
46 / 46
| Command | Description | Example | Copy |
|---|---|---|---|
Get-Command | PowerShell で Get-Command を実務運用で使う | PS> Get-Command *Service* | |
Get-Help | PowerShell で Get-Help を実務運用で使う | PS> Get-Help Get-Process -Examples | |
Get-Member | PowerShell で Get-Member を実務運用で使う | PS> Get-Process | Get-Member | |
Out-GridView | PowerShell で Out-GridView を実務運用で使う | PS> Get-Service | Out-GridView | |
Get-Module | PowerShell で Get-Module を実務運用で使う | PS> Get-Module -ListAvailable | |
Import-Module | PowerShell で Import-Module を実務運用で使う | PS> Import-Module ActiveDirectory | |
Update-Help | PowerShell で Update-Help を実務運用で使う | PS> Update-Help -Force | |
Select-Object | PowerShell で Select-Object を実務運用で使う | PS> Get-Process | Select-Object Name,Id,CPU | |
Where-Object | PowerShell で Where-Object を実務運用で使う | PS> Get-Service | Where-Object Status -eq Running | |
ForEach-Object | PowerShell で ForEach-Object を実務運用で使う | PS> Get-Process | ForEach-Object { $_.Name } | |
Sort-Object | PowerShell で Sort-Object を実務運用で使う | PS> Get-Process | Sort-Object CPU -Descending | |
Group-Object | PowerShell で Group-Object を実務運用で使う | PS> Get-Process | Group-Object ProcessName | |
Measure-Object | PowerShell で Measure-Object を実務運用で使う | PS> Get-ChildItem C:\Logs | Measure-Object Length -Sum | |
Export-Csv | PowerShell で Export-Csv を実務運用で使う | PS> Get-Service | Export-Csv .\services.csv -NoTypeInformation | |
ConvertTo-Json | PowerShell で ConvertTo-Json を実務運用で使う | PS> Get-Process | Select-Object -First 3 | ConvertTo-Json | |
Get-ChildItem | PowerShell で Get-ChildItem を実務運用で使う | PS> Get-ChildItem C:\Windows\System32 -Filter *.dll | |
Get-Content | PowerShell で Get-Content を実務運用で使う | PS> Get-Content C:\Logs\app.log -Tail 100 -Wait | |
Set-Content | PowerShell で Set-Content を実務運用で使う | PS> Set-Content .\note.txt "hello" | |
Copy-Item | PowerShell で Copy-Item を実務運用で使う | PS> Copy-Item .\app.conf \server01\c$\Temp\ | |
Remove-Item | PowerShell で Remove-Item を実務運用で使う | PS> Remove-Item .\old.log -Force | |
Get-ItemProperty | PowerShell で Get-ItemProperty を実務運用で使う | PS> Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion | |
New-ItemProperty | PowerShell で New-ItemProperty を実務運用で使う | PS> New-ItemProperty HKLM:\Software\Acme -Name Enabled -Value 1 -PropertyType DWord | |
Get-Service | PowerShell で Get-Service を実務運用で使う | PS> Get-Service | Where-Object Status -eq Stopped | |
Restart-Service | PowerShell で Restart-Service を実務運用で使う | PS> Restart-Service Spooler | |
Get-Process | PowerShell で Get-Process を実務運用で使う | PS> Get-Process -Name w3wp | |
Stop-Process | PowerShell で Stop-Process を実務運用で使う | PS> Stop-Process -Id 1234 -Force | |
Get-WinEvent | PowerShell で Get-WinEvent を実務運用で使う | PS> Get-WinEvent -LogName System -MaxEvents 20 | |
Get-EventLog | Windows PowerShell 5.1 のイベントログ取得コマンド。PowerShell 7+ では削除済みのため、現行環境では Get-WinEvent を使う。 | PS> Get-WinEvent -LogName Application -MaxEvents 50 | |
Test-NetConnection | PowerShell で Test-NetConnection を実務運用で使う | PS> Test-NetConnection example.com -Port 443 | |
Resolve-DnsName | PowerShell で Resolve-DnsName を実務運用で使う | PS> Resolve-DnsName example.com -Type MX | |
Get-NetTCPConnection | PowerShell で Get-NetTCPConnection を実務運用で使う | PS> Get-NetTCPConnection -State Listen | |
Get-NetAdapter | PowerShell で Get-NetAdapter を実務運用で使う | PS> Get-NetAdapter | Format-Table Name,Status,LinkSpeed | |
Get-NetIPConfiguration | PowerShell で Get-NetIPConfiguration を実務運用で使う | PS> Get-NetIPConfiguration | |
Get-DnsClientServerAddress | PowerShell で Get-DnsClientServerAddress を実務運用で使う | PS> Get-DnsClientServerAddress -AddressFamily IPv4 | |
Get-ADUser | PowerShell で Get-ADUser を実務運用で使う | PS> Get-ADUser -Filter * -Properties mail | Select-Object Name,mail | |
Get-ADComputer | PowerShell で Get-ADComputer を実務運用で使う | PS> Get-ADComputer -Filter * -Properties OperatingSystem | |
Get-ADGroupMember | PowerShell で Get-ADGroupMember を実務運用で使う | PS> Get-ADGroupMember "Domain Admins" | |
Search-ADAccount | PowerShell で Search-ADAccount を実務運用で使う | PS> Search-ADAccount -LockedOut | |
Enter-PSSession | PowerShell で Enter-PSSession を実務運用で使う | PS> Enter-PSSession -ComputerName server01 | |
Invoke-Command | PowerShell で Invoke-Command を実務運用で使う | PS> Invoke-Command -ComputerName server01 -ScriptBlock { Get-Service } | |
New-PSSession | PowerShell で New-PSSession を実務運用で使う | PS> $s = New-PSSession -ComputerName server01 | |
Copy-Item -ToSession | PowerShell で Copy-Item -ToSession を実務運用で使う | PS> Copy-Item .\tool.ps1 C:\Temp -ToSession $s | |
param | PowerShell で param を実務運用で使う | PS> param([string]$Path = "C:\Logs") | |
function | PowerShell で function を実務運用で使う | PS> function Restart-App { param($Name) Restart-Service $Name } | |
try catch | PowerShell で try catch を実務運用で使う | PS> try { Restart-Service App } catch { Write-Error $_ } | |
CmdletBinding | PowerShell で CmdletBinding を実務運用で使う | PS> [CmdletBinding()] param([Parameter(Mandatory)] [string]$Name) |