Skip to content

Instantly share code, notes, and snippets.

@Anid4u2c
Forked from nijave/metered.ps1
Created August 11, 2020 15:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Anid4u2c/e9f5a831f7f878ba9dab81e7ab32c010 to your computer and use it in GitHub Desktop.
Save Anid4u2c/e9f5a831f7f878ba9dab81e7ab32c010 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