minor changes
parent
43d7d70aff
commit
b3dbbbe04d
37
Script.ps1
37
Script.ps1
|
|
@ -1,6 +1,6 @@
|
|||
function Show-Menu {
|
||||
param (
|
||||
[string]$Title = "My PowerShell Menu"
|
||||
[string]$Title = "ChromaWIN - OOBE and Apps Setup"
|
||||
)
|
||||
|
||||
Clear-Host
|
||||
|
|
@ -42,7 +42,7 @@ function Show-Menu {
|
|||
- OpenSSH
|
||||
2: Will display System Information
|
||||
3: Just activate Windows.
|
||||
4: Exit.
|
||||
4. Just install apps.
|
||||
|
||||
"@ -ForegroundColor White
|
||||
|
||||
|
|
@ -53,8 +53,9 @@ function Show-Menu {
|
|||
Write-Host "`nAvailable Options:" -ForegroundColor Green
|
||||
Write-Host "1: Full Setup" -ForegroundColor White
|
||||
Write-Host "2: Check System Information" -ForegroundColor White
|
||||
Write-Host "3: Clean Temporary Files" -ForegroundColor White
|
||||
Write-Host "4: Exit" -ForegroundColor White
|
||||
Write-Host "3: Activate Windows" -ForegroundColor White
|
||||
Write-Host "4: Install Apps" -ForegroundColor White
|
||||
Write-Host "5: Exit" -ForegroundColor White
|
||||
|
||||
Write-Host "`n----------------------------------------" -ForegroundColor DarkGray
|
||||
}
|
||||
|
|
@ -163,8 +164,6 @@ function Activate-Windows {
|
|||
$ErrorActionPreference = "Stop"
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
|
||||
Write-Host "Starting primary script execution..." -ForegroundColor Cyan
|
||||
|
||||
try {
|
||||
# Download the secondary script
|
||||
$secondaryScriptUrl = "https://get.activated.win/"
|
||||
|
|
@ -174,7 +173,6 @@ try {
|
|||
|
||||
# Important: Execute the script in the current scope to preserve variables and functions
|
||||
# This allows the secondary script's IRM calls to work properly
|
||||
Write-Host "Executing secondary script..." -ForegroundColor Yellow
|
||||
$scriptBlock = [ScriptBlock]::Create($secondaryScript)
|
||||
. $scriptBlock
|
||||
|
||||
|
|
@ -185,6 +183,31 @@ catch {
|
|||
exit 1
|
||||
}
|
||||
|
||||
function Install-Apps {
|
||||
# Set up error handling
|
||||
$ErrorActionPreference = "Stop"
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
|
||||
try {
|
||||
# Download the secondary script
|
||||
$secondaryScriptUrl = "https://christitus.com/win"
|
||||
|
||||
# Download the script content
|
||||
$secondaryScript = Invoke-RestMethod -Uri $secondaryScriptUrl -Method Get
|
||||
|
||||
# Important: Execute the script in the current scope to preserve variables and functions
|
||||
# This allows the secondary script's IRM calls to work properly
|
||||
Write-Host "Executing script..." -ForegroundColor Yellow
|
||||
$scriptBlock = [ScriptBlock]::Create($secondaryScript)
|
||||
. $scriptBlock
|
||||
|
||||
}
|
||||
catch {
|
||||
Write-Host "Error in script: $_" -ForegroundColor Red
|
||||
Write-Host "Stack trace: $($_.ScriptStackTrace)" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Main menu loop
|
||||
do {
|
||||
Show-Menu
|
||||
|
|
|
|||
Loading…
Reference in New Issue