Add install-updates.ps1

This commit is contained in:
Markus Fleschutz 2021-09-17 16:14:05 +02:00
parent bf8ddfbe0b
commit ad5557adc0
3 changed files with 33 additions and 0 deletions

View File

@ -82,6 +82,7 @@ install-knot-resolver.ps1, Installs the Knot Resolver (needs admin rights)
install-signal-cli.ps1, Installs signal-cli from github.com/AsamK/signal-cli install-signal-cli.ps1, Installs signal-cli from github.com/AsamK/signal-cli
install-ssh-client.ps1, Installs the SSH client (needs admin rights) install-ssh-client.ps1, Installs the SSH client (needs admin rights)
install-ssh-server.ps1, Installs the SSH server (needs admin rights) install-ssh-server.ps1, Installs the SSH server (needs admin rights)
install-updates.ps1, Installs updates (needs admin rights)
install-vscode.ps1, Installs Visual Studio Code install-vscode.ps1, Installs Visual Studio Code
install-wsl.ps1, Installs Windows Subsystem for Linux (WSL), needs admin rights install-wsl.ps1, Installs Windows Subsystem for Linux (WSL), needs admin rights
introduce-powershell.ps1, Introduces PowerShell to new users introduce-powershell.ps1, Introduces PowerShell to new users

Can't render this file because it has a wrong number of fields in line 87.

View File

@ -64,6 +64,7 @@ Mega Collection of PowerShell Scripts
| [install-ssh-client.ps1](Scripts/install-ssh-client.ps1) | Installs the SSH client (needs admin rights) | [Help](Docs/install-ssh-client.ps1.md) | | [install-ssh-client.ps1](Scripts/install-ssh-client.ps1) | Installs the SSH client (needs admin rights) | [Help](Docs/install-ssh-client.ps1.md) |
| [install-ssh-server.ps1](Scripts/install-ssh-server.ps1) | Installs the SSH server (needs admin rights) | [Help](Docs/install-ssh-server.ps1.md) | | [install-ssh-server.ps1](Scripts/install-ssh-server.ps1) | Installs the SSH server (needs admin rights) | [Help](Docs/install-ssh-server.ps1.md) |
| [install-signal-cli.ps1](Scripts/install-signal-cli.ps1) | Installs signal-cli from github.com/AsamK/signal-cli | [Help](Docs/install-signal-cli.ps1.md) | | [install-signal-cli.ps1](Scripts/install-signal-cli.ps1) | Installs signal-cli from github.com/AsamK/signal-cli | [Help](Docs/install-signal-cli.ps1.md) |
| [install-updates.ps1](Scripts/install-updates.ps1) | Installs updates (need admin rights) | [Help](Docs/install-updates.ps1.md) |
| [install-vscode.ps1](Scripts/install-vscode.ps1) | Installs Visual Studio Code | [Help](Docs/install-vscode.ps1.md) | | [install-vscode.ps1](Scripts/install-vscode.ps1) | Installs Visual Studio Code | [Help](Docs/install-vscode.ps1.md) |
| [install-wsl.ps1](Scripts/install-wsl.ps1) | Installs Windows Subsystem for Linux (WSL), needs admin rights | [Help](Docs/install-wsl.ps1.md) | | [install-wsl.ps1](Scripts/install-wsl.ps1) | Installs Windows Subsystem for Linux (WSL), needs admin rights | [Help](Docs/install-wsl.ps1.md) |
| [list-cli-tools.ps1](Scripts/list-cli-tools.ps1) | Lists available command-line interface (CLI) tools | [Help](Docs/list-cli-tools.ps1.md) | | [list-cli-tools.ps1](Scripts/list-cli-tools.ps1) | Lists available command-line interface (CLI) tools | [Help](Docs/list-cli-tools.ps1.md) |

31
Scripts/install-updates.ps1 Executable file
View File

@ -0,0 +1,31 @@
<#
.SYNOPSIS
install-updates.ps1
.DESCRIPTION
Installs updates (needs admin rights)
.EXAMPLE
PS> .\install-updates.ps1
.NOTES
Author: Markus Fleschutz · License: CC0
.LINK
https://github.com/fleschutz/PowerShell
#>
#Requires -RunAsAdministrator
try {
$StopWatch = [system.diagnostics.stopwatch]::startNew()
if ($IsLinux) {
apt update && apt upgrade && apt autoremove && snap refresh
} else {
"Sorry, not supported yet"
}
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
"✔️ installed updates in $Elapsed sec"
exit 0
} catch {
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
exit 1
}