{"id":658,"date":"2010-05-21T10:04:45","date_gmt":"2010-05-21T15:04:45","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/2010\/05\/get-parent-process\/"},"modified":"2010-05-21T14:35:16","modified_gmt":"2010-05-21T19:35:16","slug":"get-parent-process","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/scripting\/658\/get-parent-process\/","title":{"rendered":"Get Parent Process"},"content":{"rendered":"<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/05\/parentchild.png\"><img loading=\"lazy\" decoding=\"async\" style=\"margin: 0px 10px 5px 0px; display: inline; border-width: 0px;\" title=\"parent-child\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/05\/parentchild_thumb.png\" border=\"0\" alt=\"parent-child\" width=\"111\" height=\"109\" align=\"left\" \/><\/a> Recently I helping out on a post in the forums at <a title=\"Visit ScriptingAnswers.com\" href=\"http:\/\/www.scriptinganswers.com\" target=\"_blank\">ScriptingAnswers.com<\/a>. The question centered around identifying processes on a computer and their parent process. There are many ways you could slice and dice this problem using WMI and <a title=\"get on line help\" href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkID=113337\" target=\"_blank\">Get-WmiObject<\/a>. Getting the parent process ID is pretty simple, but going backwards from there to identify the parent process takes a little PowerShell jujitsu.<\/p>\n<p>Because I love objects (geeky, I know), one angle I pursued created a custom object for each parent process. The object included a few key (at least to me) properties as well as a property that held an array of all child processes.<\/p>\n<p>Here\u2019s an example.<\/p>\n<p><span style=\"font-family: Consolas; color: #0000ff;\">ParentID\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 : 916<br \/>\nChildren\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 : {@{ProcessID=4068; ProcessName=Moe.exe; Description=Moe.exe<br \/>\n; Created=5\/19\/2010 8:52:59 AM}, @{ProcessID=4716; ProcessN<br \/>\name=SkypeNames2.exe; Description=SkypeNames2.exe; Created=5<br \/>\n\/20\/2010 8:13:47 AM}, @{ProcessID=1600; ProcessName=VBoxSVC<br \/>\n.exe; Description=VBoxSVC.exe; Created=5\/20\/2010 11:59:31 A<br \/>\nM}, @{ProcessID=6828; ProcessName=WmiPrvSE.exe; Description<br \/>\n=WmiPrvSE.exe; Created=5\/21\/2010 7:57:22 AM}}<br \/>\nNumberofChildren\u00a0 : 4<br \/>\nParentCreated\u00a0\u00a0\u00a0\u00a0 : 5\/19\/2010 8:51:46 AM<br \/>\nParentProcess\u00a0\u00a0\u00a0\u00a0 : svchost.exe<br \/>\nComputername\u00a0\u00a0\u00a0\u00a0\u00a0 : SERENITY<br \/>\n<\/span><\/p>\n<p>To get here, I called a function I wrote called Get-ParentProcess.<\/p>\n<pre class=\"PowerShellColorizedScript\"><span style=\"color: #00008b;\">function<\/span> <span style=\"color: #8a2be2;\">Get-ParentProcess<\/span> <span style=\"color: #000000;\">{<\/span>\r\n    <span style=\"color: #006400;\">#requires -version 2.0<\/span>                       \r\n\r\n    <span style=\"color: #a9a9a9;\">[<\/span><span style=\"color: #add8e6;\">cmdletBinding<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #a9a9a9;\">]<\/span>            \r\n\r\n    <span style=\"color: #00008b;\">Param<\/span><span style=\"color: #000000;\">(<\/span>\r\n        <span style=\"color: #a9a9a9;\">[<\/span><span style=\"color: #add8e6;\">Parameter<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">Position<\/span><span style=\"color: #a9a9a9;\">=<\/span><span style=\"color: #800080;\">0<\/span><span style=\"color: #a9a9a9;\">,<\/span><span style=\"color: #000000;\">ValueFromPipeline<\/span><span style=\"color: #a9a9a9;\">=<\/span><span style=\"color: #ff4500;\">$True<\/span><span style=\"color: #a9a9a9;\">,<\/span><\/pre>\n<pre class=\"PowerShellColorizedScript\"><span style=\"color: #a9a9a9;\">                   <\/span><span style=\"color: #000000;\">HelpMessage<\/span><span style=\"color: #a9a9a9;\">=<\/span><span style=\"color: #8b0000;\">\"Enter a computername\"<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #a9a9a9;\">]<\/span>\r\n        <span style=\"color: #008080;\">[string[]]<\/span><span style=\"color: #ff4500;\">$computername<\/span><span style=\"color: #a9a9a9;\">=<\/span><span style=\"color: #ff4500;\">$env:computername<\/span><span style=\"color: #000000;\">)<\/span>            \r\n\r\n    <span style=\"color: #00008b;\">Begin<\/span> <span style=\"color: #000000;\">{<\/span>\r\n      <span style=\"color: #0000ff;\">write-verbose<\/span> <span style=\"color: #8b0000;\">\"Starting $($myinvocation.mycommand)\"<\/span>\r\n      <span style=\"color: #006400;\">#capture some performance metrics<\/span>\r\n      <span style=\"color: #ff4500;\">$start<\/span><span style=\"color: #a9a9a9;\">=<\/span><span style=\"color: #0000ff;\">Get-Date<\/span>\r\n      <span style=\"color: #ff4500;\">$total<\/span><span style=\"color: #a9a9a9;\">=<\/span><span style=\"color: #800080;\">0<\/span>\r\n    <span style=\"color: #000000;\">}<\/span>\r\n    <span style=\"color: #00008b;\">Process<\/span> <span style=\"color: #000000;\">{<\/span>                \r\n\r\n<pre class=\"PowerShellColorizedScript\"><span style=\"color: #00008b;\">foreach<\/span> <span style=\"color: #000000;\">(<\/span><span style=\"color: #ff4500;\">$computer<\/span> <span style=\"color: #00008b;\">in<\/span> <span style=\"color: #ff4500;\">$computername<\/span><span style=\"color: #000000;\">)<\/span> <span style=\"color: #000000;\">{<\/span>\r\n        <span style=\"color: #0000ff;\">Write-Verbose<\/span> <span style=\"color: #8b0000;\">\"Testing $computer\"<\/span>\r\n        <span style=\"color: #00008b;\">if<\/span> <span style=\"color: #000000;\">(<\/span><span style=\"color: #0000ff;\">Test-Connection<\/span> <span style=\"color: #000080;\">-ComputerName<\/span> <span style=\"color: #ff4500;\">$computer<\/span> <span style=\"color: #000080;\">-quiet<\/span><span style=\"color: #000000;\">)<\/span> <span style=\"color: #000000;\">{<\/span>\r\n            <span style=\"color: #006400;\">#only process if ping returns true<\/span>\r\n            <span style=\"color: #0000ff;\">Write-Verbose<\/span> <span style=\"color: #8b0000;\">\"Connecting to $computer\"<\/span>            \r\n\r\n            <span style=\"color: #0000ff;\">Get-WmiObject<\/span> <span style=\"color: #000080;\">-Class<\/span> <span style=\"color: #8a2be2;\">win32_process<\/span> <span style=\"color: #000080;\">-ComputerName<\/span> <span style=\"color: #ff4500;\">$computer<\/span> `<\/pre>\n<pre class=\"PowerShellColorizedScript\">            <span style=\"color: #000080;\">-outvariable<\/span> <span style=\"color: #8a2be2;\">data<\/span> <span style=\"color: #a9a9a9;\">|<\/span>\r\n            <span style=\"color: #0000ff;\">Sort-Object<\/span> <span style=\"color: #000080;\">-Property<\/span> <span style=\"color: #8a2be2;\">ParentProcessID<\/span> <span style=\"color: #a9a9a9;\">|<\/span>\r\n            <span style=\"color: #0000ff;\">Group-Object<\/span> <span style=\"color: #000080;\">-Property<\/span> <span style=\"color: #8a2be2;\">ParentProcessID<\/span>  <span style=\"color: #a9a9a9;\">|<\/span> <span style=\"color: #0000ff;\">foreach<\/span> <span style=\"color: #000000;\">{<\/span>            \r\n\r\n             <span style=\"color: #ff4500;\">$ParentID<\/span><span style=\"color: #a9a9a9;\">=<\/span><span style=\"color: #ff4500;\">$_<\/span><span style=\"color: #a9a9a9;\">.<\/span><span style=\"color: #000000;\">Name<\/span>\r\n             <span style=\"color: #ff4500;\">$ParentProcess<\/span><span style=\"color: #a9a9a9;\">=<\/span><span style=\"color: #ff4500;\">$data<\/span> <span style=\"color: #a9a9a9;\">|<\/span> <span style=\"color: #0000ff;\">where<\/span> <span style=\"color: #000000;\">{<\/span><span style=\"color: #ff4500;\">$_<\/span><span style=\"color: #a9a9a9;\">.<\/span><span style=\"color: #000000;\">processID<\/span> <span style=\"color: #a9a9a9;\">-eq<\/span> <span style=\"color: #ff4500;\">$parentID<\/span><span style=\"color: #000000;\">}<\/span>\r\n             <span style=\"color: #00008b;\">if<\/span> <span style=\"color: #000000;\">(<\/span><span style=\"color: #a9a9a9;\">-not<\/span> <span style=\"color: #ff4500;\">$parentProcess<\/span><span style=\"color: #000000;\">)<\/span> <span style=\"color: #000000;\">{<\/span>\r\n                <span style=\"color: #0000ff;\">write-verbose<\/span> <span style=\"color: #8b0000;\">\"nothing found for $parentID\"<\/span>\r\n             <span style=\"color: #000000;\">}<\/span>            \r\n\r\n             <span style=\"color: #0000ff;\">Write-Verbose<\/span> <span style=\"color: #8b0000;\">\"Parent process $($parentProcess.name)\"<\/span>            \r\n\r\n             <span style=\"color: #006400;\">#convert creationdate to a friendly format if found<\/span>\r\n             <span style=\"color: #00008b;\">if<\/span> <span style=\"color: #000000;\">(<\/span><span style=\"color: #ff4500;\">$parentProcess<\/span><span style=\"color: #a9a9a9;\">.<\/span><span style=\"color: #000000;\">CreationDate<\/span><span style=\"color: #000000;\">)<\/span> <span style=\"color: #000000;\">{<\/span>\r\n               <span style=\"color: #ff4500;\">$ParentCreation<\/span><span style=\"color: #a9a9a9;\">=`<\/span><\/pre>\n<pre class=\"PowerShellColorizedScript\"><span style=\"color: #a9a9a9;\">           <\/span><span style=\"color: #ff4500;\">$ParentProcess<\/span><span style=\"color: #a9a9a9;\">.<\/span><span style=\"color: #000000;\">ConvertToDateTime<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #ff4500;\">$parentProcess<\/span><span style=\"color: #a9a9a9;\">.<\/span><span style=\"color: #000000;\">CreationDate<\/span><span style=\"color: #000000;\">)<\/span>\r\n             <span style=\"color: #000000;\">}<\/span>\r\n             <span style=\"color: #00008b;\">else<\/span> <span style=\"color: #000000;\">{<\/span>\r\n               <span style=\"color: #ff4500;\">$ParentCreation<\/span><span style=\"color: #a9a9a9;\">=<\/span><span style=\"color: #ff4500;\">$null<\/span>\r\n             <span style=\"color: #000000;\">}<\/span>\r\n             <span style=\"color: #006400;\">#use computername from process object if it exists, <\/span>\r\n             <span style=\"color: #006400;\">#otherwise use the value from $computer<\/span>\r\n             <span style=\"color: #00008b;\">if<\/span> <span style=\"color: #000000;\">(<\/span><span style=\"color: #ff4500;\">$parentProcess<\/span><span style=\"color: #a9a9a9;\">.<\/span><span style=\"color: #000000;\">CSName<\/span><span style=\"color: #000000;\">)<\/span> <span style=\"color: #000000;\">{<\/span>\r\n               <span style=\"color: #ff4500;\">$ParentComputerName<\/span><span style=\"color: #a9a9a9;\">=<\/span><span style=\"color: #ff4500;\">$parentProcess<\/span><span style=\"color: #a9a9a9;\">.<\/span><span style=\"color: #000000;\">CSName<\/span>\r\n             <span style=\"color: #000000;\">}<\/span>\r\n             <span style=\"color: #00008b;\">else<\/span> <span style=\"color: #000000;\">{<\/span>\r\n                <span style=\"color: #ff4500;\">$ParentComputerName<\/span><span style=\"color: #a9a9a9;\">=<\/span><span style=\"color: #ff4500;\">$computer<\/span>\r\n             <span style=\"color: #000000;\">}<\/span>            \r\n\r\n             <span style=\"color: #ff4500;\">$NumberChildren<\/span><span style=\"color: #a9a9a9;\">=<\/span><span style=\"color: #ff4500;\">$_<\/span><span style=\"color: #a9a9a9;\">.<\/span><span style=\"color: #000000;\">group<\/span><span style=\"color: #a9a9a9;\">.<\/span><span style=\"color: #000000;\">count<\/span>\r\n             <span style=\"color: #0000ff;\">Write-Verbose<\/span> <span style=\"color: #8b0000;\">\"Found $NumberChildren child process(es)\"<\/span>\r\n             <span style=\"color: #ff4500;\">$Children<\/span><span style=\"color: #a9a9a9;\">=<\/span><span style=\"color: #ff4500;\">$_<\/span><span style=\"color: #a9a9a9;\">.<\/span><span style=\"color: #000000;\">group<\/span> <span style=\"color: #a9a9a9;\">|<\/span>\r\n              <span style=\"color: #0000ff;\">Select<\/span> <span style=\"color: #000080;\">-property<\/span> <span style=\"color: #8a2be2;\">ProcessID<\/span><span style=\"color: #a9a9a9;\">,<\/span><span style=\"color: #8a2be2;\">ProcessName<\/span><span style=\"color: #a9a9a9;\">,<\/span><span style=\"color: #000000;\">`\r\n<\/span>              <span style=\"color: #000000;\">@{<\/span><span style=\"color: #000000;\">Name<\/span><span style=\"color: #a9a9a9;\">=<\/span><span style=\"color: #8b0000;\">\"Created\"<\/span><span style=\"color: #000000;\">;<\/span>\r\n              <span style=\"color: #000000;\">Expression<\/span><span style=\"color: #a9a9a9;\">=<\/span><span style=\"color: #000000;\">{<\/span><span style=\"color: #ff4500;\">$_<\/span><span style=\"color: #a9a9a9;\">.<\/span><span style=\"color: #000000;\">ConvertToDateTime<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #ff4500;\">$_<\/span><span style=\"color: #a9a9a9;\">.<\/span><span style=\"color: #000000;\">CreationDate<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">}<\/span><span style=\"color: #000000;\">}<\/span>            \r\n\r\n             <span style=\"color: #0000ff;\">Write-Verbose<\/span> <span style=\"color: #8b0000;\">\"Creating custom object\"<\/span>\r\n             <span style=\"color: #0000ff;\">New-Object<\/span> <span style=\"color: #8a2be2;\">PSObject<\/span> <span style=\"color: #000080;\">-Property<\/span> <span style=\"color: #000000;\">@{<\/span>\r\n                <span style=\"color: #000000;\">Computername<\/span><span style=\"color: #a9a9a9;\">=<\/span><span style=\"color: #ff4500;\">$ParentComputerName<\/span>\r\n                <span style=\"color: #000000;\">ParentID<\/span><span style=\"color: #a9a9a9;\">=<\/span><span style=\"color: #ff4500;\">$ParentID<\/span>\r\n                <span style=\"color: #000000;\">ParentProcess<\/span><span style=\"color: #a9a9a9;\">=<\/span><span style=\"color: #ff4500;\">$ParentProcess<\/span><span style=\"color: #a9a9a9;\">.<\/span><span style=\"color: #000000;\">Name<\/span>\r\n                <span style=\"color: #000000;\">ParentCreated<\/span><span style=\"color: #a9a9a9;\">=<\/span><span style=\"color: #ff4500;\">$ParentCreation<\/span>\r\n                <span style=\"color: #000000;\">NumberofChildren<\/span><span style=\"color: #a9a9a9;\">=<\/span><span style=\"color: #ff4500;\">$NumberChildren<\/span>\r\n                <span style=\"color: #000000;\">Children<\/span><span style=\"color: #a9a9a9;\">=<\/span><span style=\"color: #ff4500;\">$Children<\/span>\r\n             <span style=\"color: #000000;\">}<\/span>\r\n           <span style=\"color: #000000;\">}<\/span> <span style=\"color: #006400;\">#end foreach<\/span>\r\n      <span style=\"color: #000000;\">}<\/span> <span style=\"color: #006400;\">#end if Test-Connection<\/span>\r\n      <span style=\"color: #00008b;\">else<\/span> <span style=\"color: #000000;\">{<\/span>\r\n        <span style=\"color: #0000ff;\">Write-Warning<\/span> <span style=\"color: #8b0000;\">\"Failed to connect to $computer\"<\/span>\r\n      <span style=\"color: #000000;\">}<\/span>\r\n       <span style=\"color: #ff4500;\">$total<\/span><span style=\"color: #a9a9a9;\">+=<\/span><span style=\"color: #ff4500;\">$data<\/span><span style=\"color: #a9a9a9;\">.<\/span><span style=\"color: #000000;\">count<\/span>\r\n   <span style=\"color: #000000;\">}<\/span> <span style=\"color: #006400;\">#end foreach $computer<\/span><\/pre>\n<p><span style=\"color: #000000;\">}<\/span><span style=\"color: #006400;\">#Process<\/span><br \/>\n<span style=\"color: #00008b;\">End<\/span> <span style=\"color: #000000;\">{<\/span><\/p>\n<p><span style=\"color: #ff4500;\">$finish<\/span><span style=\"color: #a9a9a9;\">=<\/span><span style=\"color: #0000ff;\">Get-Date<\/span><\/p>\n<blockquote>\n<pre class=\"PowerShellColorizedScript\">\r\n<pre class=\"PowerShellColorizedScript\"><span style=\"color: #ff4500;\">     $msg<\/span><span style=\"color: #a9a9a9;\">=<\/span><span style=\"color: #8b0000;\">\"Processed {0} processes from {1} computers in {2}\"<\/span> <span style=\"color: #a9a9a9;\">-f<\/span> `<\/pre>\n<pre class=\"PowerShellColorizedScript\"><span style=\"color: #ff4500;\">        $total<\/span><span style=\"color: #a9a9a9;\">,<\/span><span style=\"color: #ff4500;\">$computername<\/span><span style=\"color: #a9a9a9;\">.<\/span><span style=\"color: #000000;\">count<\/span><span style=\"color: #a9a9a9;\">,<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #ff4500;\">$finish<\/span><span style=\"color: #a9a9a9;\">-<\/span><span style=\"color: #ff4500;\">$start<\/span><span style=\"color: #000000;\">)<\/span>\r\n     <span style=\"color: #0000ff;\">write-verbose<\/span> <span style=\"color: #ff4500;\">$msg<\/span><\/pre>\n<\/blockquote>\n<pre class=\"PowerShellColorizedScript\">       <span style=\"color: #0000ff;\">write-verbose<\/span> <span style=\"color: #8b0000;\">\"Ending $($myinvocation.mycommand)\"<\/span>\r\n   <span style=\"color: #000000;\">}<\/span>\r\n<span style=\"color: #000000;\">}<\/span> <span style=\"color: #006400;\">#end Function<\/span><\/pre>\n<p>This is an advanced function so it requires PowerShell 2.0. The actual function includes comment based help. I\u2019ve omitted here.<\/p>\n<p>The function takes a computername as a parameter, defaulting to the local computer. You can pipe names to the function as well. Here\u2019s what happens when you connect to the remote computer using Get-WmiObject.\u00a0 The collection of Win32_Process objects is sorted by the ParentProcessID and then piped to <a title=\"get online help for this cmdlet\" href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkID=113338\" target=\"_blank\">Group-Object<\/a>. This created a GroupInfo object. The name property is the parent process ID and the corresponding group are all the child processes.<\/p>\n<p>Each group is then parsed and processed pulling out process information and defining new properties. To get the parent process name I search the saved WMI results looking for a process id that matches the parent process ID I\u2019m checking. If you look back at the Get-WmiObject expression you\u2019ll see I\u2019m taking advantage of the \u2013OutVariable common parameter. The cmdlet\u2019s result is not only passed down the pipeline but also stored in the variable. In this case, $data. When you use \u2013OutVariable just specify the variable name you want to use. You don\u2019t need the $.<\/p>\n<p>For the child processes that are in the group I select a few key properties. $Children will be a collection of custom process objects. This value is used as a property value, among others, in <a title=\"get online help for this cmdlet\" href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkID=113355\" target=\"_blank\">New-Object<\/a>.<\/p>\n<p>When you run the function, you most likely will notice some parent processes with no name. More than likely this is because the parent process is no longer running.<\/p>\n<p><span style=\"font-family: Consolas; color: #0000ff;\">PS C:\\&gt; $r=get-parentprocess<\/span><\/p>\n<p><span style=\"font-family: Consolas; color: #0000ff;\">PS C:\\Scripts&gt; $r | where {-not $_.parentProcess} | select-object -ExpandProperty Children | Sort Created | format-table \u2013autosize<\/span><\/p>\n<p><span style=\"font-family: Consolas; color: #0000ff;\">ProcessID ProcessName\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Created<br \/>\n--------- -----------\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -------<br \/>\n596 csrss.exe\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 5\/19\/2010 8:51:43 AM <\/span><\/p>\n<p><span style=\"font-family: Consolas; color: #0000ff;\"> 676 wininit.exe\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 5\/19\/2010 8:51:44 AM <\/span><\/p>\n<p><span style=\"font-family: Consolas; color: #0000ff;\"> 696 csrss.exe\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 5\/19\/2010 8:51:44 AM <\/span><\/p>\n<p><span style=\"font-family: Consolas; color: #0000ff;\"> 852 winlogon.exe\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 5\/19\/2010 8:51:45 AM <\/span><\/p>\n<p><span style=\"font-family: Consolas; color: #0000ff;\"> 3396 explorer.exe\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 5\/19\/2010 8:52:39 AM <\/span><\/p>\n<p><span style=\"font-family: Consolas; color: #0000ff;\"> 3988 ToshibaServiceStation.exe 5\/19\/2010 8:53:07 AM <\/span><\/p>\n<p><span style=\"font-family: Consolas; color: #0000ff;\"> 3564 TWebCamera.exe\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 5\/19\/2010 8:53:12 AM <\/span><\/p>\n<p><span style=\"font-family: Consolas; color: #0000ff;\"> 3792 TUSBSleepChargeSrv.exe\u00a0\u00a0\u00a0 5\/19\/2010 8:53:12 AM <\/span><\/p>\n<p><span style=\"font-family: Consolas; color: #0000ff;\"> 2208 VCDDaemon.exe\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 5\/19\/2010 8:53:12 AM <\/span><\/p>\n<p><span style=\"font-family: Consolas; color: #0000ff;\"> 4112 jusched.exe\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 5\/19\/2010 8:53:13 AM <\/span><\/p>\n<p><span style=\"font-family: Consolas; color: #0000ff;\"> 4164 vmware-tray.exe\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 5\/19\/2010 8:53:14 AM <\/span><\/p>\n<p><span style=\"font-family: Consolas; color: #0000ff;\"> 3656 SWin.exe\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 5\/19\/2010 9:03:57 AM<\/span><\/p>\n<p>Even if you don\u2019t have a use for the function, I hope you find some useful scripting techniques.<\/p>\n<div id=\"scid:F60BB8FA-6F02-4999-8F5E-9DD4E92C4DA7:210e6e7a-11b7-4561-9fae-0560fd8c4a48\" class=\"wlWriterEditableSmartContent\" style=\"margin: 0px; display: inline; float: none; padding: 0px;\">\n<div><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/05\/GetParentProcess.txt\" target=\"_blank\">Download Get-ParentProcess.ps1<\/a><\/div>\n<div><\/div>\n<div><span style=\"color: #ff6600;\"><strong>Update<\/strong><\/span>: I've been using the PowerShell ISE to create the script files on an x64 platform. The Unicode default can be problematic.\u00a0 Here is an <a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/05\/Get-ParentProcess-ANSI.txt\" target=\"_blank\">ANSI version of the file<\/a>.\u00a0 I'll try to remember to stick to ANSI from now on.<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Recently I helping out on a post in the forums at ScriptingAnswers.com. The question centered around identifying processes on a computer and their parent process. There are many ways you could slice and dice this problem using WMI and Get-WmiObject. Getting the parent process ID is pretty simple, but going backwards from there to identify&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[75,8,19],"tags":[32,103,190,192,534,191,547],"class_list":["post-658","post","type-post","status-publish","format-standard","hentry","category-powershell-v2-0","category-scripting","category-wmi","tag-functions","tag-get-wmiobject","tag-new-object","tag-outvariable","tag-powershell","tag-win32_process","tag-wmi"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Get Parent Process &#8226; The Lonely Administrator<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jdhitsolutions.com\/blog\/scripting\/658\/get-parent-process\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Get Parent Process &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"Recently I helping out on a post in the forums at ScriptingAnswers.com. The question centered around identifying processes on a computer and their parent process. There are many ways you could slice and dice this problem using WMI and Get-WmiObject. Getting the parent process ID is pretty simple, but going backwards from there to identify...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/scripting\/658\/get-parent-process\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2010-05-21T15:04:45+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2010-05-21T19:35:16+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/05\/parentchild_thumb.png\" \/>\n<meta name=\"author\" content=\"Jeffery Hicks\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:site\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeffery Hicks\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/658\\\/get-parent-process\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/658\\\/get-parent-process\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Get Parent Process\",\"datePublished\":\"2010-05-21T15:04:45+00:00\",\"dateModified\":\"2010-05-21T19:35:16+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/658\\\/get-parent-process\\\/\"},\"wordCount\":562,\"commentCount\":3,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/658\\\/get-parent-process\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2010\\\/05\\\/parentchild_thumb.png\",\"keywords\":[\"functions\",\"Get-WMIObject\",\"new-object\",\"outvariable\",\"PowerShell\",\"Win32_process\",\"WMI\"],\"articleSection\":[\"PowerShell v2.0\",\"Scripting\",\"WMI\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/658\\\/get-parent-process\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/658\\\/get-parent-process\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/658\\\/get-parent-process\\\/\",\"name\":\"Get Parent Process &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/658\\\/get-parent-process\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/658\\\/get-parent-process\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2010\\\/05\\\/parentchild_thumb.png\",\"datePublished\":\"2010-05-21T15:04:45+00:00\",\"dateModified\":\"2010-05-21T19:35:16+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/658\\\/get-parent-process\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/658\\\/get-parent-process\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/658\\\/get-parent-process\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2010\\\/05\\\/parentchild_thumb.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2010\\\/05\\\/parentchild_thumb.png\",\"width\":\"111\",\"height\":\"109\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/658\\\/get-parent-process\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell v2.0\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell-v2-0\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Get Parent Process\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/\",\"name\":\"The Lonely Administrator\",\"description\":\"Practical Advice for the Automating IT Pro\",\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\",\"name\":\"Jeffery Hicks\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"caption\":\"Jeffery Hicks\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Get Parent Process &#8226; The Lonely Administrator","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jdhitsolutions.com\/blog\/scripting\/658\/get-parent-process\/","og_locale":"en_US","og_type":"article","og_title":"Get Parent Process &#8226; The Lonely Administrator","og_description":"Recently I helping out on a post in the forums at ScriptingAnswers.com. The question centered around identifying processes on a computer and their parent process. There are many ways you could slice and dice this problem using WMI and Get-WmiObject. Getting the parent process ID is pretty simple, but going backwards from there to identify...","og_url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/658\/get-parent-process\/","og_site_name":"The Lonely Administrator","article_published_time":"2010-05-21T15:04:45+00:00","article_modified_time":"2010-05-21T19:35:16+00:00","og_image":[{"url":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/05\/parentchild_thumb.png","type":"","width":"","height":""}],"author":"Jeffery Hicks","twitter_card":"summary_large_image","twitter_creator":"@JeffHicks","twitter_site":"@JeffHicks","twitter_misc":{"Written by":"Jeffery Hicks","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/658\/get-parent-process\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/658\/get-parent-process\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Get Parent Process","datePublished":"2010-05-21T15:04:45+00:00","dateModified":"2010-05-21T19:35:16+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/658\/get-parent-process\/"},"wordCount":562,"commentCount":3,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/658\/get-parent-process\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/05\/parentchild_thumb.png","keywords":["functions","Get-WMIObject","new-object","outvariable","PowerShell","Win32_process","WMI"],"articleSection":["PowerShell v2.0","Scripting","WMI"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/scripting\/658\/get-parent-process\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/658\/get-parent-process\/","url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/658\/get-parent-process\/","name":"Get Parent Process &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/658\/get-parent-process\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/658\/get-parent-process\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/05\/parentchild_thumb.png","datePublished":"2010-05-21T15:04:45+00:00","dateModified":"2010-05-21T19:35:16+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/658\/get-parent-process\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/scripting\/658\/get-parent-process\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/658\/get-parent-process\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/05\/parentchild_thumb.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/05\/parentchild_thumb.png","width":"111","height":"109"},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/658\/get-parent-process\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell v2.0","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-v2-0\/"},{"@type":"ListItem","position":2,"name":"Get Parent Process"}]},{"@type":"WebSite","@id":"https:\/\/jdhitsolutions.com\/blog\/#website","url":"https:\/\/jdhitsolutions.com\/blog\/","name":"The Lonely Administrator","description":"Practical Advice for the Automating IT Pro","publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jdhitsolutions.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9","name":"Jeffery Hicks","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","url":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","caption":"Jeffery Hicks"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg"}}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":636,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/636\/select-wmi\/","url_meta":{"origin":658,"position":0},"title":"Select WMI","author":"Jeffery Hicks","date":"May 13, 2010","format":false,"excerpt":"I\u2019ve been helping out on some WMI and PowerShell issues in the forums at ScriptingAnswers.com. As I was working on a problem I ended up taking a slight detour to address an issue that has always bugged me. When I run a command like this: get-wmiobject -query \"Select Name,Description,Disabled from\u2026","rel":"","context":"In &quot;PowerShell v2.0&quot;","block_context":{"text":"PowerShell v2.0","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-v2-0\/"},"img":{"alt_text":"selectwmi","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/05\/selectwmi-300x89.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":654,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/654\/new-wmi-object\/","url_meta":{"origin":658,"position":1},"title":"New WMI Object","author":"Jeffery Hicks","date":"May 17, 2010","format":false,"excerpt":"I have one more variation on my recent theme of working with WMI objects. I wanted to come up with something flexible and re-usable where you could specify a WMI class and some properties and get a custom object with all the classes combined. My solution is a function called\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1625,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1625\/get-process-owner\/","url_meta":{"origin":658,"position":2},"title":"Get Process Owner","author":"Jeffery Hicks","date":"August 25, 2011","format":false,"excerpt":"I've been working on my second training course for Train Signal on managing Windows Server 2008 with Windows PowerShell, specifically the lesson on managing processes. I thought I'd share a little tidbit I worked out. In fact, I hope you'll stay tuned for other little goodies over the next several\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":8541,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8541\/getting-ciminstance-by-path\/","url_meta":{"origin":658,"position":3},"title":"Getting CIMInstance by Path","author":"Jeffery Hicks","date":"August 20, 2021","format":false,"excerpt":"I am a member of the PowerShell Cmdlet Working Group. We've been looking into this issue and it is an intriguing one. Enough so that I spent some time looking into it and writing up some test code. If you work with WMI\/CIM this might be of interest to you.\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/08\/add-ciminstancepath2.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/08\/add-ciminstancepath2.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/08\/add-ciminstancepath2.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/08\/add-ciminstancepath2.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":2241,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2241\/skipping-wmi-system-properties-in-powershell\/","url_meta":{"origin":658,"position":4},"title":"Skipping WMI System Properties in PowerShell","author":"Jeffery Hicks","date":"April 25, 2012","format":false,"excerpt":"One of my favorite techniques when using WMI in PowerShell is to pipe an object to Select-Object and select all properties. Try this: get-wmiobject win32_bios | select * It works, but it also gets all of the system properties like __PATH which I rarely care about. I also get other\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1687,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1687\/filter-left\/","url_meta":{"origin":658,"position":5},"title":"Filter Left","author":"Jeffery Hicks","date":"October 14, 2011","format":false,"excerpt":"When writing WMI queries expressions in Windows PowerShell, it is recommended to use WMI filtering, as opposed to getting objects and then filtering with Where-Object. I see expressions like this quite often: [cc lang=\"PowerShell\"] get-wmiobject win32_process -computer $c | where {$_.name -eq \"notepad.exe\"} [\/cc] In this situation, ALL process objects\u2026","rel":"","context":"In &quot;Best Practices&quot;","block_context":{"text":"Best Practices","link":"https:\/\/jdhitsolutions.com\/blog\/category\/best-practices\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/10\/talkbubble.png?resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/658","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=658"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/658\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=658"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=658"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=658"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}