From 3d63bf6a68b2150e15d3adeda801c66d56102dd6 Mon Sep 17 00:00:00 2001 From: Lightemerald Date: Mon, 29 Jan 2024 11:05:49 +0100 Subject: [PATCH] Renaming function and improving outputs --- setupChoco.ps1 | 2 +- setupScript.ps1 | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/setupChoco.ps1 b/setupChoco.ps1 index 9ec318d..738ccc3 100644 --- a/setupChoco.ps1 +++ b/setupChoco.ps1 @@ -2,7 +2,7 @@ function InstallChoco { Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) } -function ChocoInstallApps { +function InstallChocoApps { param ( [string] $Type, [array] $Apps diff --git a/setupScript.ps1 b/setupScript.ps1 index a15d62b..da35b25 100644 --- a/setupScript.ps1 +++ b/setupScript.ps1 @@ -50,13 +50,12 @@ function StandardSetup { SetupUserReg -username "Eleve" SetupRDP -enable 1 InstallChoco - ChocoInstallApps -Type $Type + InstallChocoApps -Type $Type InstallApps -Type $Type UpdateWindows Show-WDACMenu Write-Host "Installation complete!" - Write-Host "Would you like to restart now? (y/n)" - $input = Read-Host + $input = Read-Host "Would you like to restart now? (y/N)" if ($input -eq "y") { Clear-RecycleBin -Force Restart-Computer -Force @@ -150,13 +149,14 @@ function SetupCustom { if ($RDP) { SetupRDP -enable 1 } if ($Choco) { InstallChoco - if ($ChocoApps) { ChocoInstallApps -Type "Custom" -Apps $ChocoApps } + if ($ChocoApps) { InstallChocoApps -Type "Custom" -Apps $ChocoApps } } if ($Update) { UpdateWindows } if ($WDAC) { SetupWDAC -enable $WDAC } + Write-Host "Installation complete!" $input = Read-Host "Would you like to restart now? (y/N)" if ($input -eq "y") { - Clear-RecycleBin + Clear-RecycleBin -Force Restart-Computer -Force } } @@ -189,10 +189,9 @@ function Show-InstallationMenu { } if (Test-Path -Path "C:\Windows\System32\CodeIntegrity\CiPolicies\Active\{b4d6b24c-c3ad-44e5-9dea-72c1ed9577b8}.cip") { - Write-Host "WDAC is enabled, should we disabled it? (y/n)" - Write-Host "Not disabling WDAC will prevent the script from running properly. You should enable it again after the script is done." - $input = Read-Host - if ($input -eq "y") { + Write-Host "WDAC is enabled, not disabling WDAC will prevent the script from running properly. You should enable it again after the script is done." + $input = Read-Host "Should we disabled WDAC? (Y/n)" + if ($input -ne "n") { Remove-Item -Path "C:\Windows\System32\CodeIntegrity\CiPolicies\Active\{b4d6b24c-c3ad-44e5-9dea-72c1ed9577b8}.cip" } }