Skip to content

Instantly share code, notes, and snippets.

@AdamGrossTX
Forked from nijave/metered.ps1
Created May 21, 2020 17:19
Show Gist options
  • Save AdamGrossTX/e3e458550046425b8c1054e1830ff488 to your computer and use it in GitHub Desktop.
Save AdamGrossTX/e3e458550046425b8c1054e1830ff488 to your computer and use it in GitHub Desktop.
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")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment