Get all processes (Get-Process)
> help Get-Process
> Get-Process
> Get-Process powershell
> Get-Process powershell -FileVersionInfo
> Get-Process power*
> Get-Process *shell
> Get-Process ??????ell
> Get-Process *a*
> Get-Process -name *a*
power* | Get all starting with |
*shell | Get all ending with |
??????ell | Unknown charachters |
*a* | Get all with “a” included |
-name *a* | Must include “a” |
Start process (Start-Process)
> Start-Process notepad.exe
> Start-Process notepad.exe -WindowStyle Maximized
Stop process (Stop-Process)
> Stop-Process -Name "notepad"
Get service (Get-Service)
> Get-Service
> Get-Service -Displayname "*network*"
> Get-Service -Name "win*" -Exclude "WinRM"
> Get-Service "win*" | Sort-Object
> Get-Service | Where-Object -Property Status -EQ Running
> Get-Service | Out-File running.txt
> Get-Service | Where-Object -Property Status -EQ Running | Out-File running.txt
> Get-Service | Where-Object -Property Status -EQ Running | Format-List | Out-File running2.txt
> Get-Service | Where-Object -Property Status -EQ Running | ConvertTo-Json | Out-File json.txt
> Get-Service | Where-Object -Property Status -EQ Running | ConvertTo-Html > running.html
“win*” | Get services that begin with |
-Displayname “network“ | Display services that include |
-Name “win*” -Exclude “WinRM” | Begin with & an exclusion |
“win*” | Sort-Object | Sort by name |
| Where-Object -Property Status -EQ Running | Sort all by property value |
| Out-File running.txt | Export all to text file |
| Where-Object -Property Status -EQ Running | Out-File running.txt | Export to file by property val. |
| Where-Object -Property Status -EQ Running | Format-List | Out-File running2.txt | Export to text file, more info |
| Where-Object -Property Status -EQ Running | ConvertTo-Json | Out-File json.txt | Export to JSON file |
| Where-Object -Property Status -EQ Running | ConvertTo-Html > running.html | Export to HTML file |