Powershell Process & Service Management

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
*shellGet all ending with
??????ellUnknown 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 “networkDisplay services that include
-Name “win*” -Exclude “WinRM”Begin with & an exclusion
“win*” | Sort-ObjectSort by name
| Where-Object -Property Status -EQ RunningSort all by property value
| Out-File running.txtExport all to text file
| Where-Object -Property Status -EQ Running | Out-File running.txtExport to file by property val.
| Where-Object -Property Status -EQ Running | Format-List | Out-File running2.txtExport to text file, more info
| Where-Object -Property Status -EQ Running | ConvertTo-Json | Out-File json.txtExport to JSON file
| Where-Object -Property Status -EQ Running | ConvertTo-Html > running.htmlExport to HTML file