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