windows-oobe-scripts/Script.ps1

69 lines
3.1 KiB
PowerShell

# Turn on Dark Mode
New-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme -Value 0 -PropertyType DWORD -Force
# Disable Mouss 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$
$rootShare = Get-WmiObject -Class Win32_Share | Where-Object { $_.Name -eq "C$" }
$rootAcl = $rootShare.GetAccessControl().Access
# Specify the username to grant access
$username = "cdnutter"
# Check if the user already has access
$userHasAccess = $rootAcl | Where-Object { $_.Trustee.Name -eq $username }
if ($userHasAccess) {
Write-Output "The user $username already has access to the root C$ share."
} else {
# Get the SecurityIdentifier (SID) for the username
$sid = (New-Object System.Security.Principal.NTAccount($username)).Translate([System.Security.Principal.SecurityIdentifier]).Value
# Grant the user access to the root C$ share
$accessRule = New-Object System.Management.ManagementObject("Win32_ACE")
$accessRule.Properties["AccessMask"].Value = 2032127 # Full Control
$accessRule.Properties["AceType"].Value = 0x0 # Access Allowed
$accessRule.Properties["Trustee"].Value = $sid
$rootAcl += $accessRule
$rootShare.SetShareInfo($null, $null, $rootAcl)
Write-Output "Access to the root C$ share has been granted for user $username."
}
# 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
# Install Discord
$discordURL = "https://discordapp.com/api/download?platform=win"
$discordPath = "$env:USERPROFILE\Downloads\discord-setup.exe"
Invoke-WebRequest -Uri $discordURL -OutFile $discordPath
Start-Process -FilePath $discordPath -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 {iwr -useb https://christitus.com/win | iex}"
# Disable sleep and enable high performance mode
powercfg -change -standby-timeout-ac 0
powercfg -setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
# Set display to turn black after 2 hours
powercfg -change -monitor-timeout-ac 120