How to change from public to private network on Server 2012 using powershell commands

We have found RDP can stop working, as other items, because the profile on the Network card changes from Private to Public.

How do you change this back from public to private without a reboot?
We have a simple solution below.
NOTE: This has been tested and working however we always recommend you take full backups and be cautious of any system changes as every environment is unique.

 

Powershell. Here is an example of changing the network profile of a network interface called Ethernet1 from whatever it is now to “Private.” I got this info from Get-Help Set-NetConnectionProfile -Full.

PS C:\>$Profile = Get-NetConnectionProfile -InterfaceAlias Ethernet1

PS C:\>$Profile.NetworkCategory = "Private"

PS C:\>Set-NetConnectionProfile -InputObject $Profile

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.