InfraLab
POWERSHELL46 cmd

PowerShell チート集

Windows インフラ運用で使う PowerShell のヘルプ、オブジェクトパイプ、サービス、プロセス、イベントログ、ネットワーク、Active Directory、WinRM、スクリプト基礎を整理したチート集。

更新日
2026-05-14
参照範囲
公式ドキュメント / man page / 主要ベンダーCLI
対象実装
主要 Linux / BSD / ネットワーク機器 CLI の一般的な実装
免責
OS とバージョン差分は実環境で確認してください。

46 / 46

CommandDescriptionExampleCopy
Get-CommandPowerShell で Get-Command を実務運用で使うPS> Get-Command *Service*
Get-HelpPowerShell で Get-Help を実務運用で使うPS> Get-Help Get-Process -Examples
Get-MemberPowerShell で Get-Member を実務運用で使うPS> Get-Process | Get-Member
Out-GridViewPowerShell で Out-GridView を実務運用で使うPS> Get-Service | Out-GridView
Get-ModulePowerShell で Get-Module を実務運用で使うPS> Get-Module -ListAvailable
Import-ModulePowerShell で Import-Module を実務運用で使うPS> Import-Module ActiveDirectory
Update-HelpPowerShell で Update-Help を実務運用で使うPS> Update-Help -Force
Select-ObjectPowerShell で Select-Object を実務運用で使うPS> Get-Process | Select-Object Name,Id,CPU
Where-ObjectPowerShell で Where-Object を実務運用で使うPS> Get-Service | Where-Object Status -eq Running
ForEach-ObjectPowerShell で ForEach-Object を実務運用で使うPS> Get-Process | ForEach-Object { $_.Name }
Sort-ObjectPowerShell で Sort-Object を実務運用で使うPS> Get-Process | Sort-Object CPU -Descending
Group-ObjectPowerShell で Group-Object を実務運用で使うPS> Get-Process | Group-Object ProcessName
Measure-ObjectPowerShell で Measure-Object を実務運用で使うPS> Get-ChildItem C:\Logs | Measure-Object Length -Sum
Export-CsvPowerShell で Export-Csv を実務運用で使うPS> Get-Service | Export-Csv .\services.csv -NoTypeInformation
ConvertTo-JsonPowerShell で ConvertTo-Json を実務運用で使うPS> Get-Process | Select-Object -First 3 | ConvertTo-Json
Get-ChildItemPowerShell で Get-ChildItem を実務運用で使うPS> Get-ChildItem C:\Windows\System32 -Filter *.dll
Get-ContentPowerShell で Get-Content を実務運用で使うPS> Get-Content C:\Logs\app.log -Tail 100 -Wait
Set-ContentPowerShell で Set-Content を実務運用で使うPS> Set-Content .\note.txt "hello"
Copy-ItemPowerShell で Copy-Item を実務運用で使うPS> Copy-Item .\app.conf \server01\c$\Temp\
Remove-ItemPowerShell で Remove-Item を実務運用で使うPS> Remove-Item .\old.log -Force
Get-ItemPropertyPowerShell で Get-ItemProperty を実務運用で使うPS> Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion
New-ItemPropertyPowerShell で New-ItemProperty を実務運用で使うPS> New-ItemProperty HKLM:\Software\Acme -Name Enabled -Value 1 -PropertyType DWord
Get-ServicePowerShell で Get-Service を実務運用で使うPS> Get-Service | Where-Object Status -eq Stopped
Restart-ServicePowerShell で Restart-Service を実務運用で使うPS> Restart-Service Spooler
Get-ProcessPowerShell で Get-Process を実務運用で使うPS> Get-Process -Name w3wp
Stop-ProcessPowerShell で Stop-Process を実務運用で使うPS> Stop-Process -Id 1234 -Force
Get-WinEventPowerShell で Get-WinEvent を実務運用で使うPS> Get-WinEvent -LogName System -MaxEvents 20
Get-EventLogWindows PowerShell 5.1 のイベントログ取得コマンド。PowerShell 7+ では削除済みのため、現行環境では Get-WinEvent を使う。PS> Get-WinEvent -LogName Application -MaxEvents 50
Test-NetConnectionPowerShell で Test-NetConnection を実務運用で使うPS> Test-NetConnection example.com -Port 443
Resolve-DnsNamePowerShell で Resolve-DnsName を実務運用で使うPS> Resolve-DnsName example.com -Type MX
Get-NetTCPConnectionPowerShell で Get-NetTCPConnection を実務運用で使うPS> Get-NetTCPConnection -State Listen
Get-NetAdapterPowerShell で Get-NetAdapter を実務運用で使うPS> Get-NetAdapter | Format-Table Name,Status,LinkSpeed
Get-NetIPConfigurationPowerShell で Get-NetIPConfiguration を実務運用で使うPS> Get-NetIPConfiguration
Get-DnsClientServerAddressPowerShell で Get-DnsClientServerAddress を実務運用で使うPS> Get-DnsClientServerAddress -AddressFamily IPv4
Get-ADUserPowerShell で Get-ADUser を実務運用で使うPS> Get-ADUser -Filter * -Properties mail | Select-Object Name,mail
Get-ADComputerPowerShell で Get-ADComputer を実務運用で使うPS> Get-ADComputer -Filter * -Properties OperatingSystem
Get-ADGroupMemberPowerShell で Get-ADGroupMember を実務運用で使うPS> Get-ADGroupMember "Domain Admins"
Search-ADAccountPowerShell で Search-ADAccount を実務運用で使うPS> Search-ADAccount -LockedOut
Enter-PSSessionPowerShell で Enter-PSSession を実務運用で使うPS> Enter-PSSession -ComputerName server01
Invoke-CommandPowerShell で Invoke-Command を実務運用で使うPS> Invoke-Command -ComputerName server01 -ScriptBlock { Get-Service }
New-PSSessionPowerShell で New-PSSession を実務運用で使うPS> $s = New-PSSession -ComputerName server01
Copy-Item -ToSessionPowerShell で Copy-Item -ToSession を実務運用で使うPS> Copy-Item .\tool.ps1 C:\Temp -ToSession $s
paramPowerShell で param を実務運用で使うPS> param([string]$Path = "C:\Logs")
functionPowerShell で function を実務運用で使うPS> function Restart-App { param($Name) Restart-Service $Name }
try catchPowerShell で try catch を実務運用で使うPS> try { Restart-Service App } catch { Write-Error $_ }
CmdletBindingPowerShell で CmdletBinding を実務運用で使うPS> [CmdletBinding()] param([Parameter(Mandatory)] [string]$Name)
Related