Change Network Profile to Private Using PowerShell

If you’re fighting with Network Level Authentication (see this post) and need to quickly change a workstation from Public to Private, this should work in PowerShell:

Get-NetConnectionProfile

Note the InterfaceIndex of the adapter you want to change, e.g. 13.

Set-NetConnectionProfile -InterfaceIndex 13 -NetworkCategory Private

Credit to this post.

6 thoughts on “Change Network Profile to Private Using PowerShell

  1. Anon

    It’s rare to get the one sheet on tips these days. Thanks!

  2. josh dahle

    i use this a bunch.

    Get-NetConnectionProfile | Set-NetConnectionProfile -NetworkCategory Private

  3. Mark Berry Post author

    @Josh, so you’re piping the output of one to the other. What happens if there are multiple NICs? In other words, if (Get-NetConnectionProfile).GetType() shows that it’s an _array_ of Objects, not just one Object?

    PS C:\> (Get-NetConnectionProfile).GetType()

    IsPublic IsSerial Name BaseType
    -------- -------- ---- --------
    True True Object[] System.Array

  4. anon

    @Mark: @Josh’s command sets *all items in the array* to the specified network category. It’s equivalent to:

    `Get-NetConnectionProfile -InterfaceAlias * | Set-NetConnectionProfile -NetworkCategory Private`

  5. Mark Berry Post author

    Ah got it, thanks. That is nice to have it on one line and not have to manually pick out the InterfaceIndex.

  6. Jimbo

    Bloody marvellous. All the “instructions” on changing the profile through the W10 user interface refer to buttons or descriptions that no longer exist. Thank you for a clear, concise procedure that just works.

Leave a Reply

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.