SCCM 2012 Detect Client Connection Type (Intranet Internet)

Here’s powershell command how to detect if SCCM 2012 Client is Internet or Intranet
$IsInternetClient = (Get-WmiObject -namespace root\ccm -query "select InInternet from ClientInfo").InInternet

$IsInternetclient value is $true when Client is connected over Internet
$IsInternetclient value is $false when Client is connected over Intarnet