mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-03-25 13:36:39 +01:00
Add install-wsl.ps1
This commit is contained in:
parent
1cee5b6ae2
commit
829e04afe1
@ -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
|
||||
|
|
@ -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
|
||||
|
@ -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])"
|
||||
|
38
Scripts/install-wsl.ps1
Executable file
38
Scripts/install-wsl.ps1
Executable file
@ -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
|
||||
}
|
@ -73,6 +73,7 @@ function ListTools {
|
||||
CheckFor cut "--version"
|
||||
CheckFor date ""
|
||||
CheckFor diff "--version"
|
||||
CheckFor dism ""
|
||||
CheckFor driverquery ""
|
||||
CheckFor find "--version"
|
||||
CheckFor ftp "--version"
|
||||
|
Loading…
Reference in New Issue
Block a user