63 lines
3.2 KiB
PowerShell
63 lines
3.2 KiB
PowerShell
# 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."
|
|
Exit
|
|
}
|
|
|
|
# Enable ping (ICMP Echo) requests
|
|
New-NetFirewallRule -DisplayName "Allow ICMP Echo Request" -Protocol ICMPv4 -IcmpType 8 -Enabled True
|
|
|
|
# Turn on Dark Mode
|
|
New-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme -Value 0 -PropertyType DWORD -Force
|
|
|
|
# Disable Mouse Acceleration
|
|
Set-ItemProperty -Path "HKCU:\Control Panel\Mouse" -Name MouseSensitivity -Value 0
|
|
|
|
# Allow Remote Desktop
|
|
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -Name "fDenyTSConnections" -Value 0
|
|
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
|
|
|
|
# Disable UAC prompt
|
|
Set-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows\CurrentVersion\policies\system' -Name "ConsentPromptBehaviorAdmin" -Value 0
|
|
|
|
# Download and run application
|
|
$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}"
|
|
|
|
# Disable sleep and enable high performance mode, enable hibernation, and display black after 30 minutes
|
|
powercfg -change -standby-timeout-ac 0
|
|
powercfg -setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
|
|
powercfg /hibernate on
|
|
powercfg -change -monitor-timeout-ac 30
|
|
|
|
# Install OpenSSH
|
|
Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*'
|
|
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
|
|
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
|
|
|
|
Start-Service sshd
|
|
|
|
Set-Service -Name sshd -StartupType 'Automatic'
|
|
|
|
if (!(Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue | Select-Object Name, Enabled)) {
|
|
Write-Output "Firewall Rule 'OpenSSH-Server-In-TCP' does not exist, creating it..."
|
|
New-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
|
|
} else {
|
|
Write-Output "Firewall rule 'OpenSSH-Server-In-TCP' has been created and exists."
|
|
}
|