Last active
December 8, 2024 12:20
-
-
Save lucabased/56f653a8bef99b6c3489d9a7415fcda0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # NOTE => For use in Windows Server R2016 | |
| # Ensure script runs with administrative privileges | |
| If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(` | |
| [Security.Principal.WindowsBuiltinRole] "Administrator")) { | |
| Write-Host "Please run this script as Administrator." -ForegroundColor Red | |
| Exit 1 | |
| } | |
| # Set Execution Policy to allow running scripts (if needed) | |
| Set-ExecutionPolicy Bypass -Scope Process -Force | |
| # Install Chocolatey | |
| # The official recommendation is to run this command exactly as per chocolatey.org installation instructions | |
| If (!(Get-Command choco -ErrorAction SilentlyContinue)) { | |
| Write-Host "Installing Chocolatey..." | |
| Set-ExecutionPolicy Bypass -Scope Process -Force | |
| [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 | |
| Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) | |
| } | |
| # Refresh environment variables so choco is available without reopening PowerShell | |
| $env:PATH += ";$($Env:ProgramData)\chocolatey\bin" | |
| # Install desired applications via Chocolatey | |
| Write-Host "Installing desired applications..." | |
| choco install -y discord | |
| choco install -y discordchatexporter | |
| choco install -y openvpn | |
| choco install -y firefox | |
| choco install -y bleachbit | |
| choco install -y kleopatra | |
| choco install -y thunderbird | |
| choco install -y obs-studio | |
| # After installation, let's place a shortcut to DiscordChatExporter on the desktop. | |
| # The package files are usually in C:\ProgramData\chocolatey\lib\discordchatexporter.cli\tools | |
| $exporterPath = 'C:\ProgramData\chocolatey\lib\discordchatexporter.cli\tools\DiscordChatExporter.Cli.exe' | |
| $desktop = [Environment]::GetFolderPath("Desktop") | |
| $shortcutPath = Join-Path $desktop "DiscordChatExporter.lnk" | |
| $shell = New-Object -ComObject WScript.Shell | |
| $shortcut = $shell.CreateShortcut($shortcutPath) | |
| $shortcut.TargetPath = $exporterPath | |
| $shortcut.WorkingDirectory = [System.IO.Path]::GetDirectoryName($exporterPath) | |
| $shortcut.WindowStyle = 1 | |
| $shortcut.Description = "DiscordChatExporter" | |
| $shortcut.Save() | |
| Write-Host "Installed applications and created DiscordChatExporter shortcut on the Desktop." | |
| # Attempt to install Vencord | |
| # We will download the latest VencordInstaller.exe from GitHub and run it. | |
| Write-Host "Downloading and attempting to install Vencord..." | |
| $vencordInstallerUrl = "https://github.com/Vendicated/VencordInstaller/releases/latest/download/VencordInstaller.exe" | |
| $vencordInstallerPath = Join-Path $env:TEMP "VencordInstaller.exe" | |
| Invoke-WebRequest -Uri $vencordInstallerUrl -OutFile $vencordInstallerPath | |
| # Attempt a silent install. If it doesn't work, remove /S or run it interactively. | |
| Start-Process $vencordInstallerPath -ArgumentList "/S" -Wait | |
| Write-Host "Vencord installation attempted." | |
| # Set up Firefox privacy tweaks while retaining history and cookies. | |
| # We'll create a user.js file. First, ensure a profile directory exists. | |
| # Firefox profiles typically live in %APPDATA%\Mozilla\Firefox\Profiles\ | |
| # If no profile exists, we create a minimal one. Note: On a fresh system, run Firefox once or do the following: | |
| $firefoxAppData = Join-Path $env:APPDATA "Mozilla\Firefox\Profiles" | |
| if (!(Test-Path $firefoxAppData)) { | |
| # Create directory structure if it doesn't exist | |
| New-Item -ItemType Directory -Force -Path $firefoxAppData | Out-Null | |
| } | |
| # Find or create a default profile directory | |
| $profileDir = Get-ChildItem $firefoxAppData -Directory | Where-Object { $_.Name -like '*.default' } | Select-Object -First 1 | |
| if (-not $profileDir) { | |
| # If no default profile found, let's create one. The name format often has a random string. | |
| # We'll make something like 'xxxxxxxx.default', but note that a truly correct profile might need 'profiles.ini' setup. | |
| # For this script, we will just create a directory and place user.js there. The user may need to manually | |
| # set it as the default profile in Firefox or launch Firefox to create a profile and rename accordingly. | |
| $randomStr = -join ((65..90) + (97..122) | ForEach-Object { [char]$_ } | Get-Random -Count 8) | |
| $profileName = "$randomStr.default" | |
| $profileDir = New-Item -ItemType Directory (Join-Path $firefoxAppData $profileName) | |
| } | |
| $userJsPath = Join-Path $profileDir.FullName "user.js" | |
| # The following user.js settings: | |
| # - Keep history and cookies: default Firefox does this. | |
| # - Disable telemetry, pocket, and some data collection. | |
| # - You can adjust these as desired. | |
| $userJsContent = @" | |
| // Privacy tweaks ... | |
| user_pref('toolkit.telemetry.enabled', false); | |
| user_pref('toolkit.telemetry.unified', false); | |
| user_pref('datareporting.healthreport.uploadEnabled', false); | |
| user_pref('browser.ping-centre.telemetry', false); | |
| user_pref('extensions.pocket.enabled', false); | |
| user_pref('privacy.clearOnShutdown.history', false); | |
| user_pref('places.history.enabled', true); | |
| user_pref('network.cookie.cookieBehavior', 0); | |
| user_pref('privacy.clearOnShutdown.cookies', false); | |
| user_pref('browser.toolbars.bookmarks.visibility', 'always'); | |
| "@ | |
| $userJsContent | Out-File -Encoding UTF8 $userJsPath | |
| Write-Host "Firefox privacy tweaks applied in user.js. Please run Firefox at least once before this script or afterwards to ensure the profile is recognized." | |
| Write-Host "Setup complete." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment