Quantcast
Channel: THWACK: Discussion List - All Communities
Viewing all articles
Browse latest Browse all 16365

Need some help with Powershell remote execution... (or another way to measure active network connections on a remote server)

$
0
0

I have a powershell script that I'm trying to convert into a monitor for SAM, but am running into some issues. I'm hoping the community can point me in the right direction. To run this script locally, I have launch powershell with Run As Admin. I've tried putting this into SAM to run locally, and run remotely without any success. The basic script (for run locally) is:

 

$netstat    = Invoke-Command -Computer $computer -ScriptBlock{

        (netstat -an | Select-String -Pattern '17777' | Measure-Object ).COUNT

        }

Write-Output "Statistic: $netstat"

Write-Output "Message: $netstat pattern matches found"

 

I've also tried using the Remote Host execution method with the necessary modifications to the script without any luck.

 

Ultimately what I'm trying to do is count the number of TCP connections for a specific application port. What happens is that the service itself continues to run, or appear to run, even though it's stopped handling the application jobs. Having this monitor would point us in the right direction, saving some trouble shooting steps. It would also be an interesting way to track application usage.


Viewing all articles
Browse latest Browse all 16365

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>