Skip to content
This repository has been archived by the owner on May 5, 2022. It is now read-only.

tonikautto/windows-process-port-usage

 
 

Repository files navigation

MOVED TO https://github.com/qlik-product-success/windows-process-port-usage

Windows Port Allocation Per Process

This project contains a Powershell script that collect process and port allocation data from Windows, and stores the results to CSV files. By runnig the script at scheduled intervals through a Windows task, port allocation trends over time can be analysed through the attached Qlik Sense app.

Configuration and setup

Powershell script

  1. Create folder c:/temp unless it already exists

  2. Clone or download this GitHub project to c:/temp

  3. Open Powershell and run the script manually to confirm it works

    • Trace only TCP and write results to subfolder 'PortTraces'
      Windows-Port-Usage.ps1
    • Trace only TCP and do not compress result to ZIP archive
      Windows-Port-Usage.ps1 -NoZip
    • Trace only TCP and write results to custom location
      Windows-Port-Usage.ps1 -OutputFolder "\\MyFileServer\PortTraces\"
    • Trace TCP and UDP and write results to same folder as PS1 file
      Windows-Port-Usage.ps1 -InlcudeUDP
    • Trace TCP and UDP and write results to custom location
      Windows-Port-Usage.ps1 -OutputFolder "\\MyFileServer\PortTraces\" -InlcudeUDP
  4. Confirm script output based selected output location

Windows Task

  1. Configure a Windows Scheduled Task to execute this regularly:
    • Start > Task Scheduler
    • Highlight Task Scheduler Library
    • Create Task
  2. General Tab Config
    • Name: Arbitrary
    • Account: This needs to be a local admin account
    • Run regardless of whether the user is logged in
    • Example screenshot: Screenshot of setting up a task
  3. Triggers config:
    • 15 minutes is an ideal frequency
    • Be sure to enable the trigger
    • Example Screenshot: Screenshot of setting up a task
  4. Actions Tab Config:
    NOTE: Adjust argument based on prefernce option from step 3.
    • Start a program
    • Path: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
    • Arguments: -ExecutionPolicy Bypass C:\Temp\Windows-Port-Usage.ps1
    • Example Screenshot: Screenshot of setting up a task
  5. Manually run the task & make sure it outputs a CSV

Qlik Sense App

  1. Import app
  2. Configure data connection
    • Default conenciton points to C:\TEMP\ProcessUsage
    • Adjust to desired location of collected CSV files
  3. Reload app

Original Author

levi-turner

License

This project is provided "AS IS", without any warranty, under the MIT License - see the LICENSE file for details

About

PowerShell script + Qlik app to monitor TCP port usage

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PowerShell 100.0%