mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-03-26 14:26:10 +01:00
Improve executing other scripts
This commit is contained in:
parent
6cf41e4221
commit
381c3b850f
@ -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) {
|
||||
|
@ -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
|
||||
|
@ -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."
|
||||
|
@ -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])"
|
||||
|
@ -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])"
|
||||
|
@ -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])"
|
||||
|
Loading…
Reference in New Issue
Block a user