The following PowerShell script provides a way to change network profiles.
# Run as Administrator
# Get all network profiles set as public
$publicNetworks = Get-NetConnectionProfile | Where-Object { $_.NetworkCategory -eq "Public" }
if ($publicNetworks)
{
foreach ($network in $publicNetworks)
{
try {
Set-NetConnectionProfile -InterfaceIndex $network.InterfaceIndex -NetworkCategory Private
Write-Host "Network $($network.Name) changed to Private."
} catch {
Write-Error "Failed to change network $($network.Name) to Private."
}
}
}
0 Comments