Last active
December 10, 2016 04:24
-
-
Save saggie/fd3e30825d0e9ca3960d22ef1aeb2a13 to your computer and use it in GitHub Desktop.
Get list of all current "titled" processes running in Windows by using PowerShell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-ProcessList() | |
{ | |
$ret = @() | |
function Simplify-ProcessInformation ([System.Diagnostics.Process]$process) | |
{ | |
$ret = @{} | |
$ret["Id"] = $process.Id; | |
$ret["ProcessName"] = $process.ProcessName; | |
$ret["MainWindowTitle"] = $process.MainWindowTitle | |
return $ret | |
} | |
$allCurrentProcesses = [System.Diagnostics.Process]::GetProcesses() | |
foreach ($eachProcess in $allCurrentProcesses) | |
{ | |
# Filtering out non-titled processes | |
if ([String]::IsNullOrWhiteSpace($eachProcess.MainWindowTitle)) { continue } | |
$simplifiedProcessInfo = Simplify-ProcessInformation -process $eachProcess | |
$ret += $simplifiedProcessInfo | |
} | |
return $ret | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment