Created
February 20, 2023 18:17
-
-
Save cgorshing/80c718c159fdd748178bbcd8b4101ded to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add-Type -AssemblyName System.Windows.Forms | |
[System.Windows.Forms.Application]::EnableVisualStyles() | |
$ErrorActionPreference = 'SilentlyContinue' | |
$wshell = New-Object -ComObject Wscript.Shell | |
$Button = [System.Windows.MessageBoxButton]::YesNoCancel | |
$ErrorIco = [System.Windows.MessageBoxImage]::Error | |
If (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]'Administrator')) { | |
Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs | |
Exit | |
} | |
# GUI Specs | |
Write-Host "Checking winget..." | |
# Check if winget is installed | |
if (Test-Path ~\AppData\Local\Microsoft\WindowsApps\winget.exe) { | |
'Winget Already Installed' | |
} | |
else { | |
# Installing winget from the Microsoft Store | |
Write-Host "Winget not found, installing it now." | |
$ResultText.text = "`r`n" +"`r`n" + "Installing Winget... Please Wait" | |
Start-Process "ms-appinstaller:?source=https://aka.ms/getwinget" | |
$nid = (Get-Process AppInstaller).Id | |
Wait-Process -Id $nid | |
Write-Host Winget Installed | |
$ResultText.text = "`r`n" +"`r`n" + "Winget Installed - Ready for Next Task" | |
} | |
Write-Host "Script has been updated, launching video and new github project." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment