Change Network Adapter Profile from Public to Private

Hi all,

How would I use powershell to change a network adapter from public to private on system startup?

Max.

April 8th, 2011 10:16am

Apparently Brandon has some code that can do this:

http://archive.msdn.microsoft.com/bsonposh

Willing to run 3rd party/community stuff?

Free Windows Admin Tool Kit Click here and download it now
April 10th, 2011 1:28pm

Apparently Brandon has some code that can do this:

http://archive.msdn.microsoft.com/bsonposh

Willing to run 3rd party/community stuff?

April 10th, 2011 1:28pm

Try this:

 

Setting Network Location to Private

http://blogs.msdn.com/b/powershell/archive/2009/04/03/setting-network-location-to-private.aspx

 

Best Regards

Dale

Free Windows Admin Tool Kit Click here and download it now
April 11th, 2011 1:37am

Try this:

 

Setting Network Location to Private

http://blogs.msdn.com/b/powershell/archive/2009/04/03/setting-network-location-to-private.aspx

 

Best Regards

Dale

June 9th, 2011 3:05pm

I know this is an old thread, but if you're running either WinSrv2012R2 or Win8.1 or later, you can just do this in PS:

PS C:\> $AdapterProfile = Get-NetConnectionProfile -InterfaceAlias "Random Ethernet Adapter Name"
PS C:\> $AdapterProfile.NetworkCategory = "Private"
PS C:\> Set-NetConnectionProfile -InterfaceAlias "Random Ethernet Adapter Name" $AdapterProfile


Free Windows Admin Tool Kit Click here and download it now
August 16th, 2014 12:32am

Almost.  The last line is incorrect.  Should be:

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

October 13th, 2014 1:28am

Hi,

I have a weird issue on 2008 R2. I just finished installing a 2008R2 server, with 2 NICs. I did not change any setting, except IP addresses. I configured the following IP addresses :

- NIC1 : 192.168.0.1

- NIC2 : 131.107.0.1

The weird thing is : The two NICs automaically merge in the same Network Public profile. If I join the server to a domain, the 2 NICs again join the same Domain Profile.

I wanted to install DirectAcess. But ; DirectAccess does require one of the NICs be identified as having a Public Profile.

I did read some interesting articles on "Network List Manager Policies" GPO. But these did not help me avoiding the merge of the two profiles.

Thanks in advance for any help.

Free Windows Admin Tool Kit Click here and download it now
March 15th, 2015 10:58am

PS C:\> Set-NetConnectionProfile -InterfaceAlias "Random Ethernet Adapter Name" -NetworkCategory Private
Above works with PowerShell 5. Get-NetConnectionProfile is not necessary if you don't plan to anything other than this with the NetConnectionProfile object. Set-NetConnectionProfile is aware of all of the NetworkCatagory objects on the host.
  • Proposed as answer by Aliphatic 3 hours 45 minutes ago
August 6th, 2015 8:53pm

PS C:\> Set-NetConnectionProfile -InterfaceAlias "Random Ethernet Adapter Name" -NetworkCategory Private
Above works with PowerShell 5. Get-NetConnectionProfile is not necessary if you don't plan to anything other than this with the NetConnectionProfile object. Set-NetConnectionProfile is aware of all of the NetworkCatagory objects on the host.
  • Proposed as answer by Aliphatic 3 hours 36 minutes ago
Free Windows Admin Tool Kit Click here and download it now
August 6th, 2015 8:59pm

That's actually true, you don't need to save the object. Well described.
August 6th, 2015 11:33pm

PS C:\> Set-NetConnectionProfile -InterfaceAlias "Random Ethernet Adapter Name" -NetworkCategory Private
Above works with PowerShell 5. Get-NetConnectionProfile is not necessary if you don't plan to anything other than this with the NetConnectionProfile object. Set-NetConnectionProfile is aware of all of the NetworkCatagory objects on the host.
  • Proposed as answer by Aliphatic Friday, August 07, 2015 3:25 AM
Free Windows Admin Tool Kit Click here and download it now
August 7th, 2015 12:51am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics