Differences

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