add reset network with netsh (#768)

This commit is contained in:
Padsala Tushal
2023-05-17 22:43:53 +05:30
committed by GitHub
parent 96cd8bfd28
commit d21a06424b
4 changed files with 29 additions and 3 deletions

View File

@ -45,6 +45,7 @@ function Invoke-WPFButton {
"WPFPaneluser" {Invoke-WPFControlPanel -Panel $button} "WPFPaneluser" {Invoke-WPFControlPanel -Panel $button}
"WPFUpdatesdefault" {Invoke-WPFUpdatesdefault} "WPFUpdatesdefault" {Invoke-WPFUpdatesdefault}
"WPFFixesUpdate" {Invoke-WPFFixesUpdate} "WPFFixesUpdate" {Invoke-WPFFixesUpdate}
"WPFFixesNetwork" {Invoke-WPFFixesNetwork}
"WPFUpdatesdisable" {Invoke-WPFUpdatesdisable} "WPFUpdatesdisable" {Invoke-WPFUpdatesdisable}
"WPFUpdatessecurity" {Invoke-WPFUpdatessecurity} "WPFUpdatessecurity" {Invoke-WPFUpdatessecurity}
"WPFWinUtilShortcut" {Invoke-WPFShortcut -ShortcutToAdd "WinUtil"} "WPFWinUtilShortcut" {Invoke-WPFShortcut -ShortcutToAdd "WinUtil"}

View File

@ -0,0 +1,11 @@
function Invoke-WPFFixesNetwork {
<#
.DESCRIPTION
PlaceHolder
#>
Write-Host "Reseting Network with netsh"
netsh int ip reset
netsh winsock reset
}

View File

@ -10,7 +10,7 @@
Author : Chris Titus @christitustech Author : Chris Titus @christitustech
Runspace Author: @DeveloperDurp Runspace Author: @DeveloperDurp
GitHub : https://github.com/ChrisTitusTech GitHub : https://github.com/ChrisTitusTech
Version : 23.05.16 Version : 23.05.17
#> #>
Start-Transcript $ENV:TEMP\Winutil.log -Append Start-Transcript $ENV:TEMP\Winutil.log -Append
@ -21,7 +21,7 @@ Add-Type -AssemblyName System.Windows.Forms
# variable to sync between runspaces # variable to sync between runspaces
$sync = [Hashtable]::Synchronized(@{}) $sync = [Hashtable]::Synchronized(@{})
$sync.PSScriptRoot = $PSScriptRoot $sync.PSScriptRoot = $PSScriptRoot
$sync.version = "23.05.16" $sync.version = "23.05.17"
$sync.configs = @{} $sync.configs = @{}
$sync.ProcessRunning = $false $sync.ProcessRunning = $false
Function Get-WinUtilCheckBoxes { Function Get-WinUtilCheckBoxes {
@ -871,6 +871,7 @@ function Invoke-WPFButton {
"WPFPaneluser" {Invoke-WPFControlPanel -Panel $button} "WPFPaneluser" {Invoke-WPFControlPanel -Panel $button}
"WPFUpdatesdefault" {Invoke-WPFUpdatesdefault} "WPFUpdatesdefault" {Invoke-WPFUpdatesdefault}
"WPFFixesUpdate" {Invoke-WPFFixesUpdate} "WPFFixesUpdate" {Invoke-WPFFixesUpdate}
"WPFFixesNetwork" {Invoke-WPFFixesNetwork}
"WPFUpdatesdisable" {Invoke-WPFUpdatesdisable} "WPFUpdatesdisable" {Invoke-WPFUpdatesdisable}
"WPFUpdatessecurity" {Invoke-WPFUpdatessecurity} "WPFUpdatessecurity" {Invoke-WPFUpdatessecurity}
"WPFWinUtilShortcut" {Invoke-WPFShortcut -ShortcutToAdd "WinUtil"} "WPFWinUtilShortcut" {Invoke-WPFShortcut -ShortcutToAdd "WinUtil"}
@ -966,6 +967,17 @@ function Invoke-WPFFeatureInstall {
[System.Windows.MessageBox]::Show($Messageboxbody, $MessageboxTitle, $ButtonType, $MessageIcon) [System.Windows.MessageBox]::Show($Messageboxbody, $MessageboxTitle, $ButtonType, $MessageIcon)
} }
} }
function Invoke-WPFFixesNetwork {
<#
.DESCRIPTION
PlaceHolder
#>
Write-Host "Reseting Network with netsh"
netsh int ip reset
netsh winsock reset
}
function Invoke-WPFFixesUpdate { function Invoke-WPFFixesUpdate {
<# <#
@ -2332,6 +2344,7 @@ $inputXML = '<Window x:Class="WinUtility.MainWindow"
<Label Content="Fixes" FontSize="16"/> <Label Content="Fixes" FontSize="16"/>
<Button Name="WPFPanelAutologin" FontSize="14" Background="AliceBlue" Content="Set Up Autologin" HorizontalAlignment = "Left" Margin="5,2" Padding="20,5" Width="300"/> <Button Name="WPFPanelAutologin" FontSize="14" Background="AliceBlue" Content="Set Up Autologin" HorizontalAlignment = "Left" Margin="5,2" Padding="20,5" Width="300"/>
<Button Name="WPFFixesUpdate" FontSize="14" Background="AliceBlue" Content="Reset Windows Update" HorizontalAlignment = "Left" Margin="5,2" Padding="20,5" Width="300"/> <Button Name="WPFFixesUpdate" FontSize="14" Background="AliceBlue" Content="Reset Windows Update" HorizontalAlignment = "Left" Margin="5,2" Padding="20,5" Width="300"/>
<Button Name="WPFFixesNetwork" FontSize="14" Background="AliceBlue" Content="Reset Network" HorizontalAlignment = "Left" Margin="5,2" Padding="20,5" Width="300"/>
<Button Name="WPFPanelDISM" FontSize="14" Background="AliceBlue" Content="System Corruption Scan" HorizontalAlignment = "Left" Margin="5,2" Padding="20,5" Width="300"/> <Button Name="WPFPanelDISM" FontSize="14" Background="AliceBlue" Content="System Corruption Scan" HorizontalAlignment = "Left" Margin="5,2" Padding="20,5" Width="300"/>
</StackPanel> </StackPanel>
<StackPanel Background="#777777" SnapsToDevicePixels="True" Grid.Column="1" Margin="10,5"> <StackPanel Background="#777777" SnapsToDevicePixels="True" Grid.Column="1" Margin="10,5">
@ -5413,7 +5426,7 @@ catch [System.Management.Automation.MethodInvocationException] {
} }
} }
catch { catch {
# If it broke some other way <img draggable="false" role="img" class="emoji" alt="??" src="https://s0.wp.com/wp-content/mu-plugins/wpcom-smileys/twemoji/2/svg/1f600.svg"> # If it broke some other way <img draggable="false" role="img" class="emoji" alt="????" src="https://s0.wp.com/wp-content/mu-plugins/wpcom-smileys/twemoji/2/svg/1f600.svg">
Write-Host "Unable to load Windows.Markup.XamlReader. Double-check syntax and ensure .net is installed." Write-Host "Unable to load Windows.Markup.XamlReader. Double-check syntax and ensure .net is installed."
} }

View File

@ -392,6 +392,7 @@
<Label Content="Fixes" FontSize="16"/> <Label Content="Fixes" FontSize="16"/>
<Button Name="WPFPanelAutologin" FontSize="14" Background="AliceBlue" Content="Set Up Autologin" HorizontalAlignment = "Left" Margin="5,2" Padding="20,5" Width="300"/> <Button Name="WPFPanelAutologin" FontSize="14" Background="AliceBlue" Content="Set Up Autologin" HorizontalAlignment = "Left" Margin="5,2" Padding="20,5" Width="300"/>
<Button Name="WPFFixesUpdate" FontSize="14" Background="AliceBlue" Content="Reset Windows Update" HorizontalAlignment = "Left" Margin="5,2" Padding="20,5" Width="300"/> <Button Name="WPFFixesUpdate" FontSize="14" Background="AliceBlue" Content="Reset Windows Update" HorizontalAlignment = "Left" Margin="5,2" Padding="20,5" Width="300"/>
<Button Name="WPFFixesNetwork" FontSize="14" Background="AliceBlue" Content="Reset Network" HorizontalAlignment = "Left" Margin="5,2" Padding="20,5" Width="300"/>
<Button Name="WPFPanelDISM" FontSize="14" Background="AliceBlue" Content="System Corruption Scan" HorizontalAlignment = "Left" Margin="5,2" Padding="20,5" Width="300"/> <Button Name="WPFPanelDISM" FontSize="14" Background="AliceBlue" Content="System Corruption Scan" HorizontalAlignment = "Left" Margin="5,2" Padding="20,5" Width="300"/>
</StackPanel> </StackPanel>
<StackPanel Background="#777777" SnapsToDevicePixels="True" Grid.Column="1" Margin="10,5"> <StackPanel Background="#777777" SnapsToDevicePixels="True" Grid.Column="1" Margin="10,5">