Reset Network

functions/public/Invoke-WPFFixesNetwork.ps1
 1function Invoke-WPFFixesNetwork {
 2    <#
 3
 4    .SYNOPSIS
 5        Resets various network configurations
 6
 7    #>
 8
 9    Write-Host "Resetting Network with netsh"
10
11    Set-WinUtilTaskbaritem -state "Normal" -value 0.01 -overlay "logo"
12    # Reset WinSock catalog to a clean state
13    Start-Process -NoNewWindow -FilePath "netsh" -ArgumentList "winsock", "reset"
14
15    Set-WinUtilTaskbaritem -state "Normal" -value 0.35 -overlay "logo"
16    # Resets WinHTTP proxy setting to DIRECT
17    Start-Process -NoNewWindow -FilePath "netsh" -ArgumentList "winhttp", "reset", "proxy"
18
19    Set-WinUtilTaskbaritem -state "Normal" -value 0.7 -overlay "logo"
20    # Removes all user configured IP settings
21    Start-Process -NoNewWindow -FilePath "netsh" -ArgumentList "int", "ip", "reset"
22
23    Set-WinUtilTaskbaritem -state "None" -overlay "checkmark"
24
25    Write-Host "Process complete. Please reboot your computer."
26
27    $ButtonType = [System.Windows.MessageBoxButton]::OK
28    $MessageboxTitle = "Network Reset "
29    $Messageboxbody = ("Stock settings loaded.`n Please reboot your computer")
30    $MessageIcon = [System.Windows.MessageBoxImage]::Information
31
32    [System.Windows.MessageBox]::Show($Messageboxbody, $MessageboxTitle, $ButtonType, $MessageIcon)
33    Write-Host "=========================================="
34    Write-Host "-- Network Configuration has been Reset --"
35    Write-Host "=========================================="
36}