Created
May 14, 2019 19:30
-
-
Save rn4n/8485b56f4ad50a304d098632f35f7f2c to your computer and use it in GitHub Desktop.
Update the internet settings.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.DESCRIPTION | |
Atualiza as configurações de Internet, deve-se chamar este script após alterar | |
uma configuração de proxy, por exemplo. | |
#> | |
function RefreshInternetSettings(){ | |
$signature = @' | |
[DllImport("wininet.dll", SetLastError = true, CharSet=CharSet.Auto)] | |
public static extern bool InternetSetOption(IntPtr hInternet, int dwOption, IntPtr lpBuffer, int dwBufferLength); | |
'@ | |
$INTERNET_OPTION_SETTINGS_CHANGED = 39 | |
$INTERNET_OPTION_REFRESH = 37 | |
$type = Add-Type -MemberDefinition $signature -Name wininet -Namespace pinvoke -PassThru | |
$a = $type::InternetSetOption(0, $INTERNET_OPTION_SETTINGS_CHANGED, 0, 0) | |
$b = $type::InternetSetOption(0, $INTERNET_OPTION_REFRESH, 0, 0) | |
return $a -and $b | |
} | |
RefreshInternetSettings |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment