> Get-Process
> [Verb]-[Noun]
> Get-Process
Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName
------- ------ ----- ----- ------ -- -- -----------
385 21 12568 11264 13.81 11112 1 ApplicationFrameHost
229 19 13060 16908 201.72 164348 0 audiodg
102 5 1136 1228 0.17 5924 1 bash
0 422 8472 8324 0.94 26220 1 bash
0 367 7636 7484 0.91 75216 1 bash
92 5 1144 1212 0.08 76588 1 bash
92 5 1020 4884 0.02 148004 1 bash
0 362 7728 7584 0.45 148352 1 bash
3437 51 81260 55516 5040 0 CcmExec
2814 90 146332 139220 838.00 73300 1 chrome
308 32 73828 42320 33.42 94976 1 chrome
577 45 616280 427040 331.44 97760 1 chrome
260 22 35544 14236 1.91 102720 1 chrome
277 23 33036 25772 2.55 103200 1 chrome
274 11 2196 2904 0.27 103432 1 chrome
259 22 29816 11028 1.47 103844 1 chrome
260 21 27788 12000 1.61 104240 1 chrome
284 24 38988 31012 2.08 104428 1 chrome
...
> Get-Process Mic*
Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName
------- ------ ----- ----- ------ -- -- -----------
1187 62 31980 92756 1.48 171016 1 MicrosoftEdge
1489 68 71132 93204 1.44 45772 1 MicrosoftEdgeCP
447 23 9672 29684 0.42 45904 1 MicrosoftEdgeCP
1162 88 96428 140932 2.14 72104 1 MicrosoftEdgeCP
1167 87 69840 120600 2.14 162840 1 MicrosoftEdgeCP
921 58 61244 106448 0.78 170632 1 MicrosoftEdgeCP
> Get-Process Mic*
> Get-Process MicrosoftEdge
> Get-Process MicrosoftEdgeCP
> Get-Process Mic*
MicrosoftEdge
MicrosoftEdgeCP
> Get-Process `
| Format-Table Id, ProcessName, MainWindowTitle
Id ProcessName MainWindowTitle
-- ----------- ---------------
8132 ApplicationFrameHost Personal (Web) - OneNote
10276 chrome neverssl.com - Google Chrome
9468 Code index.html - pwsh-lightning - Visual Studio Code
37980 firefox #PowerShellRocks - Firefox Developer Edition
11284 lync Skype for Business
78700 ONENOTE 2017-10-30 Anko - Team call - OneNote
95800 onenoteim OneNote
78220 OUTLOOK 25 Reminder(s)
11460 powershell grunt
57700 powershell Windows PowerShell
69512 powershell Windows PowerShell
73640 powershell Select Windows PowerShell
65868 SystemSettings Settings
2744 Taskmgr Task Manager
84592 Teams Chat | Microsoft Teams
77128 WinStore.App Microsoft Store
> Get-Process `
| ft Id, ProcessName, MainWindowTitle
Id ProcessName MainWindowTitle
-- ----------- ---------------
8132 ApplicationFrameHost Personal (Web) - OneNote
10276 chrome neverssl.com - Google Chrome
9468 Code index.html - pwsh-lightning - Visual Studio Code
37980 firefox #PowerShellRocks - Firefox Developer Edition
11284 lync Skype for Business
78700 ONENOTE 2017-10-30 Anko - Team call - OneNote
95800 onenoteim OneNote
78220 OUTLOOK 25 Reminder(s)
11460 powershell grunt
57700 powershell Windows PowerShell
69512 powershell Windows PowerShell
73640 powershell Select Windows PowerShell
65868 SystemSettings Settings
2744 Taskmgr Task Manager
84592 Teams Chat | Microsoft Teams
77128 WinStore.App Microsoft Store
# Aside:
> Get-Alias
CommandType Name
----------- ----
Alias % -> ForEach-Object
Alias ? -> Where-Object
...
Alias fhx -> Format-Hex
Alias fl -> Format-List
Alias foreach -> ForEach-Object
Alias ft -> Format-Table
Alias fw -> Format-Wide
Alias gal -> Get-Alias
Alias gbp -> Get-PSBreakpoint
Alias gc -> Get-Content
Alias gcb -> Get-Clipboard
Alias gci -> Get-ChildItem
Alias gcm -> Get-Command
Alias gcs -> Get-PSCallStack
Alias gdr -> Get-PSDrive
Alias ghy -> Get-History
...
> Get-Process `
| Where-Object {$PSItem.MainWindowTitle.Contains("PowerShell") }
Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName
------- ------ ----- ----- ------ -- -- -----------
1874 128 361192 414524 1,541.17 37980 1 firefox
1619 79 254864 196468 392.88 78700 1 ONENOTE
668 35 86836 108056 25.84 57700 1 powershell
587 32 105752 119200 5.09 69512 1 powershell
559 34 78940 90124 11.42 73640 1 powershell
655 32 112612 131008 7.03 112240 1 powershell
> Get-Process `
| Where-Object {$PSItem.MainWindowTitle.Contains("PowerShell") }
//C#
GetProcess()
.Where(psItem => psItem.MainWindowTitle.Contains("PowerShell"));
# PowerShell - short form:
> Get-Process `
| ? {$_.MainWindowTitle.Contains("PowerShell") }
# Find the process
> Get-Process notepad
Id MainWindowTitle
-- ---------------
12572 Untitled - Notepad
109660 foo.txt - Notepad
# Stop that process
> Stop-Process 109660
# ... or embrace piping
> Get-Process notepad `
| ? {$_.MainWindowTitle.Contains("foo.txt") }`
| Stop-Process
> Get-Help Stop-Process
NAME
Stop-Process
SYNOPSIS
Stops one or more running processes.
SYNTAX
Stop-Process [-Id] <Int32[]> [-Confirm] [-Force] [-PassThru] [-WhatIf] [<CommonParameters>]
Stop-Process [-InputObject] <Process[]> [-Confirm] [-Force] [-PassThru] [-WhatIf] [<CommonParameters>]
Stop-Process [-Confirm] [-Force] -Name <String[]> [-PassThru] [-WhatIf] [<CommonParameters>]
...
REMARKS
To see the examples, type: "get-help Stop-Process -examples".
For more information, type: "get-help Stop-Process -detailed".
For technical information, type: "get-help Stop-Process -full".
For online help, type: "get-help Stop-Process -online"
> Get-Help Stop-Process -Examples
...
Example 1: Stop all instances of a process
PS C:\>Stop-Process -Name "notepad"
This command stops all instances of the Notepad process on the computer. Each instance of Notepad runs in its own process. It uses the Name parameter to specify the processes,
all of which have the same name. If you were to use the Id parameter to stop the same processes, you would have to list the process IDs of each instance of Notepad.
Example 2: Stop a specific instance of a process
PS C:\>Stop-Process -Id 3952 -Confirm -PassThru
Confirm
Are you sure you want to perform this action?
Performing operation "Stop-Process" on Target "notepad (3952)".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help
(default is "Y"):y
Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
------- ------ ----- ----- ----- ------ -- -----------
41 2 996 3212 31 3952 notepad
...
> Get-Command
CommandType Name Version Source
----------- ---- ------- ------
Alias Add-AdlAnalyticsDataSource 3.2.1 AzureRM.DataLakeAnalytics
Alias Add-AdlAnalyticsDataSource 2.1.0 AzureRM.DataLakeAnalytics
Alias Add-AdlAnalyticsFirewallRule 3.2.1 AzureRM.DataLakeAnalytics
Alias Add-AdlStoreFirewallRule 4.2.1 AzureRM.DataLakeStore
Alias Add-AdlStoreItemContent 4.2.1 AzureRM.DataLakeStore
Alias Add-AdlStoreItemContent 2.1.0 AzureRM.DataLakeStore
Alias Add-AdlStoreTrustedIdProvider 4.2.1 AzureRM.DataLakeStore
Alias Add-AzureHDInsightConfigValues 2.1.0 Azure
Alias Add-AzureHDInsightMetastore 2.1.0 Azure
Alias Add-AzureHDInsightStorage 2.1.0 Azure
Alias Add-AzureRmIotHubEHCG 2.2.1 AzureRM.IotHub
Alias Add-ProvisionedAppxPackage 3.0 Dism
Alias Add-ProvisioningPackage 3.0 Provisioning
Alias Add-TrustedProvisioningCertificate 3.0 Provisioning
Alias Add-WAPackEnvironment 2.1.0 Azure
Alias Apply-WindowsUnattend 3.0 Dism
Alias Confirm-SSLegacyVolumeContainerStatus 2.1.0 Azure
Alias Disable-AzureRmHDInsightOMS 3.2.1 AzureRM.HDInsight
Alias Disable-PhysicalDiskIndication 2.0.0.0 Storage
Alias Disable-StorageDiagnosticLog 2.0.0.0 Storage
Alias Disable-WAPackWebsiteApplicationDiagnostic 2.1.0 Azure
Alias Enable-AdlStoreKeyVault 4.2.1 AzureRM.DataLakeStore
Alias Enable-AzureRmHDInsightOMS 3.2.1 AzureRM.HDInsight
Alias Enable-PhysicalDiskIndication 2.0.0.0 Storage
Alias Enable-StorageDiagnosticLog 2.0.0.0 Storage
Alias Enable-WAPackWebsiteApplicationDiagnositc 2.1.0 Azure
Alias Export-AdlStoreItem 4.2.1 AzureRM.DataLakeStore
Alias Export-AdlStoreItem 2.1.0 AzureRM.DataLakeStore
Alias Export-AzureAsInstanceLog 0.4.2 Azure.AnalysisServices
Alias Export-VMCheckpoint 2.0.0.0 Hyper-V
Alias Flush-Volume 2.0.0.0 Storage
Alias Get-AdlAnalyticsAccount 3.2.1 AzureRM.DataLakeAnalytics
...
> Get-Module
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Manifest 3.1.0.0 Microsoft.PowerShell.Management {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Content...}
Manifest 3.1.0.0 Microsoft.PowerShell.Utility {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
Script 0.7.2.0 posh-git {Add-PoshGitToProfile, Add-SshKey, Enable-GitColors, Get-AliasPattern...}
Script 0.4.0 posh-HumpCompletion
Script 1.0.0.1 PowerShellGet {Find-Command, Find-DscResource, Find-Module, Find-RoleCapability...}
Script 1.2 PSReadline {Get-PSReadlineKeyHandler, Get-PSReadlineOption, Remove-PSReadlineKeyHandler, Set-PSReadlineKeyHandler...}
Script 1.2 TabExpansionPlusPlus {Get-ArgumentCompleter, Get-CommandTreeCompletion, Get-CommandWithParameter, Get-CompletionPrivateData...}
> Install-Module -Name posh-HumpCompletion
Install-Module : Administrator rights are required to install modules in 'C:\Program Files\WindowsPowerShell\Modules'. Log on to the computer with an account that has Administrator
rights, and then try again, or install 'C:\Users\stuartle\Documents\WindowsPowerShell\Modules' by adding "-Scope CurrentUser" to your command. You can also try running the Windows
PowerShell session with elevated rights (Run as Administrator).
At line:1 char:1
+ Install-Module -Name posh-HumpCompletion
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Install-Module], ArgumentException
+ FullyQualifiedErrorId : InstallModuleNeedsCurrentUserScopeParameterForNonAdminUser,Install-Module
# or avoid the sea of red...
> Install-Module -Name posh-HumpCompletion -Scope CurrentUser
> "PowerShell Rocks".ToUpper()
POWERSHELL ROCKS
> "PowerShell Rocks".ToUpper
OverloadDefinitions
-------------------
string ToUpper()
string ToUpper(cultureinfo culture)
> [string]::Format
OverloadDefinitions
-------------------
static string Format(string format, System.Object arg0)
static string Format(string format, System.Object arg0, System.Object arg1)
static string Format(string format, System.Object arg0, System.Object arg1, System.Object arg2)
static string Format(string format, Params System.Object[] args)
static string Format(System.IFormatProvider provider, string format, System.Object arg0)
static string Format(System.IFormatProvider provider, string format, System.Object arg0, System.Object arg1)
static string Format(System.IFormatProvider provider, string format, System.Object arg0, System.Object arg1, System.Object arg2)
static string Format(System.IFormatProvider provider, string format, Params System.Object[] args)