Get-Nettcpconnection question for remote computer

Kaplan, Andrew H 101 Reputation points
2023-08-31T19:19:32.8566667+00:00

Hello.

I am experimenting with the Get-Netcpconnection command, and I am trying to combine the '-AppliedSetting Internet' option with 'CimSession' in order to get the intended output for a remote system. I am having problems getting the two to work together, so I wanted to know is there a way to so, or should I try something else?

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,576 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Nathan Giannini 161 Reputation points
    2023-08-31T23:51:43.59+00:00

    Assuming you have appropriate access, and there is a MSFT_NetTCPConnection object with the property 'AppliedSetting' that is equal to 'Internet', something like this should do the trick:

    $cimSession = New-CimSession -ComputerName <ComputerName>
    Get-NetTCPConnection -AppliedSetting Internet -CimSession $cimSession
    

    Best Regards,

    Nathan Giannini


    If the Answer is helpful, please click "Accept Answer" and upvote it.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.