Kurt's answer was a great answer.
But if you like netstat.exe, you CAN use native binaries in PS. You can
continue to use it just as you always have. Use a routine something like this:
function Run-Process
{
Param(
[string] $filepath,
[string] $arguments
)
$error.Clear()
$result = Start-Process -FilePath $filepath -ArgumentList
$arguments -Verb RunAs -Wait
if( !$? -or ( $result -and ( $result.ExitCode -ne 0 ) ) )
{
$LASTEXITCODE = if( $result ) { $result.ExitCode
} else { -1 }
Write-Error "Execution of $filepath failed
($LASTEXITCODE)"
Write-Error $error[ 0 ].ToString()
return 1
}
return 0
}
-----Original Message-----
From: [email protected] [mailto:[email protected]] On
Behalf Of Maglinger, Paul
Sent: Friday, October 30, 2015 4:47 PM
To: [email protected]
Subject: [powershell] Powershell equivelent to netstat -aob?
Looking to use Powershell to create a snapshot in time of what a workstation is
doing. I can find ways to pull down network statistics but is there a way to
pull down the equivalent of a #netstat -aob that would capture the connection
information?
There's some vbscripts out there that will do it, but would rather stick with
PS if possible.
-Paul
================================================
Did you know you can also post and find answers on PowerShell in the forums?
http://www.myitforum.com/forums/default.asp?catApp=1
================================================
Did you know you can also post and find answers on PowerShell in the forums?
http://www.myitforum.com/forums/default.asp?catApp=1