diff --git a/Data/scripts.csv b/Data/scripts.csv index 534eab5d..a20db097 100644 --- a/Data/scripts.csv +++ b/Data/scripts.csv @@ -76,6 +76,7 @@ hibernate.ps1, enables hibernate mode for the local computer (needs admin rights inspect-exe.ps1, prints basic information of the given executable file install-google-chrome.ps1, installs the Google Chrome browser install-signal-cli.ps1, installs signal-cli from github.com/AsamK/signal-cli +install-wsl.ps1, installs Windows Subsystem for Linux (WSL) introduce-powershell.ps1, introduces PowerShell to new users list-aliases.ps1, lists all PowerShell aliases list-anagrams.ps1, lists all anagrams of the given word diff --git a/README.md b/README.md index 21550b53..f38a1c6f 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,7 @@ Mega Collection of PowerShell Scripts * [hibernate.ps1](Scripts/hibernate.ps1) - enables hibernate mode for the local computer (needs admin rights) * [install-google-chrome.ps1](Scripts/install-google-chrome.ps1) - installs the Google Chrome browser * [install-signal-cli.ps1](Scripts/install-signal-cli.ps1) - installs signal-cli from github.com/AsamK/signal-cli +* [install-wsl.ps1](Scripts/install-wsl.ps1) - installs Windows Subsystem for Linux (WSL) * [list-cli-tools.ps1](Scripts/list-cli-tools.ps1) - lists available command-line interface (CLI) tools * [list-drives.ps1](Scripts/list-drives.ps1) - lists all drives * [list-network-shares.ps1](Scripts/list-network-shares.ps1) - lists the network shares of the local computer diff --git a/Scripts/install-google-chrome.ps1 b/Scripts/install-google-chrome.ps1 index 0c1159e9..401d9c01 100755 --- a/Scripts/install-google-chrome.ps1 +++ b/Scripts/install-google-chrome.ps1 @@ -12,12 +12,16 @@ #> try { + $StopWatch = [system.diagnostics.stopwatch]::startNew() + $Path = $env:TEMP; $Installer = "chrome_installer.exe" Invoke-WebRequest "http://dl.google.com/chrome/install/latest/chrome_installer.exe" -OutFile $Path\$Installer Start-Process -FilePath $Path\$Installer -Args "/silent /install" -Verb RunAs -Wait Remove-Item $Path\$Installer - write-host -foregroundColor green "✔️ installed Google Chrome" + + [int]$Elapsed = $StopWatch.Elapsed.TotalSeconds + "✔️ installed Google Chrome in $Elapsed sec" exit 0 } catch { write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" diff --git a/Scripts/install-wsl.ps1 b/Scripts/install-wsl.ps1 new file mode 100755 index 00000000..b643e15d --- /dev/null +++ b/Scripts/install-wsl.ps1 @@ -0,0 +1,38 @@ +<# +.SYNOPSIS + install-wsl.ps1 +.DESCRIPTION + Installs Windows Subsystem for Linux (WSL) - needs administrator rights +.EXAMPLE + PS> .\install-wsl.ps1 +.LINK + https://github.com/fleschutz/PowerShell +.NOTES + Author: Markus Fleschutz / License: CC0 +#> + +#Requires -RunAsAdministrator + +try { + $StopWatch = [system.diagnostics.stopwatch]::startNew() + + if ($false) { + + & wsl --install + + } else { + & dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart + + & dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart + + & wsl --set-default-version 2 + } + + [int]$Elapsed = $StopWatch.Elapsed.TotalSeconds + "✔️ installed Windows Subsystem for Linux (WSL) in $Elapsed sec" + " NOTE: reboot now, then visit the Microsoft Store and install a Linux distribution (e.g. Ubuntu, openSUSE, SUSE Linux, Kali Linux, Debian, Fedora, Pengwin, or Alpine)" + exit 0 +} catch { + write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" + exit 1 +} diff --git a/Scripts/list-cli-tools.ps1 b/Scripts/list-cli-tools.ps1 index e2697398..912afd2b 100755 --- a/Scripts/list-cli-tools.ps1 +++ b/Scripts/list-cli-tools.ps1 @@ -73,6 +73,7 @@ function ListTools { CheckFor cut "--version" CheckFor date "" CheckFor diff "--version" + CheckFor dism "" CheckFor driverquery "" CheckFor find "--version" CheckFor ftp "--version"