DEV Community

Cover image for Change the Network Profile to Public or Private on Windows
Sergio Peris
Sergio Peris

Posted on • Edited on • Originally published at sertxu.dev

Change the Network Profile to Public or Private on Windows

When you connect a Windows computer to a network, it automatically assings a profile either Public or Private.

This profile defines how the computer can be or not be reached from the network by other devices, and the resources it exposes to the network. Also affects the firewall configuration, so an app might be able to access or be exposed at a private network but no at a public network.

Change the Network Profile using PowerShell

You can change the Network Profile following the next steps.

First, we need to know the InterfaceIndex we want to change its profile.

Get-NetConnectionProfile
Enter fullscreen mode Exit fullscreen mode

This command will output something similar to this:

Name             : Red no identificada
InterfaceAlias   : Ethernet0
InterfaceIndex   : 14
NetworkCategory  : Public
IPv4Connectivity : LocalNetwork
IPv6Connectivity : NoTraffic
Enter fullscreen mode Exit fullscreen mode

As we can see, the InterfaceIndex is 14.

So now we can change its profile to either Public or Private.

The network profile was Public, so we’re changing it to Private.

Set-NetConnectionProfile -InterfaceIndex 14 -NetworkCategory Private
Enter fullscreen mode Exit fullscreen mode

If we check the configuration of the networks again, we will see it changed to Private.

Get-NetConnectionProfile
Enter fullscreen mode Exit fullscreen mode
Name             : Red no identificada
InterfaceAlias   : Ethernet0
InterfaceIndex   : 14
NetworkCategory  : Private
IPv4Connectivity : LocalNetwork
IPv6Connectivity : NoTraffic
Enter fullscreen mode Exit fullscreen mode

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay