Enhance the error message

This commit is contained in:
Markus Fleschutz 2021-05-02 21:30:48 +02:00
parent 2f53d5c1d6
commit 8947cbed1f
153 changed files with 153 additions and 153 deletions

View File

@ -13,6 +13,6 @@ try {
"MD5 hash is" $Result.Hash "MD5 hash is" $Result.Hash
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -13,6 +13,6 @@ try {
write-output "SHA1 hash is" $Result.Hash write-output "SHA1 hash is" $Result.Hash
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -13,6 +13,6 @@ try {
write-output "SHA256 hash is:" $Result.Hash write-output "SHA256 hash is:" $Result.Hash
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -48,6 +48,6 @@ try {
Start-Process powershell -Verb runAs -ArgumentList "-command & {$command} $arg" Start-Process powershell -Verb runAs -ArgumentList "-command & {$command} $arg"
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -18,6 +18,6 @@ try {
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -81,6 +81,6 @@ try {
"✔️ built Git repository 📂$RepoDir in $Elapsed sec." "✔️ built Git repository 📂$RepoDir in $Elapsed sec."
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -23,6 +23,6 @@ try {
write-host -foregroundColor green "✔️ built $Count Git repositories at $ParentDir in $Elapsed sec." write-host -foregroundColor green "✔️ built $Count Git repositories at $ParentDir in $Elapsed sec."
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -29,6 +29,6 @@ try {
} }
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -27,6 +27,6 @@ try {
"✔️ $Average domains/s ($Count domains resolved in $Elapsed sec.)" "✔️ $Average domains/s ($Count domains resolved in $Elapsed sec.)"
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -22,6 +22,6 @@ try {
"✔️ $Free GB left on drive $Drive ($Used GB of $Total GB used)" "✔️ $Free GB left on drive $Drive ($Used GB of $Total GB used)"
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -20,6 +20,6 @@ try {
write-host -foregroundColor green "✔️ file system on drive $Drive is clean" write-host -foregroundColor green "✔️ file system on drive $Drive is clean"
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -28,6 +28,6 @@ try {
exit 1 exit 1
} }
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -41,6 +41,6 @@ try {
exit 1 exit 1
} }
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -29,6 +29,6 @@ try {
exit 1 exit 1
} }
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -27,6 +27,6 @@ try {
"✔️ $Avg ms average ping latency ($Min ms min, $Max ms max)" "✔️ $Avg ms average ping latency ($Min ms min, $Max ms max)"
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -33,6 +33,6 @@ try {
"✔️ $Free GB left on swap space ($Used GB of $Total GB used)" "✔️ $Free GB left on swap space ($Used GB of $Total GB used)"
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -30,6 +30,6 @@ try {
write-host -foregroundColor green "OK - found $SymlinksTotal symlinks total, $SymlinksBroken symlinks are broken" write-host -foregroundColor green "OK - found $SymlinksTotal symlinks total, $SymlinksBroken symlinks are broken"
exit $SymlinksBroken exit $SymlinksBroken
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -46,6 +46,6 @@ try {
} }
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -14,6 +14,6 @@ try {
write-host -foregroundColor green "✔️ checked Windows system files" write-host -foregroundColor green "✔️ checked Windows system files"
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -32,6 +32,6 @@ try {
write-host -foregroundColor green "OK - XML file is valid" write-host -foregroundColor green "OK - XML file is valid"
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -53,6 +53,6 @@ try {
"DONE." "DONE."
exit 0 exit 0
} catch { } catch {
write-error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -26,6 +26,6 @@ try {
"✔️ Git repository 📂$RepoDir is clean now" "✔️ Git repository 📂$RepoDir is clean now"
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -10,6 +10,6 @@ try {
"✔️ recycle bin have been emptied" "✔️ recycle bin have been emptied"
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -34,6 +34,6 @@ try {
"✔️ cloned $Count Git repositories at 📂$ParentDir in $Elapsed sec." "✔️ cloned $Count Git repositories at 📂$ParentDir in $Elapsed sec."
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -38,6 +38,6 @@ try {
write-host -foregroundColor green "✔️ closed $FullProgramName, found ($($Processes.Count) process(es)" write-host -foregroundColor green "✔️ closed $FullProgramName, found ($($Processes.Count) process(es)"
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -26,6 +26,6 @@ try {
& git config --list & git config --list
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -16,6 +16,6 @@ try {
} }
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -19,6 +19,6 @@ try {
$result | Export-Csv $csvfilepath -NoTypeInformation $result | Export-Csv $csvfilepath -NoTypeInformation
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -20,6 +20,6 @@ try {
$result | Export-Csv $csvfilepath -NoTypeInformation $result | Export-Csv $csvfilepath -NoTypeInformation
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -17,6 +17,6 @@ try {
$SpeechSynthesizer.Dispose() $SpeechSynthesizer.Dispose()
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -34,6 +34,6 @@ try {
"✔️ created new branch 🌵$NewBranchName in Git repository $RepoDir" "✔️ created new branch 🌵$NewBranchName in Git repository $RepoDir"
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -22,6 +22,6 @@ try {
write-host -foregroundColor green "✔️ shortcut $Shortcut created." write-host -foregroundColor green "✔️ shortcut $Shortcut created."
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -15,6 +15,6 @@ try {
write-host -foregroundColor green "✔️ symlink $Symlink created (pointing to $Target)" write-host -foregroundColor green "✔️ symlink $Symlink created (pointing to $Target)"
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -31,6 +31,6 @@ try {
"🔖 tag $NewTagName has been created" "🔖 tag $NewTagName has been created"
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -163,6 +163,6 @@ try {
write-host -foregroundColor green "Done." write-host -foregroundColor green "Done."
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -18,6 +18,6 @@ try {
} }
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -18,6 +18,6 @@ try {
write-host -foregroundColor green "OK - directory downloaded from $URL" write-host -foregroundColor green "OK - directory downloaded from $URL"
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -18,6 +18,6 @@ try {
write-host -foregroundColor green "OK - file downloaded from $URL" write-host -foregroundColor green "OK - file downloaded from $URL"
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -18,6 +18,6 @@ try {
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -16,6 +16,6 @@ try {
"✔️ new icon added to the desktop" "✔️ new icon added to the desktop"
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -13,6 +13,6 @@ try {
write-host -foregroundColor green "OK - SSH client enabled" write-host -foregroundColor green "OK - SSH client enabled"
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -15,6 +15,6 @@ try {
write-host -foregroundColor green "OK - SSH server enabled" write-host -foregroundColor green "OK - SSH server enabled"
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -148,6 +148,6 @@ try {
write-host -foregroundColor green "Done." write-host -foregroundColor green "Done."
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -27,6 +27,6 @@ try {
write-host -foregroundColor green "Done - QR code has been written to $NewFile" write-host -foregroundColor green "Done - QR code has been written to $NewFile"
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -12,6 +12,6 @@ try {
[System.Windows.Forms.Application]::SetSuspendState("Hibernate", $false, $false); [System.Windows.Forms.Application]::SetSuspendState("Hibernate", $false, $false);
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -15,6 +15,6 @@ try {
get-childitem $PathToExe | % {$_.VersionInfo} | Select * get-childitem $PathToExe | % {$_.VersionInfo} | Select *
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -14,6 +14,6 @@ try {
write-host -foregroundColor green "✔️ installed Google Chrome" write-host -foregroundColor green "✔️ installed Google Chrome"
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -24,6 +24,6 @@ try {
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -9,6 +9,6 @@ try {
get-alias get-alias
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -54,6 +54,6 @@ try {
GetPermutations -String $Word | Format-Wide -Column $Columns GetPermutations -String $Word | Format-Wide -Column $Columns
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -68,6 +68,6 @@ try {
write-host -foregroundColor green "OK - $($Vars.Count) PowerShell automatic variables total" write-host -foregroundColor green "OK - $($Vars.Count) PowerShell automatic variables total"
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -32,6 +32,6 @@ try {
write-output "" write-output ""
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -14,6 +14,6 @@ try {
} }
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -9,6 +9,6 @@ try {
"📋 $(get-clipboard)" "📋 $(get-clipboard)"
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -9,6 +9,6 @@ try {
Get-Command -Command-Type cmdlet Get-Command -Command-Type cmdlet
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -31,6 +31,6 @@ try {
write-output "" write-output ""
exit 0 exit 0
} catch { } catch {
write-error "⚠️ ERROR: $($Error[0]) (line $($_.InvocationInfo.ScriptLineNumber))" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -35,6 +35,6 @@ try {
& "$PSScriptRoot/write-big.ps1" " Thanx 4 watching" & "$PSScriptRoot/write-big.ps1" " Thanx 4 watching"
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -38,6 +38,6 @@ try {
write-host "($($global:Dirs) directories, $($global:Files) files, $($global:Bytes) bytes total)" write-host "($($global:Dirs) directories, $($global:Files) files, $($global:Bytes) bytes total)"
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -25,6 +25,6 @@ try {
ListDir $Directory | format-wide -autoSize ListDir $Directory | format-wide -autoSize
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -9,6 +9,6 @@ try {
get-PSDrive -PSProvider FileSystem get-PSDrive -PSProvider FileSystem
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -14,6 +14,6 @@ try {
(Invoke-WebRequest -Uri "https://earthquake.usgs.gov/fdsnws/event/1/query?format=$Format&minmagnitude=$MinMagnitude&orderby=$OrderBy" -UserAgent "curl" ).Content (Invoke-WebRequest -Uri "https://earthquake.usgs.gov/fdsnws/event/1/query?format=$Format&minmagnitude=$MinMagnitude&orderby=$OrderBy" -UserAgent "curl" ).Content
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -18,6 +18,6 @@ try {
"✔️ directory tree $DirTree has $Count empty directories" "✔️ directory tree $DirTree has $Count empty directories"
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -21,6 +21,6 @@ try {
write-host -foregroundColor green "OK - found $Count empty file(s)" write-host -foregroundColor green "OK - found $Count empty file(s)"
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -9,6 +9,6 @@ try {
Get-ChildItem env: Get-ChildItem env:
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -12,6 +12,6 @@ try {
Get-ChildItem -path $DirTree -recurse | select FullName Get-ChildItem -path $DirTree -recurse | select FullName
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -19,6 +19,6 @@ try {
"✔️ directory tree $DirTree has $Count hidden file(s)" "✔️ directory tree $DirTree has $Count hidden file(s)"
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -9,6 +9,6 @@ try {
get-appxPackage | select-object Name,Version | format-table -autoSize get-appxPackage | select-object Name,Version | format-table -autoSize
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -10,6 +10,6 @@ try {
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -24,6 +24,6 @@ try {
write-output "" write-output ""
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -9,6 +9,6 @@ try {
get-module | format-table get-module | format-table
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -9,6 +9,6 @@ try {
get-wmiobject win32_share | where {$_.name -NotLike "*$"} get-wmiobject win32_share | where {$_.name -NotLike "*$"}
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -19,6 +19,6 @@ try {
} }
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -22,6 +22,6 @@ try {
} }
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -20,6 +20,6 @@ try {
} }
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -10,6 +10,6 @@ try {
get-WMIObject -Class Win32_Printer -ComputerName $ComputerName | format-table get-WMIObject -Class Win32_Printer -ComputerName $ComputerName | format-table
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -9,6 +9,6 @@ try {
Get-Process | Format-Table -Property Id, @{Label="CPU(s)";Expression={$_.CPU.ToString("N")+"%"};Alignment="Right"}, ProcessName -AutoSize Get-Process | Format-Table -Property Id, @{Label="CPU(s)";Expression={$_.CPU.ToString("N")+"%"};Alignment="Right"}, ProcessName -AutoSize
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -24,6 +24,6 @@ try {
ShowProfile "4" "CurrentUserCurrentHost" $PROFILE.CurrentUserCurrentHost ShowProfile "4" "CurrentUserCurrentHost" $PROFILE.CurrentUserCurrentHost
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -26,6 +26,6 @@ try {
write-output "" write-output ""
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -23,6 +23,6 @@ try {
write-output "" write-output ""
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -9,6 +9,6 @@ try {
(New-Object -ComObject Shell.Application).NameSpace(0x0a).Items() | Select-Object Name,Size,Path (New-Object -ComObject Shell.Application).NameSpace(0x0a).Items() | Select-Object Name,Size,Path
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -25,6 +25,6 @@ try {
write-host -foregroundColor green "OK - $($global:NumScripts) PowerShell scripts total" write-host -foregroundColor green "OK - $($global:NumScripts) PowerShell scripts total"
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -9,6 +9,6 @@ try {
Get-Service Get-Service
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -27,6 +27,6 @@ try {
write-output "" write-output ""
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -9,6 +9,6 @@ try {
get-scheduledTask get-scheduledTask
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -9,6 +9,6 @@ try {
get-timezone get-timezone
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -9,6 +9,6 @@ try {
get-timezone -listavailable | format-table -property Id,DisplayName,SupportsDaylightSavingTime get-timezone -listavailable | format-table -property Id,DisplayName,SupportsDaylightSavingTime
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -16,6 +16,6 @@ try {
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -9,6 +9,6 @@ try {
Get-LocalGroup Get-LocalGroup
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -42,6 +42,6 @@ try {
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -10,6 +10,6 @@ try {
"📂$CWD" "📂$CWD"
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -31,6 +31,6 @@ try {
write-error "City $City not found" write-error "City $City not found"
exit 1 exit 1
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -13,6 +13,6 @@ try {
write-output $result write-output $result
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -33,6 +33,6 @@ try {
write-error "Zip-code $ZipCode in country $CountryCode not found" write-error "Zip-code $ZipCode in country $CountryCode not found"
exit 1 exit 1
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -19,6 +19,6 @@ try {
write-host -foregroundColor green "Done - synced to %DST_DIR%" write-host -foregroundColor green "Done - synced to %DST_DIR%"
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -9,6 +9,6 @@ try {
(Invoke-WebRequest http://wttr.in/Moon -UserAgent "curl" ).Content (Invoke-WebRequest http://wttr.in/Moon -UserAgent "curl" ).Content
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -11,6 +11,6 @@ try {
"🔇 audio is muted" "🔇 audio is muted"
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -12,6 +12,6 @@ try {
Start-Process $URL Start-Process $URL
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -15,6 +15,6 @@ try {
"📣 $Joke" "📣 $Joke"
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -11,6 +11,6 @@ try {
Start-Process $URL Start-Process $URL
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -9,6 +9,6 @@ try {
start-process calc.exe start-process calc.exe
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

Some files were not shown because too many files have changed in this diff Show More