Update some scripts

This commit is contained in:
Markus Fleschutz 2024-02-07 13:38:38 +01:00
parent 97cd42cb86
commit 3a5f2371e3
4 changed files with 9 additions and 8 deletions

View File

@ -20,6 +20,7 @@
& "$PSScriptRoot/check-cpu.ps1" & "$PSScriptRoot/check-cpu.ps1"
& "$PSScriptRoot/check-ram.ps1" & "$PSScriptRoot/check-ram.ps1"
& "$PSScriptRoot/check-gpu.ps1" & "$PSScriptRoot/check-gpu.ps1"
& "$PSScriptRoot/check-bios.ps1"
& "$PSScriptRoot/check-smart-devices.ps1" & "$PSScriptRoot/check-smart-devices.ps1"
& "$PSScriptRoot/check-power.ps1" & "$PSScriptRoot/check-power.ps1"
& "$PSScriptRoot/check-drives.ps1" & "$PSScriptRoot/check-drives.ps1"

View File

@ -7,7 +7,6 @@
PS> ./check-software.ps1 PS> ./check-software.ps1
S O F T W A R E S O F T W A R E
BIOS model 'P62 v02.67' version HPQOEM - 0 by HP
Windows 10 Pro 64-Bit (v10.0.19045, since 5/2/2021) Windows 10 Pro 64-Bit (v10.0.19045, since 5/2/2021)
... ...
.LINK .LINK
@ -18,7 +17,6 @@
" " " "
& "$PSScriptRoot/write-green.ps1" " S O F T W A R E" & "$PSScriptRoot/write-green.ps1" " S O F T W A R E"
& "$PSScriptRoot/check-bios.ps1"
& "$PSScriptRoot/check-os.ps1" & "$PSScriptRoot/check-os.ps1"
& "$PSScriptRoot/check-uptime.ps1" & "$PSScriptRoot/check-uptime.ps1"
& "$PSScriptRoot/check-apps.ps1" & "$PSScriptRoot/check-apps.ps1"

View File

@ -5,7 +5,7 @@
This PowerShell script queries the computer's uptime (time between now and last boot up time) and prints it. This PowerShell script queries the computer's uptime (time between now and last boot up time) and prints it.
.EXAMPLE .EXAMPLE
PS> ./check-uptime.ps1 PS> ./check-uptime.ps1
Up for 2 days, 20 hours, 10 minutes OfficePC is up for 13 days since 1/25/2024
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -26,14 +26,15 @@ function TimeSpan2String([TimeSpan]$uptime)
} }
try { try {
$hostname = $(hostname)
if ($IsLinux) { if ($IsLinux) {
$uptime = (Get-Uptime) $uptime = (Get-Uptime)
Write-Host "Up for $(TimeSpan2String $uptime)" Write-Host "$hostname is up for $(TimeSpan2String $uptime)"
} else { } else {
[system.threading.thread]::currentthread.currentculture = [system.globalization.cultureinfo]"en-US" [system.threading.thread]::currentthread.currentculture = [system.globalization.cultureinfo]"en-US"
$lastBootTime = (Get-CimInstance Win32_OperatingSystem).LastBootUpTime $lastBootTime = (Get-CimInstance Win32_OperatingSystem).LastBootUpTime
$uptime = New-TimeSpan -Start $lastBootTime -End (Get-Date) $uptime = New-TimeSpan -Start $lastBootTime -End (Get-Date)
Write-Host "Up for $(TimeSpan2String $uptime) since $($lastBootTime.ToShortDateString())" Write-Host "$hostname is up for $(TimeSpan2String $uptime) since $($lastBootTime.ToShortDateString())"
} }
exit 0 # success exit 0 # success
} catch { } catch {

View File

@ -1,8 +1,8 @@
<# <#
.SYNOPSIS .SYNOPSIS
Executes tasks on desktop login Executes tasks on every desktop login
.DESCRIPTION .DESCRIPTION
This PowerShell script executes some 'welcome' tasks on desktop login by the user. This PowerShell script executes some 'welcome' tasks on every desktop login by the user.
NOTE: For installation on Windows create and put a symbolic link to this script into the Autostart folder (usually at: C:\Users\<USERNAME>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup). NOTE: For installation on Windows create and put a symbolic link to this script into the Autostart folder (usually at: C:\Users\<USERNAME>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup).
.EXAMPLE .EXAMPLE
PS> ./on-desktop-login.ps1 PS> ./on-desktop-login.ps1
@ -16,10 +16,11 @@ try {
& "$PSScriptRoot/write-big.ps1" "Welcome back" & "$PSScriptRoot/write-big.ps1" "Welcome back"
" " " "
& "$PSScriptRoot/check-uptime.ps1" & "$PSScriptRoot/check-uptime.ps1"
& "$PSScriptRoot/check-pending-reboot.ps1"
& "$PSScriptRoot/check-firewall.ps1" & "$PSScriptRoot/check-firewall.ps1"
& "$PSScriptRoot/check-smart-devices.ps1"
& "$PSScriptRoot/check-swap-space.ps1" & "$PSScriptRoot/check-swap-space.ps1"
& "$PSScriptRoot/check-drives.ps1" & "$PSScriptRoot/check-drives.ps1"
& "$PSScriptRoot/check-pending-reboot.ps1"
& "$PSScriptRoot/open-dashboards.ps1" & "$PSScriptRoot/open-dashboards.ps1"
" " " "
& "$PSScriptRoot/write-quote.ps1" & "$PSScriptRoot/write-quote.ps1"