WhoisConnected.ps1

<#PSScriptInfo
.SYNOPSIS
See who's connected to your machine
 
.DESCRIPTION
Use this script to identify remotely connected users. This includes users who are mapped to your machine.
 
.VERSION
1.0.0
 
.AUTHOR
gaseceh
 
.PROJECTURI
https://github.com/gaseceh
 
.GUID
8c739c6a-4d56-42b3-a3d1-fb5c5bf25e4d
 
.TAGS
 samba smb remote connections nettcpconnection
 
.NOTES
If you see no results, there are currently no remote connections
#>





Get-NetTCPConnection | Where-Object {$_.LocalPort -eq "445" -or $_.LocalPort -eq "139" -or $_.LocalPort -eq "137" -and ($_.RemotePort -ne "0")} | Select-Object RemoteAddress, LocalPort