mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-11-14 22:55:52 -06:00
Added Try-Catch blocks for remaining removal tasks (#2365)
* Added Try-Catch blocks for remaining removal tasks
* Delete winutil.ps1 from tracking list
* Revert "Delete winutil.ps1 from tracking list"
This reverts commit 97044425ea
.
This commit is contained in:
parent
4553f3e758
commit
5083b84233
@ -38,6 +38,8 @@ function Remove-Features([switch] $dumpFeatures = $false, [switch] $keepDefender
|
|||||||
Remove-Features -keepDefender:$false
|
Remove-Features -keepDefender:$false
|
||||||
|
|
||||||
#>
|
#>
|
||||||
|
try
|
||||||
|
{
|
||||||
$featlist = (Get-WindowsOptionalFeature -Path $scratchDir).FeatureName
|
$featlist = (Get-WindowsOptionalFeature -Path $scratchDir).FeatureName
|
||||||
if ($dumpFeatures)
|
if ($dumpFeatures)
|
||||||
{
|
{
|
||||||
@ -64,10 +66,17 @@ function Remove-Features([switch] $dumpFeatures = $false, [switch] $keepDefender
|
|||||||
}
|
}
|
||||||
Write-Progress -Activity "Removing features" -Status "Ready" -Completed
|
Write-Progress -Activity "Removing features" -Status "Ready" -Completed
|
||||||
Write-Host "You can re-enable the disabled features at any time, using either Windows Update or the SxS folder in <installation media>\Sources."
|
Write-Host "You can re-enable the disabled features at any time, using either Windows Update or the SxS folder in <installation media>\Sources."
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
Write-Host "Unable to get information about the features. MicroWin processing will continue, but features will not be processed"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Remove-Packages
|
function Remove-Packages
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
$pkglist = (Get-WindowsPackage -Path "$scratchDir").PackageName
|
$pkglist = (Get-WindowsPackage -Path "$scratchDir").PackageName
|
||||||
|
|
||||||
$pkglist = $pkglist | Where-Object {
|
$pkglist = $pkglist | Where-Object {
|
||||||
@ -122,6 +131,11 @@ function Remove-Packages
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Write-Progress -Activity "Removing Apps" -Status "Ready" -Completed
|
Write-Progress -Activity "Removing Apps" -Status "Ready" -Completed
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
Write-Host "Unable to get information about the packages. MicroWin processing will continue, but packages will not be processed"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Remove-ProvisionedPackages([switch] $keepSecurity = $false)
|
function Remove-ProvisionedPackages([switch] $keepSecurity = $false)
|
||||||
|
Loading…
Reference in New Issue
Block a user