This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
automation:powershell:set_network_profile [2018/02/25 01:18] external edit
automation:powershell:set_network_profile [2019/02/03 03:50] (current)
Line 21: Line 21:
 <​code>​ <​code>​
 Set-NetConnectionProfile -InterfaceIndex 8 -NetworkCategory DomainAuthenticated Set-NetConnectionProfile -InterfaceIndex 8 -NetworkCategory DomainAuthenticated
 +====== One-Liner to Set All Public Networks to Private ======
 +$NetConnectionProfiles = Get-NetConnectionProfile ​ | Where-Object {$_.NetworkCategory -eq '​Public'​}
 +ForEach ($NetConnectionProfile in $NetConnectionProfiles) { Set-NetConnectionProfile -NetworkCategory Private }
 +and another line to turn network discovery on again if you need it
 +netsh advfirewall firewall set rule group="​Network Discovery"​ new enable=yes
 </​code>​ </​code>​
  • Last modified: 2019/02/03 03:50
  • by regypt