Get NetConnectionProfile - PowerShell


Overview

Get-NetConnectionProfile retrieves information about the active network connection profiles on a computer. It provides details such as the profile names, connection statuses, and network adapter details.

Syntax

Get-NetConnectionProfile [-Name] <string[]>

Options/Flags

  • -Name: Specifies the name of the specific network connection profile to retrieve information about. If omitted, information about all active profiles is returned.

Examples

Get information about all active network connection profiles:

Get-NetConnectionProfile

Get information about a specific network connection profile:

Get-NetConnectionProfile -Name "MyNetworkProfile"

Get information about multiple network connection profiles:

Get-NetConnectionProfile -Name "MyNetworkProfile", "OtherNetworkProfile"

Common Issues

  • Profile not found: If the specified network connection profile name does not exist, an error will be returned.
  • Access denied: If the current user does not have sufficient privileges to access network connection profile information, an error will be returned.

Integration

Combine with Get-NetIPInterface: Retrieve additional network interface details associated with the connection profiles.

Get-NetConnectionProfile | Get-NetIPInterface

Use in a script: Automate network management tasks by using Get-NetConnectionProfile to gather connection information.

$profiles = Get-NetConnectionProfile
if ($profiles.Count -eq 0) {
    Write-Warning "No active network connection profiles found."
}
else {
    foreach ($profile in $profiles) {
        Write-Output "Profile Name: $profile.Name"
        Write-Output "Status: $profile.Status"
    }
}
  • New-NetConnectionProfile: Creates a new network connection profile.
  • Remove-NetConnectionProfile: Deletes an existing network connection profile.
  • Set-NetConnectionProfile: Modifies an existing network connection profile.