diff --git a/Scripts/check-health.ps1 b/Scripts/check-health.ps1 index 9dd0d707..dba14311 100755 --- a/Scripts/check-health.ps1 +++ b/Scripts/check-health.ps1 @@ -10,24 +10,24 @@ $Hostname = $(hostname) $Healthy = 1 "Checking health of $Hostname ..." -& ./check-swap-space.ps1 +& "$PSScriptRoot/check-swap-space.ps1" if ($lastExitCode -ne "0") { $Healthy = 0 } if ($IsLinux) { - & ./check-drive-space.ps1 / + & "$PSScriptRoot/check-drive-space.ps1" / if ($lastExitCode -ne "0") { $Healthy = 0 } } else { - & ./check-drive-space.ps1 C + & "$PSScriptRoot/check-drive-space.ps1" C if ($lastExitCode -ne "0") { $Healthy = 0 } } -& ./check-cpu-temp.ps1 +& "$PSScriptRoot/check-cpu-temp.ps1" if ($lastExitCode -ne "0") { $Healthy = 0 } -& ./check-dns-resolution.ps1 +& "$PSScriptRoot/check-dns-resolution.ps1" if ($lastExitCode -ne "0") { $Healthy = 0 } -& ./check-ping.ps1 +& "$PSScriptRoot/check-ping.ps1" if ($lastExitCode -ne "0") { $Healthy = 0 } if ($Healthy) { diff --git a/Scripts/introduce-powershell.ps1 b/Scripts/introduce-powershell.ps1 index 568153da..5bb5b058 100755 --- a/Scripts/introduce-powershell.ps1 +++ b/Scripts/introduce-powershell.ps1 @@ -7,10 +7,10 @@ #> try { - & write-big.ps1 "PowerShell" + & "$PSScriptRoot/write-big.ps1" "PowerShell" - & write-animated.ps1 "Welcome to PowerShell" - & write-animated.ps1 "Feel the power of the console and scripting" + & "$PSScriptRoot/write-animated.ps1" "Welcome to PowerShell" + & "$PSScriptRoot/write-animated.ps1" "Feel the power of the console and scripting" "" "* Want to learn PowerShell? See the tutorials at: https://www.guru99.com/powershell-tutorial.html" @@ -20,7 +20,7 @@ try { "* Want sample scripts? See PowerShell Scripts at: https://github.com/fleschutz/PowerShell/" "" - & write-typewriter.ps1 "P.S. PowerShell is looking forward to execute your next command" + & "$PSScriptRoot/write-typewriter.ps1" "P.S. PowerShell is looking forward to execute your next command" "" exit 0 diff --git a/Scripts/simulate-presence.ps1 b/Scripts/simulate-presence.ps1 index d1a5dc1d..3d154b9a 100755 --- a/Scripts/simulate-presence.ps1 +++ b/Scripts/simulate-presence.ps1 @@ -14,9 +14,9 @@ if ($IPaddress -eq "" ) { try { for ([int]$i = 0; $i -lt 1000; $i++) { - & ./switch-shelly1.ps1 $IPaddress on 0 + & "$PSScriptRoot/switch-shelly1.ps1" $IPaddress on 0 start-sleep -s 10 - & ./switch-shelly1.ps1 $IPaddress off 0 + & "$PSScriptRoot/switch-shelly1.ps1" $IPaddress off 0 start-sleep -s 60 } write-host -foregroundColor green "Done." diff --git a/Scripts/speak-date.ps1 b/Scripts/speak-date.ps1 index abaa9a49..ebe71da2 100755 --- a/Scripts/speak-date.ps1 +++ b/Scripts/speak-date.ps1 @@ -8,7 +8,7 @@ try { [system.threading.thread]::currentthread.currentculture=[system.globalization.cultureinfo]"en-US" - & ./speak-english.ps1 "Today is $((Get-Date).ToShortDateString())" + & "$PSScriptRoot/speak-english.ps1" "Today is $((Get-Date).ToShortDateString())" exit 0 } catch { write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" diff --git a/Scripts/speak-joke.ps1 b/Scripts/speak-joke.ps1 index f11d96c2..b1e7d060 100755 --- a/Scripts/speak-joke.ps1 +++ b/Scripts/speak-joke.ps1 @@ -16,7 +16,7 @@ try { $Joke = $Table[$Index].Joke - & ./speak-english.ps1 "$Joke" + & "$PSScriptRoot/speak-english.ps1" "$Joke" exit 0 } catch { write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" diff --git a/Scripts/speak-time.ps1 b/Scripts/speak-time.ps1 index ec55d876..73efc97a 100755 --- a/Scripts/speak-time.ps1 +++ b/Scripts/speak-time.ps1 @@ -8,7 +8,7 @@ try { [system.threading.thread]::currentthread.currentculture=[system.globalization.cultureinfo]"en-US" - & ./speak-english.ps1 "It's now $((Get-Date).ToShortTimeString())" + & "$PSScriptRoot/speak-english.ps1" "It's now $((Get-Date).ToShortTimeString())" exit 0 } catch { write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"