Skip to content

Instantly share code, notes, and snippets.

@belgotux
belgotux / metered.ps1
Created December 23, 2022 14:11 — forked from nijave/metered.ps1
Powershell check if on metered network
[void][Windows.Networking.Connectivity.NetworkInformation, Windows, ContentType = WindowsRuntime]
$cost = [Windows.Networking.Connectivity.NetworkInformation]::GetInternetConnectionProfile().GetConnectionCost()
$cost.ApproachingDataLimit -or $cost.OverDataLimit -or $cost.Roaming -or $cost.BackgroundDataUsageRestricted -or ($cost.NetworkCostType -ne "Unrestricted")