Hello @71LoveTech
To answer your query kindly check this link.
Scroll down to the bottom and look at the Power shell script. It shows the listeners, process names, and the service name if one exists.
To see if I could parse that output and possible incorporate it into the ShowListeners.ps1 script. I just left it as a second script. This may show you some of the "ownership information".
This is "work in progress" script.
Script: ShowSystemListeners.ps1
Author: MotoX80
- cls
- $r = (netsh.exe http show servicestate view=requestq) -join "" # make it one long string
- $r = $r -replace " Request queue name", "============" # we only want these that are not indented
- $ra = $r -split "Request queue name: " # create an array of each entry to be processed
- $idx = 1 # skip over header
8.while ($idx -lt $ra.count) { - $tf = $ra[$idx] -match '(Process IDs:).*(URL groups:)'
- if ($tf) {
$matches[0] # uncomment to see what we found.
- } else {
"No pids???" # we didn't find the headings. not sure what kind of entry this is.
- $idx++ # go to next entry
- continue
- }
-
- $ids = $matches[0].split(" ") # get pids, but we only process the first one. I have not seen 2 pids on my machine
- $p = ($ids -match "^\d+$")[0]
- if ($p -eq $null) {
"No pids2???"
- $tf = $ra[$idx] -match '(Controller process ID:).*(Process IDs:)'
- if ($tf) {
24.#$matches[0] # uncomment to see what we found. - } else {
"No pids???" # we didn't find the headings. not sure what kind of entry this is.
- $idx++ # go to next entry
- continue
- }
-
- $ids = $matches[0].split(" ") # get pids
- $p = ($ids -match "^\d+$")[0] # our pid
-
$idx++ # I think that each listener must have a controlling pid
break
continue
- }
- "======================== $idx ======================================================================="
-
- $tf = $ra[$idx] -match '(Registered URLs:).*(Server session)'42.
- if ($tf) {
$matches[0]
- } else {
- "No HTTP addresses???"
$ra[$idx]
- $idx++
continue
- }
- $http = $matches[0].split(" ")
- $http -match ':/'
- ""
- "Process ID: $p"
-
- $s = Get-CimInstance win32_service -FIlter "ProcessId=$p"
- ""
- (Get-Process -Id $p -IncludeUserName| Format-List -Property Path, company, Description, Username | Out-String).trim()
- "ComandLine : {0}" -f (Get-CimInstance win32_process -FIlter "ProcessId=$p").Commandline
- ""
- if ($s) {
- (Get-Service -Name $No HTTP addresses???"
$ra[$idx]
- $idx++
continue
- }
- $http = $matches[0].split(" ")
- $http -match ':/'
- ""
- "Process ID: $p"
-
- $s = Get-CimInstance win32_service -FIlter "ProcessId=$p"
- ""
- (Get-Process -Id $p -IncludeUserName| Format-List -Property Path, company, Description, Username | Out-String).trim()
- "ComandLine : {0}" -f (Get-CimInstance win32_process -FIlter "ProcessId=$p").Commandline
- ""
- if ($s) {
- (Get-Service -Name $No HTTP addresses???"
$ra[$idx]
- $idx++
continue
- }
- $http = $matches[0].split(" ")
- $http -match ':/'
- ""
- "Process ID: $p"
-
- $s = Get-CimInstance win32_service -FIlter "ProcessId=$p"
- ""
- (Get-Process -Id $p -IncludeUserName| Format-List -Property Path, company, Description, Username | Out-String).trim()
- "ComandLine : {0}" -f (Get-CimInstance win32_process -FIlter "ProcessId=$p").Commandline
- ""
- if ($s) {
- (Get-Service -Name $"Process ID: $p"
-
- $s = Get-CimInstance win32_service -FIlter "ProcessId=$p"
- ""
- (Get-Process -Id $p -IncludeUserName| Format-List -Property Path, company, Description, Username | Out-String).trim()
- "ComandLine : {0}" -f (Get-CimInstance win32_process -FIlter "ProcessId=$p").Commandline
- ""
- if ($s) {
- (Get-Service -Name $"Process ID: $p"
-
- $s = Get-CimInstance win32_service -FIlter "ProcessId=$p"
- ""
- (Get-Process -Id $p -IncludeUserName| Format-List -Property Path, company, Description, Username | Out-String).trim()
- "ComandLine : {0}" -f (Get-CimInstance win32_process -FIlter "ProcessId=$p").Commandline
- ""
- if ($s) {
- (Get-Service -Name $if ($s) {
- (Get-Service -Name $if ($s) {
- (Get-Service -Name $s.name | Format-Table -AutoSize | Out-String).trim()
- ""
- }
-
- $idx++
- }
--
If the Answer is helpful, please click "Accept Answer" and upvote it.