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."
        }
    }
}
Catégories : Windows 11

0 commentaire

Laisser un commentaire

Emplacement de l’avatar

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Ce site utilise Akismet pour réduire les indésirables. En savoir plus sur comment les données de vos commentaires sont utilisées.