major change to override Write-Error func
This commit is contained in:
+11
-11
@@ -64,7 +64,7 @@ ForEach($file in $RecycleBin.Items()) {
|
||||
If ( Test-Path "${Env:SystemDrive}\hiberfil.sys" ) {
|
||||
Write-Output "Turning off system hibernation"
|
||||
Try { Start-Process "powercfg" -ArgumentList "-h off" -Wait }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
Catch { Write-Error $_.Exception.Message }
|
||||
}
|
||||
|
||||
# Remove PDCRevocation dump files
|
||||
@@ -81,7 +81,7 @@ If ( Test-Path "${Env:ProgramData}\Genetec\Dumps" ) {
|
||||
{
|
||||
Write-Output "Deleting Genetec application crash dumps"
|
||||
Try { ForEach ( $dump in $GenetecCrashDumps ) { Remove-Item $dump.FullName -Force -Recurse -ErrorAction SilentlyContinue } }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
Catch { Write-Error $_.Exception.Message }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ If ( Test-Path $ESDB ) {
|
||||
Write-Output " - Starting Windows Search Service"
|
||||
Start-Process "net.exe" -ArgumentList "start wsearch" -Wait
|
||||
}
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
Catch { Write-Error $_.Exception.Message }
|
||||
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ If ( Test-Path $ADSKInst ) {
|
||||
$path = $folder.FullName
|
||||
Write-Output "Deleting Autodesk installer directory: ""${path}"""
|
||||
Try { Remove-Item $folder -Force -Recurse -ErrorAction SilentlyContinue }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
Catch { Write-Error $_.Exception.Message }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ ForEach ( $userProfile in $(EnumUserProfiles) ) {
|
||||
Write-Output "Deleting AutoCAD temp files"
|
||||
ForEach ( $tempfile in $AutoCADTempFiles ) {
|
||||
Try { Remove-Item $tempfile -Force -ErrorAction SilentlyContinue }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
Catch { Write-Error $_.Exception.Message }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -171,7 +171,7 @@ ForEach ( $userProfile in $(EnumUserProfiles) ) {
|
||||
# ForEach ( $path in $IPSW ) {
|
||||
# Write-Output " - Deleting: ""${path}"""
|
||||
# Try { Remove-Item -Path $path -Force -ErrorAction SilentlyContinue }
|
||||
# Catch { LogErr $_.Exception.Message }
|
||||
# Catch { Write-Error $_.Exception.Message }
|
||||
# }
|
||||
# }
|
||||
|
||||
@@ -180,7 +180,7 @@ ForEach ( $userProfile in $(EnumUserProfiles) ) {
|
||||
# ForEach ( $path in $IPA ) {
|
||||
# Write-Output " - Deleting: ""${path}"""
|
||||
# Try { Remove-Item -Path $path -Force -ErrorAction SilentlyContinue }
|
||||
# Catch { LogErr $_.Exception.Message }
|
||||
# Catch { Write-Error $_.Exception.Message }
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
@@ -193,7 +193,7 @@ ForEach ( $userProfile in $(EnumUserProfiles) ) {
|
||||
$path = $oldDownloadedApp.FullName
|
||||
Write-Output " - Deleting: ""${path}"""
|
||||
Try { Remove-Item -Path $path -Force -ErrorAction SilentlyContinue }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
Catch { Write-Error $_.Exception.Message }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ ForEach ( $userProfile in $(EnumUserProfiles) ) {
|
||||
# Delete the duplicate file
|
||||
Write-Output "Deleting duplicate download: ""${ToDelete}"""
|
||||
Try { Remove-Item -Path $ToDelete -Force -ErrorAction SilentlyContinue }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
Catch { Write-Error $_.Exception.Message }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -240,7 +240,7 @@ ForEach ( $userProfile in $(EnumUserProfiles) ) {
|
||||
$path = $file.FullName
|
||||
Write-Output "Deleting: ""${path}"""
|
||||
Try { Remove-Item -Path $path -Force -ErrorAction SilentlyContinue }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
Catch { Write-Error $_.Exception.Message }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -252,4 +252,4 @@ ForEach ( $userProfile in $(EnumUserProfiles) ) {
|
||||
# Start-Process "cleanmgr.exe" -ArgumentList "/VERYLOWDISK"
|
||||
# Write-Output " - Finished"
|
||||
#}
|
||||
#Catch { LogErr $_.Exception.Message }
|
||||
#Catch { Write-Error $_.Exception.Message }
|
||||
Reference in New Issue
Block a user