attempting to update and make it more intuitive
parent
cd36de0e97
commit
43d7d70aff
161
Script.ps1
161
Script.ps1
|
|
@ -1,3 +1,66 @@
|
|||
function Show-Menu {
|
||||
param (
|
||||
[string]$Title = "My PowerShell Menu"
|
||||
)
|
||||
|
||||
Clear-Host
|
||||
|
||||
# ASCII Art Title
|
||||
Write-Host @"
|
||||
|
||||
_____ _ __ _______ _ _
|
||||
/ ____| | \ \ / /_ _| \ | |
|
||||
| | | |__ _ __ ___ _ __ ___ __ \ \ /\ / / | | | \| |
|
||||
| | | '_ \| '__/ _ \| '_ ` _ \ / _` \ \/ \/ / | | | . ` |
|
||||
| |____| | | | | | (_) | | | | | | (_| |\ /\ / _| |_| |\ |
|
||||
\_____|_| |_|_| \___/|_| |_| |_|\__,_| \/ \/ |_____|_| \_|
|
||||
|
||||
|
||||
"@ -ForegroundColor Cyan
|
||||
|
||||
# Brief description
|
||||
Write-Host "`nEasy and clean OOBE setup. For Chroma domain use ONLY." -ForegroundColor Yellow
|
||||
Write-Host "`nPLEASE READ THE FULL DESCRIPTION. I AM NOT RESPONSIBLE FOR ANY DAMAGE TO YOUR SYSTEM! YOU HAVE BEEN WARNED!" -ForegroundColor Yellow
|
||||
|
||||
# Longer explanation
|
||||
Write-Host @"
|
||||
|
||||
1: Run the full script.
|
||||
Will configure the following:
|
||||
- Allow ICMP Echo Requests inbound
|
||||
- Enable Dark Mode
|
||||
- Disable Mouse Acceleration
|
||||
- Allow Remote Desktop
|
||||
- Enable c$ directory viewing
|
||||
- Disable UAC prompt
|
||||
- Disable sleep, enable hibernation, and display black after 30 minutes
|
||||
- Enable high performance mode
|
||||
|
||||
Will install the following:
|
||||
- RMM software
|
||||
- Winget
|
||||
- OpenSSH
|
||||
2: Will display System Information
|
||||
3: Just activate Windows.
|
||||
4: Exit.
|
||||
|
||||
"@ -ForegroundColor White
|
||||
|
||||
# Draw a line
|
||||
Write-Host "`n----------------------------------------" -ForegroundColor DarkGray
|
||||
|
||||
# Menu options
|
||||
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 "`n----------------------------------------" -ForegroundColor DarkGray
|
||||
}
|
||||
|
||||
function Run-Full-Script {
|
||||
Write-Host "Running full script..." -ForegroundColor Green
|
||||
# Check if running with elevated privileges
|
||||
if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
|
||||
Write-Host "Please run this script as an administrator."
|
||||
|
|
@ -18,8 +81,27 @@ Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server'
|
|||
Enable-NetFirewallRule -DisplayGroup "Remote Desktop"
|
||||
|
||||
# Enable c$
|
||||
reg add "HKLM\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters" /f /v AutoShareWks /t REG_DWORD /d 0
|
||||
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "LocalAccountTokenFilterPolicy" /t REG_DWORD /d 1 /f
|
||||
Write-Host "Enabling Administrative Shares..." -ForegroundColor Green
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "LocalAccountTokenFilterPolicy" -Value 1 -Type DWord -Force
|
||||
Write-Host "Configuring Windows Firewall..." -ForegroundColor Green
|
||||
Enable-NetFirewallRule -DisplayGroup "File and Printer Sharing"
|
||||
Enable-NetFirewallRule -DisplayGroup "Windows Management Instrumentation (WMI)"
|
||||
Write-Host "Enabling SMB File Sharing..." -ForegroundColor Green
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "SMB1Protocol" -NoRestart
|
||||
Write-Host "Restarting the Server service..." -ForegroundColor Green
|
||||
Restart-Service -Name "LanmanServer" -Force
|
||||
Write-Host "Enabling Network Discovery..." -ForegroundColor Green
|
||||
netsh advfirewall firewall set rule group="Network Discovery" new enable=Yes
|
||||
Write-Host "Verifying C$ administrative share..." -ForegroundColor Green
|
||||
$shares = Get-WmiObject -Class Win32_Share
|
||||
if ($shares | Where-Object { $_.Name -eq "C$" }) {
|
||||
Write-Host "The C$ administrative share is enabled!" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "Creating C$ administrative share..." -ForegroundColor Yellow
|
||||
$computer = [wmiclass]"Win32_Share"
|
||||
$computer.Create("C:\", "C$", 0)
|
||||
}
|
||||
|
||||
|
||||
# Disable UAC prompt
|
||||
Set-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows\CurrentVersion\policies\system' -Name "ConsentPromptBehaviorAdmin" -Value 0
|
||||
|
|
@ -29,12 +111,6 @@ $DownloadPath = "$env:TEMP\app.exe"
|
|||
Invoke-WebRequest -Uri "https://rmm.iamchrisama.com/meshagents?id=4&meshid=zxl@U2zM95zh9ZNqah@9mUEjCJ3ptGOE6s5cjsGniacVU1fjRXtVKCKlKJN4aJQW&installflags=0" -OutFile $DownloadPath
|
||||
Start-Process -FilePath $DownloadPath -Wait
|
||||
|
||||
# Download and install ScreenConnect client
|
||||
$ScreenConnectUrl = "https://iamchrisama.screenconnect.com/Bin/ScreenConnect.ClientSetup.exe?e=Access&y=Guest"
|
||||
$ScreenConnectPath = "$env:TEMP\ScreenConnect.ClientSetup.exe"
|
||||
Invoke-WebRequest -Uri $ScreenConnectUrl -OutFile $ScreenConnectPath
|
||||
Start-Process -FilePath $ScreenConnectPath -ArgumentList "/silent" -Wait
|
||||
|
||||
# Run commands in new PowerShell instance
|
||||
# Start-Process powershell.exe -ArgumentList "-NoProfile -Command {irm https://massgrave.dev/get | iex}"
|
||||
# Start-Process powershell.exe -ArgumentList "-NoProfile -Command {irm https://christitus.com/win | iex}"
|
||||
|
|
@ -64,3 +140,72 @@ if (!(Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyCon
|
|||
} else {
|
||||
Write-Output "Firewall rule 'OpenSSH-Server-In-TCP' has been created and exists."
|
||||
}
|
||||
}
|
||||
|
||||
function Get-SystemInformation {
|
||||
Write-Host "`nGathering system information..." -ForegroundColor Yellow
|
||||
|
||||
$computerInfo = Get-ComputerInfo
|
||||
Write-Host "`nSystem Information:" -ForegroundColor Green
|
||||
Write-Host "OS: $($computerInfo.OsName) $($computerInfo.OsVersion)" -ForegroundColor White
|
||||
Write-Host "Computer Name: $($computerInfo.CsName)" -ForegroundColor White
|
||||
Write-Host "Manufacturer: $($computerInfo.CsManufacturer)" -ForegroundColor White
|
||||
Write-Host "Model: $($computerInfo.CsModel)" -ForegroundColor White
|
||||
Write-Host "Processor: $($computerInfo.CsProcessors.Name)" -ForegroundColor White
|
||||
Write-Host "Memory: $([math]::Round($computerInfo.CsTotalPhysicalMemory / 1GB, 2)) GB" -ForegroundColor White
|
||||
|
||||
Write-Host "`nPress any key to return to the menu..." -ForegroundColor Gray
|
||||
$null = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
|
||||
}
|
||||
|
||||
function Activate-Windows {
|
||||
# Set up error handling
|
||||
$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/"
|
||||
|
||||
# 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 secondary script..." -ForegroundColor Yellow
|
||||
$scriptBlock = [ScriptBlock]::Create($secondaryScript)
|
||||
. $scriptBlock
|
||||
|
||||
}
|
||||
catch {
|
||||
Write-Host "Error in primary script: $_" -ForegroundColor Red
|
||||
Write-Host "Stack trace: $($_.ScriptStackTrace)" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Main menu loop
|
||||
do {
|
||||
Show-Menu
|
||||
$selection = Read-Host "`nPlease make a selection"
|
||||
|
||||
switch ($selection) {
|
||||
'1' {
|
||||
Run-Script
|
||||
}
|
||||
'2' {
|
||||
Get-SystemInformation
|
||||
}
|
||||
'3' {
|
||||
Activate-Windows
|
||||
}
|
||||
'4' {
|
||||
return
|
||||
}
|
||||
default {
|
||||
Write-Host "`nInvalid selection. Please try again." -ForegroundColor Red
|
||||
Start-Sleep -Seconds 2
|
||||
}
|
||||
}
|
||||
} until ($selection -eq '4')
|
||||
|
|
|
|||
Loading…
Reference in New Issue