Fixing Isssues with install apps

This commit is contained in:
2023-11-13 11:45:44 +01:00
parent abf0a5913f
commit 48091d5596
4 changed files with 38 additions and 64 deletions

View File

@@ -9,7 +9,7 @@ function Import-ScriptsFromUrls {
foreach ($url in $ScriptUrls) {
$fileName = Split-Path -Leaf $url
$localFile = Join-Path -Path $LocalPath -ChildPath $fileName
Write-Host "Downloading script from $url to $localFile"
Write-Host "Downloading script $fileName to $localFile"
Invoke-WebRequest -Uri $url -OutFile $localFile -UseBasicParsing
Write-Host "Importing script from $localFile"
$scripts += $localFile
@@ -54,42 +54,31 @@ function Setup {
}
function Custom {
# ask user if they need to download files
$input = Read-Host "Do you need to download files? (y/n)"
if ($input -eq "y") {
$DownloadFiles = @()
do {
$input = Read-Host "Enter the URL of the file you want to download (leave empty to stop)"
if ($input -ne "") {
$DownloadFiles += $input
}
} while ($input -ne "")
}
# ask user if they need to install office
$input = Read-Host "Do you need to install Office? (y/n)"
if ($input -eq "y") {
$Office = $true
}
# ask user if they need to setup users
$input = Read-Host "Do you need to setup users? (y/n)"
if ($input -eq "y") {
$Users = $true
# ask user if they need to setup eleve registry
$input = Read-Host "Do you need to setup eleve registry? (y/n)"
if ($input -eq "y") {
$EleveReg = $true
}
}
# ask user if they need to enable RDP
$input = Read-Host "Do you need to enable RDP? (y/n)"
if ($input -eq "y") {
$RDP = $true
}
# ask user if they need to install chocolatey
$input = Read-Host "Do you need to install chocolatey? (y/n)"
if ($input -eq "y") {
$Choco = $true
# ask user if they need to install chocolatey apps
$input = Read-Host "Do you need to install chocolatey apps? (y/n)"
if ($input -eq "y") {
$ChocoApps = @()
@@ -101,41 +90,25 @@ function Custom {
} while ($input -ne "")
}
}
# ask user if they need to install apps
$input = Read-Host "Do you need to install apps? (y/n)"
if ($input -eq "y") {
$Apps = @()
do {
$input = Read-Host "Enter the name of the app you want to install (leave empty to stop)"
if ($input -ne "") {
$Apps += $input
}
} while ($input -ne "")
}
# ask user if they need to update windows
$input = Read-Host "Do you need to update windows? (y/n)"
if ($input -eq "y") {
$Update = $true
}
SetupCustom -DownloadFiles $DownloadFiles -Office $Office -Users $Users -EleveReg $EleveReg -RDP $RDP -Choco $Choco -ChocoApps $ChocoApps -Apps $Apps -Update $Update
SetupCustom -Office $Office -Users $Users -EleveReg $EleveReg -RDP $RDP -Choco $Choco -ChocoApps $ChocoApps -Update $Update
}
function SetupCustom {
param (
[array] $DownloadFiles,
[bool] $Office,
[bool] $Users,
[bool] $EleveReg,
[bool] $RDP,
[bool] $Choco,
[array] $ChocoApps,
[array] $Apps,
[bool] $Update
)
Write-Host "Performing Custom Installation..."
if ($DownloadFiles) {
DownloadFiles -Type "Custom" -Files $DownloadFiles
}
if ($Office) {
CheckOfficeInstall
}
@@ -154,9 +127,6 @@ function SetupCustom {
ChocoInstallApps -Type "Custom" -Apps $ChocoApps
}
}
if ($Apps) {
InstallApps -Type "Custom" -Apps $Apps
}
if ($Update) {
UpdateWindows
}