112 lines
2.7 KiB
PowerShell
112 lines
2.7 KiB
PowerShell
# Check if the script is running as administrator
|
|
If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
|
|
# If not running as administrator, attempt to restart with elevation
|
|
Write-Host "This script needs to run with Administrator privileges. Please Run again"
|
|
Exit
|
|
}
|
|
|
|
function Install-Updates {
|
|
Install-Module PSWindowsUpdate
|
|
Import-Module PSWindowsUpdate
|
|
Get-WindowsUpdate
|
|
Install-WindowsUpdate
|
|
}
|
|
|
|
function Install-ScreenBox {
|
|
Write-Host "Installing ScreenBox"
|
|
winget install 9NTSNMSVCB5L
|
|
}
|
|
|
|
function Install-Qview {
|
|
Write-Host "Installing qView"
|
|
winget install jurplel.qView
|
|
}
|
|
|
|
function Install-OnlyOffice {
|
|
Write-Host "Installing OnlyOffice"
|
|
winget install ONLYOFFICE.DesktopEditors
|
|
}
|
|
|
|
function Install-Thunderbird {
|
|
Write-Host "Installing Thunderbird"
|
|
winget install Mozilla.Thunderbird
|
|
}
|
|
|
|
function Install-Software {
|
|
Install-ScreenBox
|
|
Install-Qview
|
|
Install-OnlyOffice
|
|
Install-Thunderbird
|
|
}
|
|
|
|
function Install-Software-NoOffice {
|
|
Install-ScreenBox
|
|
Install-Qview
|
|
}
|
|
|
|
function Show-InteractiveMenu {
|
|
param (
|
|
[string]$Title = "Main Menu",
|
|
[array]$Options
|
|
)
|
|
|
|
Clear-Host
|
|
Write-Host "================ $Title ================"
|
|
|
|
for ($i = 0; $i -lt $Options.Count; $i++) {
|
|
Write-Host "$($i + 1): $($Options[$i])"
|
|
}
|
|
Write-Host "Q: Quit"
|
|
Write-Host "========================================"
|
|
}
|
|
|
|
$menuOptions = @(
|
|
"Run All",
|
|
"Run All (No OnlyOffice or Thunderbird)"
|
|
"Windows Updates",
|
|
"Install Software",
|
|
"Install Software (No OnlyOffice or Thunderbird)"
|
|
)
|
|
|
|
do {
|
|
Show-InteractiveMenu -Title "Onboarding Script" -Options $menuOptions
|
|
$choice = Read-Host "Enter your choice (1- $($menuOptions.Count), or Q to quit)"
|
|
|
|
switch ($choice) {
|
|
"1" {
|
|
Install-Updates
|
|
Install-Software
|
|
Write-Head "All Done!"
|
|
Pause
|
|
}
|
|
"2" {
|
|
Install-Updates
|
|
Install-Software-NoOffice
|
|
Pause
|
|
}
|
|
"3" {
|
|
Install-Updates
|
|
Pause
|
|
}
|
|
"4" {
|
|
Install-Software
|
|
Pause
|
|
}
|
|
"5" {
|
|
Install-Software-NoOffice
|
|
Pause
|
|
}
|
|
"q" {
|
|
Write-Host "Exiting menu."
|
|
break
|
|
}
|
|
"Q" {
|
|
Write-Host "Exiting menu."
|
|
break
|
|
}
|
|
default {
|
|
Write-Host "Invalid choice. Please try again." -ForegroundColor Red
|
|
Pause
|
|
}
|
|
}
|
|
} while ($choice -ne "q" -and $choice -ne "Q") |