Add some install* / uninstall* scripts

This commit is contained in:
Markus Fleschutz 2022-07-15 17:12:01 +02:00
parent f1ac46af9d
commit bc7cdc330a
49 changed files with 1214 additions and 617 deletions

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Installs Audacity
.DESCRIPTION
This PowerShell script installs Audacity.
.EXAMPLE
PS> ./install-audacity
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Installing Audacity, please wait..."
& winget install --id Audacity.Audacity --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
"Audacity installed successfully."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Installs Chrome
.DESCRIPTION
This PowerShell script installs the Google Chrome browser.
.EXAMPLE
PS> ./install-chrome
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Installing Google Chrome, please wait..."
& winget install --id Google.Chrome --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
"Google Chrome installed successfully."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Installs CrystalDiskInfo
.DESCRIPTION
This PowerShell script installs CrystalDiskInfo from the Microsoft Store.
.EXAMPLE
PS> ./install-crystal-disk-info
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Installing CrystalDiskInfo, please wait..."
& winget install "CrystalDiskInfo" --source msstore --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
"CrystalDiskInfo installed successfully."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Installs CrystalDiskMark
.DESCRIPTION
This PowerShell script installs CrystalDiskMark from the Microsoft Store.
.EXAMPLE
PS> ./install-crystal-disk-mark
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Installing CrystalDiskMark, please wait..."
& winget install "CrystalDiskMark Shizuku Edition" --source msstore --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
"CrystalDiskMark installed successfully."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Installs Discord
.DESCRIPTION
This PowerShell script installs Discord from the Microsoft Store.
.EXAMPLE
PS> ./install-discord
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Installing Discord, please wait..."
& winget install "Discord" --source msstore --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
"Discord installed successfully."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

25
Scripts/install-edge.ps1 Normal file
View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Installs Microsoft Edge
.DESCRIPTION
This PowerShell script installs the Microsoft Edge Browser from the Microsoft Store.
.EXAMPLE
PS> ./install-edge
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Installing Edge, please wait..."
& winget install "Microsoft Edge Browser" --source msstore --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
"Microsoft Edge installed successfully."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Installs Mozilla Firefox
.DESCRIPTION
This PowerShell script installs Mozilla Firefox from the Microsoft Store.
.EXAMPLE
PS> ./install-firefox
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Installing Firefox, please wait..."
& winget install "Mozilla Firefox Browser" --source msstore --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
"Firefox installed successfully."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Installs Git Extensions
.DESCRIPTION
This PowerShell script installs Git Extensions.
.EXAMPLE
PS> ./install-git-extensions
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Installing Git Extensions, please wait..."
& winget install --id GitExtensionsTeam.GitExtensions --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
"Git Extensions installed successfully."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Installs Git for Windows
.DESCRIPTION
This PowerShell script installs Git for Windows.
.EXAMPLE
PS> ./install-git-for-windows
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Installing Git for Windows, please wait..."
& winget install --id Git.Git -e --source winget --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
"Git for Windows installed successfully."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Installs IrfanView
.DESCRIPTION
This PowerShell script installs IrfanView from the Microsoft Store.
.EXAMPLE
PS> ./install-irfan-view
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Installing IrfanView, please wait..."
& winget install "IrfanView64" --source msstore --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
"IrfanView installed successfully."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Installs Microsoft Teams
.DESCRIPTION
This PowerShell script installs Microsoft Teams from the Microsoft Store.
.EXAMPLE
PS> ./install-microsoft-teams
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Installing Microsoft Teams, please wait..."
& winget install --id Microsoft.Teams --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
"Microsoft Teams installed successfully."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Installs Netflix
.DESCRIPTION
This PowerShell script installs Netflix from the Microsoft Store.
.EXAMPLE
PS> ./install-netflix
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Installing Netflix, please wait..."
& winget install "Netflix" --source msstore --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
"Netflix installed successfully."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Installs 9 ZIP
.DESCRIPTION
This PowerShell script installs 9 ZIP from the Microsoft Store.
.EXAMPLE
PS> ./install-nine-zip
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Installing 9 Zip, please wait..."
& winget install "9 ZIP - open rar, zip, 7zip, gzip" --source msstore --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
"9 Zip installed successfuly."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Installs One Calendar
.DESCRIPTION
This PowerShell script installs One Calendar from the Microsoft Store.
.EXAMPLE
PS> ./install-one-calendar
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Installing One Calendar, please wait..."
& winget install "One Calendar" --source msstore --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
"One Calendar installed successfully."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Installs Opera Browser
.DESCRIPTION
This PowerShell script installs Opera Browser from Microsoft Store.
.EXAMPLE
PS> ./install-opera-browser
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Installing Opera Browser, please wait..."
& winget install "Opera Browser" --source msstore --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
"Opera Browser installed successfully."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Installs Opera GX
.DESCRIPTION
This PowerShell script installs Opera GX from Microsoft Store.
.EXAMPLE
PS> ./install-opera-gx
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Installing Opera GX, please wait..."
& winget install "Opera GX" --source msstore --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
"Opera GX installed successfully."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Installs Paint 3D
.DESCRIPTION
This PowerShell script installs Paint 3D from the Microsoft Store.
.EXAMPLE
PS> ./install-paint-3d
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Installing Paint 3D, please wait..."
& winget install "Paint 3D" --source msstore --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
"Paint 3D installed successfully."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Installs Microsoft Powertoys
.DESCRIPTION
This PowerShell script installs the Microsoft Powertoys.
.EXAMPLE
PS> ./install-power-toys
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Installing Microsoft Powertoys, please wait..."
& winget install Microsoft.Powertoys --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
"Microsoft Powertoys installed successfully."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

25
Scripts/install-rufus.ps1 Normal file
View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Installs Rufus
.DESCRIPTION
This PowerShell script installs Rufus from the Microsoft Store.
.EXAMPLE
PS> ./install-rufus
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Installing Rufus, please wait..."
& winget install "Rufus" --source msstore --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
"Rufus installed successfully."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

25
Scripts/install-skype.ps1 Normal file
View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Installs Skype
.DESCRIPTION
This PowerShell script installs Skype from the Microsoft Store.
.EXAMPLE
PS> ./install-skype
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Installing Skype, please wait..."
& winget install "Skype" --source msstore --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
"Skype installed successfully."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Installs Spotify
.DESCRIPTION
This PowerShell script installs Spotify from the Microsoft Store.
.EXAMPLE
PS> ./install-spotify
.LINK
https://github.com/fleschutz/talk2windows
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Installing Spotify, please wait..."
& winget install "Spotify - Music and Podcasts" --source msstore --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
"Spotify installed successfully."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Installs Thunderbird
.DESCRIPTION
This PowerShell script installs Mozilla Thunderbird.
.EXAMPLE
PS> ./install-thunderbird
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Installing Mozilla Thunderbird, please wait..."
& winget install --id Mozilla.Thunderbird --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
"Mozilla Thunderbird installed successfully."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Installs Twitter
.DESCRIPTION
This PowerShell script installs Twitter from the Microsoft Store.
.EXAMPLE
PS> ./install-twitter
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Installing Twitter, please wait..."
& winget install "Twitter" --source msstore --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
"Twitter installed successfully."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

View File

@ -1,628 +1,25 @@
<#PSScriptInfo
.VERSION 1.4.2
.GUID 539e5585-7a02-4dd6-b9a6-5dd288d0a5d0
.AUTHOR Microsoft
.COMPANYNAME Microsoft Corporation
.COPYRIGHT (c) Microsoft Corporation
.TAGS install vscode installer
.LICENSEURI https://github.com/PowerShell/vscode-powershell/blob/master/LICENSE.txt
.PROJECTURI https://github.com/PowerShell/vscode-powershell/blob/master/scripts/Install-VSCode.ps1
.ICONURI
.EXTERNALMODULEDEPENDENCIES
.REQUIREDSCRIPTS
.EXTERNALSCRIPTDEPENDENCIES
.RELEASENOTES
02/06/2021 - Fix an architecture check issue with non-English localizations.
--
01/04/2021 - Fix host for downloading VSCode.
--
07/10/2019 - Fix a version check when installing user-builds with Windows Powershell greater than 5.
--
30/08/2019 - Added functionality to install the "User Install" variant of Stable Edition.
--
07/11/2018 - Added support for PowerShell Core and macOS/Linux platforms.
--
15/08/2018 - Added functionality to install the new "User Install" variant of Insiders Edition.
--
21/03/2018 - Added functionality to install the VSCode context menus.
Also, VSCode is now always added to the search path.
--
20/03/2018 - Fix OS detection to prevent error
--
28/12/2017 - Added functionality to support 64-bit versions of VSCode
and support for installation of VSCode Insiders Edition.
--
Initial release.
#>
<# <#
.SYNOPSIS .SYNOPSIS
Installs Visual Studio Code, the PowerShell extension, and optionally Installs Visual Studio Code
a list of additional extensions.
.DESCRIPTION .DESCRIPTION
This script can be used to easily install Visual Studio Code and the This PowerShell script installs Visual Studio Code.
PowerShell extension on your machine. You may also specify additional
extensions to be installed using the -AdditionalExtensions parameter.
The -LaunchWhenDone parameter will cause VS Code to be launched as
soon as installation has completed.
Please contribute improvements to this script on GitHub!
https://github.com/PowerShell/vscode-powershell/blob/master/scripts/Install-VSCode.ps1
.PARAMETER Architecture
A validated string defining the bit version to download. Values can be either 64-bit or 32-bit.
If 64-bit is chosen and the OS Architecture does not match, then the 32-bit build will be
downloaded instead. If parameter is not used, then 64-bit is used as default.
.PARAMETER BuildEdition
A validated string defining which build edition or "stream" to download:
Stable or Insiders Edition (system install or user profile install).
If the parameter is not used, then stable is downloaded as default.
.PARAMETER AdditionalExtensions
An array of strings that are the fully-qualified names of extensions to be
installed in addition to the PowerShell extension. The fully qualified
name is formatted as "<publisher name>.<extension name>" and can be found
next to the extension's name in the details tab that appears when you
click an extension in the Extensions panel in Visual Studio Code.
.PARAMETER LaunchWhenDone
When present, causes Visual Studio Code to be launched as soon as installation
has finished.
.PARAMETER EnableContextMenus
When present, causes the installer to configure the Explorer context menus
.EXAMPLE .EXAMPLE
Install-VSCode.ps1 -Architecture 32-bit PS> ./install-visual-studio-code
.LINK
Installs Visual Studio Code (32-bit) and the powershell extension. https://github.com/fleschutz/PowerShell
.EXAMPLE
Install-VSCode.ps1 -LaunchWhenDone
Installs Visual Studio Code (64-bit) and the PowerShell extension and then launches
the editor after installation completes.
.EXAMPLE
Install-VSCode.ps1 -AdditionalExtensions 'eamodio.gitlens', 'vscodevim.vim'
Installs Visual Studio Code (64-bit), the PowerShell extension, and additional
extensions.
.EXAMPLE
Install-VSCode.ps1 -BuildEdition Insider-User -LaunchWhenDone
Installs Visual Studio Code Insiders Edition (64-bit) to the user profile and then launches the editor
after installation completes.
.NOTES .NOTES
This script is licensed under the MIT License: Author: Markus Fleschutz | License: CC0
Copyright (c) Microsoft Corporation.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
#> #>
[CmdletBinding(SupportsShouldProcess=$true)]
param(
[parameter()]
[ValidateSet('64-bit', '32-bit')]
[string]$Architecture = '64-bit',
[parameter()]
[ValidateSet('Stable-System', 'Stable-User', 'Insider-System', 'Insider-User')]
[string]$BuildEdition = "Stable-System",
[Parameter()]
[ValidateNotNull()]
[string[]]$AdditionalExtensions = @(),
[switch]$LaunchWhenDone,
[switch]$EnableContextMenus
)
# Taken from https://code.visualstudio.com/docs/setup/linux#_installation
$script:VSCodeYumRepoEntry = @"
[code]
name=Visual Studio Code
baseurl=https://packages.microsoft.com/yumrepos/vscode
enabled=1
gpgcheck=1
gpgkey=https://packages.microsoft.com/keys/microsoft.asc
"@
$script:VSCodeZypperRepoEntry = @"
[code]
name=Visual Studio Code
baseurl=https://packages.microsoft.com/yumrepos/vscode
enabled=1
type=rpm-md
gpgcheck=1
gpgkey=https://packages.microsoft.com/keys/microsoft.asc
"@
function Test-IsOsArchX64 {
if ($PSVersionTable.PSVersion.Major -lt 6) {
return (Get-CimInstance -ClassName Win32_OperatingSystem).OSArchitecture -match '64'
}
return [System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture -eq [System.Runtime.InteropServices.Architecture]::X64
}
function Get-AvailablePackageManager
{
if (Get-Command 'apt' -ErrorAction SilentlyContinue) {
return 'apt'
}
if (Get-Command 'dnf' -ErrorAction SilentlyContinue) {
return 'dnf'
}
if (Get-Command 'yum' -ErrorAction SilentlyContinue) {
return 'yum'
}
if (Get-Command 'zypper' -ErrorAction SilentlyContinue) {
return 'zypper'
}
}
function Get-CodePlatformInformation {
param(
[Parameter(Mandatory=$true)]
[ValidateSet('32-bit', '64-bit')]
[string]
$Bitness,
[Parameter(Mandatory=$true)]
[ValidateSet('Stable-System', 'Stable-User', 'Insider-System', 'Insider-User')]
[string]
$BuildEdition
)
if ($IsWindows -or $PSVersionTable.PSVersion.Major -lt 6) {
$os = 'Windows'
}
elseif ($IsLinux) {
$os = 'Linux'
}
elseif ($IsMacOS) {
$os = 'MacOS'
}
else {
throw 'Could not identify operating system'
}
if ($Bitness -ne '64-bit' -and $os -ne 'Windows') {
throw "Non-64-bit *nix systems are not supported"
}
if ($BuildEdition.EndsWith('User') -and $os -ne 'Windows') {
throw 'User builds are not available for non-Windows systems'
}
switch ($BuildEdition) {
'Stable-System' {
$appName = "Visual Studio Code ($Bitness)"
break
}
'Stable-User' {
$appName = "Visual Studio Code ($($Architecture) - User)"
break
}
'Insider-System' {
$appName = "Visual Studio Code - Insiders Edition ($Bitness)"
break
}
'Insider-User' {
$appName = "Visual Studio Code - Insiders Edition ($($Architecture) - User)"
break
}
}
switch ($os) {
'Linux' {
$pacMan = Get-AvailablePackageManager
switch ($pacMan) {
'apt' {
$platform = 'linux-deb-x64'
$ext = 'deb'
break
}
{ 'dnf','yum','zypper' -contains $_ } {
$platform = 'linux-rpm-x64'
$ext = 'rpm'
break
}
default {
$platform = 'linux-x64'
$ext = 'tar.gz'
break
}
}
if ($BuildEdition.StartsWith('Insider')) {
$exePath = '/usr/bin/code-insiders'
break
}
$exePath = '/usr/bin/code'
break
}
'MacOS' {
$platform = 'darwin'
$ext = 'zip'
if ($BuildEdition.StartsWith('Insider')) {
$exePath = '/usr/local/bin/code-insiders'
break
}
$exePath = '/usr/local/bin/code'
break
}
'Windows' {
$ext = 'exe'
switch ($Bitness) {
'32-bit' {
$platform = 'win32'
if (Test-IsOsArchX64) {
$installBase = ${env:ProgramFiles(x86)}
break
}
$installBase = ${env:ProgramFiles}
break
}
'64-bit' {
$installBase = ${env:ProgramFiles}
if (Test-IsOsArchX64) {
$platform = 'win32-x64'
break
}
Write-Warning '64-bit install requested on 32-bit system. Installing 32-bit VSCode'
$platform = 'win32'
break
}
}
switch ($BuildEdition) {
'Stable-System' {
$exePath = "$installBase\Microsoft VS Code\bin\code.cmd"
}
'Stable-User' {
$exePath = "${env:LocalAppData}\Programs\Microsoft VS Code\bin\code.cmd"
}
'Insider-System' {
$exePath = "$installBase\Microsoft VS Code Insiders\bin\code-insiders.cmd"
}
'Insider-User' {
$exePath = "${env:LocalAppData}\Programs\Microsoft VS Code Insiders\bin\code-insiders.cmd"
}
}
}
}
switch ($BuildEdition) {
'Stable-System' {
$channel = 'stable'
break
}
'Stable-User' {
$channel = 'stable'
$platform += '-user'
break
}
'Insider-System' {
$channel = 'insider'
break
}
'Insider-User' {
$channel = 'insider'
$platform += '-user'
break
}
}
$info = @{
AppName = $appName
ExePath = $exePath
Platform = $platform
Channel = $channel
FileUri = "https://update.code.visualstudio.com/latest/$platform/$channel"
Extension = $ext
}
if ($pacMan) {
$info['PackageManager'] = $pacMan
}
return $info
}
function Save-WithBitsTransfer {
param(
[Parameter(Mandatory=$true)]
[string]
$FileUri,
[Parameter(Mandatory=$true)]
[string]
$Destination,
[Parameter(Mandatory=$true)]
[string]
$AppName
)
Write-Host "`nDownloading latest $AppName..." -ForegroundColor Yellow
Remove-Item -Force $Destination -ErrorAction SilentlyContinue
$bitsDl = Start-BitsTransfer $FileUri -Destination $Destination -Asynchronous
while (($bitsDL.JobState -eq 'Transferring') -or ($bitsDL.JobState -eq 'Connecting')) {
Write-Progress -Activity "Downloading: $AppName" -Status "$([math]::round($bitsDl.BytesTransferred / 1mb))mb / $([math]::round($bitsDl.BytesTotal / 1mb))mb" -PercentComplete ($($bitsDl.BytesTransferred) / $($bitsDl.BytesTotal) * 100 )
}
switch ($bitsDl.JobState) {
'Transferred' {
Complete-BitsTransfer -BitsJob $bitsDl
break
}
'Error' {
throw 'Error downloading installation media.'
}
}
}
function Install-VSCodeFromTar {
param(
[Parameter(Mandatory=$true)]
[string]
$TarPath,
[Parameter()]
[switch]
$Insiders
)
$tarDir = Join-Path ([System.IO.Path]::GetTempPath()) 'VSCodeTar'
$destDir = '/opt/VSCode-linux-x64'
New-Item -ItemType Directory -Force -Path $tarDir
try {
Push-Location $tarDir
tar xf $TarPath
Move-Item -LiteralPath "$tarDir/VSCode-linux-x64" $destDir
}
finally {
Pop-Location
}
if ($Insiders) {
ln -s "$destDir/code-insiders" /usr/bin/code-insiders
return
}
ln -s "$destDir/code" /usr/bin/code
}
# We need to be running as elevated on *nix
if (($IsLinux -or $IsMacOS) -and (id -u) -ne 0) {
throw "Must be running as root to install VSCode.`nInvoke this script with (for example):`n`tsudo pwsh -f Install-VSCode.ps1 -BuildEdition Stable-System"
}
# User builds can only be installed on Windows systems
if ($BuildEdition.EndsWith('User') -and -not ($IsWindows -or $PSVersionTable.PSVersion.Major -lt 6)) {
throw 'User builds are not available for non-Windows systems'
}
try { try {
$prevProgressPreference = $ProgressPreference "Installing Visual Studio Code, please wait..."
$ProgressPreference = 'SilentlyContinue'
# Get information required for installation & winget install --id Microsoft.VisualStudioCode --accept-package-agreements --accept-source-agreements
$codePlatformInfo = Get-CodePlatformInformation -Bitness $Architecture -BuildEdition $BuildEdition if ($lastExitCode -ne "0") { throw "'winget install' failed" }
# Download the installer "Visual Studio Code installed successfully."
$tmpdir = [System.IO.Path]::GetTempPath() exit 0 # success
} catch {
$ext = $codePlatformInfo.Extension "Sorry: $($Error[0])"
$installerName = "vscode-install.$ext" exit 1
$installerPath = [System.IO.Path]::Combine($tmpdir, $installerName)
if ($PSVersionTable.PSVersion.Major -le 5) {
Save-WithBitsTransfer -FileUri $codePlatformInfo.FileUri -Destination $installerPath -AppName $codePlatformInfo.AppName
}
# We don't want to use RPM packages -- see the installation step below
elseif ($codePlatformInfo.Extension -ne 'rpm') {
if ($PSCmdlet.ShouldProcess($codePlatformInfo.FileUri, "Invoke-WebRequest -OutFile $installerPath")) {
Invoke-WebRequest -Uri $codePlatformInfo.FileUri -OutFile $installerPath
}
}
# Install VSCode
switch ($codePlatformInfo.Extension) {
# On Debian-like Linux distros
'deb' {
if (-not $PSCmdlet.ShouldProcess($installerPath, 'apt install -y')) {
break
}
# The deb file contains the information to install its own repository,
# so we just need to install it
apt install -y $installerPath
break
}
# On distros using rpm packages, the RPM package doesn't set up the repo.
# To install VSCode properly in way that the package manager tracks it,
# we have to do things the hard way - install the repo and install the package
'rpm' {
$pacMan = $codePlatformInfo.PackageManager
if (-not $PSCmdlet.ShouldProcess($installerPath, "$pacMan install -y")) {
break
}
# Install the VSCode repo with the package manager
rpm --import https://packages.microsoft.com/keys/microsoft.asc
switch ($pacMan) {
'zypper' {
$script:VSCodeZypperRepoEntry > /etc/zypp/repos.d/vscode.repo
zypper refresh -y
}
default {
$script:VSCodeYumRepoEntry > /etc/yum.repos.d/vscode.repo
& $pacMan check-update -y
}
}
switch ($BuildEdition) {
'Stable-System' {
& $pacMan install -y code
}
default {
& $pacMan install -y code-insiders
}
}
break
}
# On Windows
'exe' {
$exeArgs = '/verysilent /tasks=addtopath'
if ($EnableContextMenus) {
$exeArgs = '/verysilent /tasks=addcontextmenufiles,addcontextmenufolders,addtopath'
}
if (-not $PSCmdlet.ShouldProcess("$installerPath $exeArgs", 'Start-Process -Wait')) {
break
}
Start-Process -Wait $installerPath -ArgumentList $exeArgs
break
}
# On Mac
'zip' {
if (-not $PSCmdlet.ShouldProcess($installerPath, "Expand-Archive -DestinationPath $zipDirPath -Force; Move-Item $zipDirPath/*.app /Applications/")) {
break
}
$zipDirPath = [System.IO.Path]::Combine($tmpdir, 'VSCode')
Expand-Archive -LiteralPath $installerPath -DestinationPath $zipDirPath -Force
Move-Item "$zipDirPath/*.app" '/Applications/'
break
}
# Remaining Linux distros using tar - more complicated
'tar.gz' {
if (-not $PSCmdlet.ShouldProcess($installerPath, 'Install-VSCodeFromTar (expand, move to /opt/, symlink)')) {
break
}
Install-VSCodeFromTar -TarPath $installerPath -Insiders:($BuildEdition -ne 'Stable-System')
break
}
default {
throw "Unkown package type: $($codePlatformInfo.Extension)"
}
}
$codeExePath = $codePlatformInfo.ExePath
# Install any extensions
$extensions = @("ms-vscode.PowerShell") + $AdditionalExtensions
if ($PSCmdlet.ShouldProcess(($extensions -join ','), "$codeExePath --install-extension")) {
if ($IsLinux -or $IsMacOS) {
# On *nix we need to install extensions as the user -- VSCode refuses root
$extsSlashes = $extensions -join '/'
sudo -H -u $env:SUDO_USER pwsh -c "`$exts = '$extsSlashes' -split '/'; foreach (`$e in `$exts) { $codeExePath --install-extension `$e }"
}
else {
foreach ($extension in $extensions) {
Write-Host "`nInstalling extension $extension..." -ForegroundColor Yellow
& $codeExePath --install-extension $extension
}
}
}
# Launch if requested
if ($LaunchWhenDone) {
$appName = $codePlatformInfo.AppName
if (-not $PSCmdlet.ShouldProcess($appName, "Launch with $codeExePath")) {
return
}
Write-Host "`nInstallation complete, starting $appName...`n`n" -ForegroundColor Green
& $codeExePath
return
}
if ($PSCmdlet.ShouldProcess('Installation complete!', 'Write-Host')) {
Write-Host "`nInstallation complete!`n`n" -ForegroundColor Green
}
}
finally {
$ProgressPreference = $prevProgressPreference
} }

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Installs Vivaldi
.DESCRIPTION
This PowerShell script installs the Vivaldi browser.
.EXAMPLE
PS> ./install-vivaldi
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Installing Vivaldi, please wait..."
& winget install --id VivaldiTechnologies.Vivaldi --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
"Vivaldi installed successfully."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

25
Scripts/install-vlc.ps1 Normal file
View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Installs VLC
.DESCRIPTION
This PowerShell script installs the VLC media player.
.EXAMPLE
PS> ./install-vlc
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Installing VLC media player, please wait..."
& winget install --id VideoLAN.VLC --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
"VLC media player installed successfully."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Installs Windows Terminal
.DESCRIPTION
This PowerShell script installs Windows Terminal from the Microsoft Store.
.EXAMPLE
PS> ./install-windows-terminal
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Installing Windows Terminal, please wait..."
& winget install --id Microsoft.WindowsTerminal --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
"Windows Terminal installed successfully."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

25
Scripts/install-zoom.ps1 Normal file
View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Installs Zoom
.DESCRIPTION
This PowerShell script installs Zoom.
.EXAMPLE
PS> ./install-zoom
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Installing Zoom, please wait..."
& winget install --id Zoom.Zoom --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
"Zoom installed successfully."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Uninstalls CrystalDiskInfo
.DESCRIPTION
This PowerShell script uninstalls CrystalDiskInfo from the local computer.
.EXAMPLE
PS> ./uninstall-crystal-disk-info
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Uninstalling CrystalDiskInfo, please wait..."
& winget uninstall "CrystalDiskInfo"
if ($lastExitCode -ne "0") { throw "Can't uninstall CrystalDiskInfo, is it installed?" }
"CrystalDiskInfo is uninstalled now."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Uninstalls CrystalDiskMark
.DESCRIPTION
This PowerShell script uninstalls CrystalDiskMark from the local computer.
.EXAMPLE
PS> ./uninstall-crystal-disk-mark
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Uninstalling CrystalDiskMark, please wait..."
& winget uninstall "CrystalDiskMark Shizuku Edition"
if ($lastExitCode -ne "0") { throw "Can't uninstall CrystalDiskMark, is it installed?" }
"CrystalDiskMark is uninstalled now."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Uninstalls Discord
.DESCRIPTION
This PowerShell script uninstalls Discord from the local computer.
.EXAMPLE
PS> ./uninstall-discord
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Uninstalling Discord, please wait..."
& winget uninstall "Discord"
if ($lastExitCode -ne "0") { throw "Can't uninstall Discord, is it installed?" }
"Discord is uninstalled now."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Uninstalls Microsoft Edge
.DESCRIPTION
This PowerShell script uninstalls Microsoft Edge from the local computer.
.EXAMPLE
PS> ./uninstall-edge
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Uninstalling Microsoft Edge, please wait..."
& winget uninstall "Microsoft Edge Browser"
if ($lastExitCode -ne "0") { throw "Can't uninstall Edge, is it installed?" }
"Microsoft Edge is uninstalled now."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Uninstalls Mozilla Firefox
.DESCRIPTION
This PowerShell script uninstalls Mozilla Firefox from the local computer.
.EXAMPLE
PS> ./uninstall-firefox
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Uninstalling Mozilla Firefox, please wait..."
& winget uninstall "Mozilla Firefox"
if ($lastExitCode -ne "0") { throw "Can't uninstall Firefox, is it installed?" }
"Mozilla Firefox is uninstalled now."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Uninstalls Git Extensions
.DESCRIPTION
This PowerShell script uninstalls Git Extensions from the local computer.
.EXAMPLE
PS> ./uninstall-git-extensions
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Uninstalling Git Extensions, please wait..."
& winget uninstall --id GitExtensionsTeam.GitExtensions
if ($lastExitCode -ne "0") { throw "Can't uninstall Git Extensions, is it installed?" }
"Git Extensions is uninstalled now."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Uninstalls IrfanView
.DESCRIPTION
This PowerShell script uninstalls IrfanView from the local computer.
.EXAMPLE
PS> ./uninstall-irfanview
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Uninstalling IrfanView, please wait..."
& winget uninstall "IrfanView64"
if ($lastExitCode -ne "0") { throw "Can't uninstall IrfanView, is it installed?" }
"IrfanView is uninstalled now."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Uninstalls Microsoft Teams
.DESCRIPTION
This PowerShell script uninstalls Microsoft Teams from the local computer.
.EXAMPLE
PS> ./uninstall-microsoft-teams
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Uninstalling Microsoft Teams, please wait..."
& winget uninstall --id Microsoft.Teams
if ($lastExitCode -ne "0") { throw "Can't uninstall Microsoft Teams, is it installed?" }
"Microsoft Teams is uninstalled now."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Uninstalls Netflix
.DESCRIPTION
This PowerShell script uninstalls Netflix from the local computer.
.EXAMPLE
PS> ./uninstall-netflix
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Uninstalling Netflix, please wait..."
& winget uninstall "Netflix"
if ($lastExitCode -ne "0") { throw "Can't uninstall Netflix, is it installed?" }
"Netflix is uninstalled now."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Uninstalls 9 ZIP
.DESCRIPTION
This PowerShell script uninstalls 9 ZIP from the local computer.
.EXAMPLE
PS> ./uninstall-nine-zip
.NOTES
Author: Markus Fleschutz / License: CC0
.LINK
https://github.com/fleschutz/talk2windows
#>
try {
& "$PSScriptRoot/_reply.ps1" "Uninstalling 9 ZIP, please wait..."
& winget uninstall "9 ZIP - open rar, zip, 7zip, gzip"
if ($lastExitCode -ne "0") { throw "Can't uninstall 9 ZIP, is it installed?" }
& "$PSScriptRoot/_reply.ps1" "9 ZIP is uninstalled now."
exit 0 # success
} catch {
& "$PSScriptRoot/_reply.ps1" "Sorry: $($Error[0])"
exit 1
}

View File

@ -0,0 +1,25 @@
c<#
.SYNOPSIS
Uninstalls One Calendar
.DESCRIPTION
This PowerShell script uninstalls One Calendar from the local computer.
.EXAMPLE
PS> ./uninstall-one-calendar
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Uninstalling One Calendar, please wait..."
& winget uninstall "One Calendar"
if ($lastExitCode -ne "0") { throw "Can't uninstall One Calendar, is it installed?" }
"One Calendar is uninstalled now."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Uninstalls Opera Browser
.DESCRIPTION
This PowerShell script uninstalls Opera Browser from the local computer.
.EXAMPLE
PS> ./uninstall-opera-browser
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Uninstalling Opera Browser, please wait..."
& winget uninstall "Opera Browser"
if ($lastExitCode -ne "0") { throw "Can't uninstall Opera Browser, is it installed?" }
"Opera Browser is uninstalled now."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Uninstalls Opera GX
.DESCRIPTION
This PowerShell script uninstalls Opera GX from the local computer.
.EXAMPLE
PS> ./uninstall-opera-gx
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz / License: CC0
#>
try {
"Uninstalling Opera GX, please wait..."
& winget uninstall "Opera GX"
if ($lastExitCode -ne "0") { throw "Can't uninstall Opera Browser, is it installed?" }
"Opera GX is uninstalled now."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Uninstalls Paint 3D
.DESCRIPTION
This PowerShell script uninstalls Paint 3D from the local computer.
.EXAMPLE
PS> ./uninstall-paint-3d
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz / License: CC0
#>
try {
"Uninstalling Paint 3D, please wait..."
& winget uninstall "Paint 3D"
if ($lastExitCode -ne "0") { throw "Can't uninstall Paint 3D, is it installed?" }
"Paint 3D is uninstalled now."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Uninstalls Rufus
.DESCRIPTION
This PowerShell script uninstalls Rufus from the local computer.
.EXAMPLE
PS> ./uninstall-rufus
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Uninstalling Rufus, please wait..."
& winget uninstall "Rufus"
if ($lastExitCode -ne "0") { throw "Can't uninstall Rufus, is it installed?" }
"Rufus is uninstalled now."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Uninstalls Skype
.DESCRIPTION
This PowerShell script uninstalls Skype from the local computer.
.EXAMPLE
PS> ./uninstall-skype
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz / License: CC0
#>
try {
"Uninstalling Skype, please wait..."
& winget uninstall "Skype"
if ($lastExitCode -ne "0") { throw "Can't uninstall Skype, is it installed?" }
"Skype is uninstalled now."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Uninstalls Spotify
.DESCRIPTION
This PowerShell script uninstalls Spotify from the local computer.
.EXAMPLE
PS> ./uninstall-spotify
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Uninstalling Spotify, please wait..."
& winget uninstall "Spotify - Music and Podcasts"
if ($lastExitCode -ne "0") { throw "Can't uninstall Spotify, is it installed?" }
"Spotify is uninstalled now."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Uninstalls Twitter
.DESCRIPTION
This PowerShell script uninstalls Twitter from the local computer.
.EXAMPLE
PS> ./uninstall-twitter
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Uninstalling Twitter, please wait..."
& winget uninstall "Twitter"
if ($lastExitCode -ne "0") { throw "Can't uninstall Twitter, is it installed?" }
"Twitter is uninstalled now."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Uninstalls Visual Studio Code
.DESCRIPTION
This PowerShell script uninstalls Visual Studio Code from the local computer.
.EXAMPLE
PS> ./uninstall-visual-studio-code
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Uninstalling Visual Studio Code, please wait..."
& winget uninstall "Visual Studio Code"
if ($lastExitCode -ne "0") { throw "Can't uninstall Visual Studio Code, is it installed?" }
"Visual Studio Code is uninstalled now."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

25
Scripts/uninstall-vlc.ps1 Normal file
View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Uninstalls VLC
.DESCRIPTION
This PowerShell script uninstalls the VLC media player from the local computer.
.EXAMPLE
PS> ./uninstall-vlc
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Uninstalling VLC media player, please wait..."
& winget uninstall "VLC"
if ($lastExitCode -ne "0") { throw "Can't uninstall VLC media player, is it installed?" }
"VLC media player is uninstalled now."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Uninstalls Windows Terminal
.DESCRIPTION
This PowerShell script uninstalls Windows Terminal from the local computer.
.EXAMPLE
PS> ./uninstall-windows-terminal
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
"Uninstalling Windows Terminal, please wait..."
& winget uninstall --id Microsoft.WindowsTerminal
if ($lastExitCode -ne "0") { throw "Can't uninstall Windows Terminal, is it installed?" }
"Windows Terminal is uninstalled now."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
}