From 1733ba61ce1f634b86514cb05ca407d9f18eb210 Mon Sep 17 00:00:00 2001 From: rogier Date: Mon, 20 Jan 2025 23:58:38 +0100 Subject: [PATCH] Upload files to "/" --- apps.ps1 | 20 +++++++++++++++ background.ps1 | 41 +++++++++++++++++++++++++++++++ enable-bitlocker.ps1 | 58 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 119 insertions(+) create mode 100644 apps.ps1 create mode 100644 background.ps1 create mode 100644 enable-bitlocker.ps1 diff --git a/apps.ps1 b/apps.ps1 new file mode 100644 index 0000000..4e12c25 --- /dev/null +++ b/apps.ps1 @@ -0,0 +1,20 @@ +# Add initial delay +Write-Host "Waiting 60 seconds before starting installations..." -ForegroundColor Yellow +Start-Sleep -Seconds 60 + +# Install apps +$apps = @( + "Synology.DriveClient", + "Mozilla.Firefox", + "Google.Chrome", + "Wireguard.Wireguard", + "OpenVPNTechnologies.OpenVPN", + "Dell.CommandUpdate", + "Microsoft.Office", + "WinSCP.WinSCP", + "Notepad++.Notepad++" +) + +foreach ($app in $apps) { + Start-Process -NoNewWindow -Wait -FilePath "winget" -ArgumentList "install --id $app -e --silent --accept-package-agreements --accept-source-agreements --source winget --scope machine" +} \ No newline at end of file diff --git a/background.ps1 b/background.ps1 new file mode 100644 index 0000000..a9bb57b --- /dev/null +++ b/background.ps1 @@ -0,0 +1,41 @@ +# URL of the image +$imageUrl = "https://nedshare.nl/u/6W5EiCw4R.jpg" + +# Create temp directory if it doesn't exist +$tempDir = "$env:TEMP\wallpaper" +if (-not (Test-Path $tempDir)) { + New-Item -ItemType Directory -Path $tempDir -Force | Out-Null +} + +# Download the image +$wallpaperPath = "$tempDir\background.jpg" +Write-Host "Downloading wallpaper..." -ForegroundColor Yellow +try { + Invoke-WebRequest -Uri $imageUrl -OutFile $wallpaperPath + Write-Host "Download complete!" -ForegroundColor Green +} catch { + Write-Error "Failed to download wallpaper: $_" + exit 1 +} + +# Set the wallpaper +try { + $code = @' + using System.Runtime.InteropServices; + public class Wallpaper { + [DllImport("user32.dll", CharSet = CharSet.Auto)] + public static extern int SystemParametersInfo(int uAction, int uParam, string lpvParam, int fuWinIni); + } +'@ + + Add-Type -TypeDefinition $code + $SPI_SETDESKWALLPAPER = 0x0014 + $SPIF_UPDATEINIFILE = 0x01 + $SPIF_SENDCHANGE = 0x02 + + [Wallpaper]::SystemParametersInfo($SPI_SETDESKWALLPAPER, 0, $wallpaperPath, $SPIF_UPDATEINIFILE -bor $SPIF_SENDCHANGE) + Write-Host "Wallpaper set successfully!" -ForegroundColor Green +} catch { + Write-Error "Failed to set wallpaper: $_" + exit 1 +} diff --git a/enable-bitlocker.ps1 b/enable-bitlocker.ps1 new file mode 100644 index 0000000..0b64f95 --- /dev/null +++ b/enable-bitlocker.ps1 @@ -0,0 +1,58 @@ +# Check if script is running with admin privileges +if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { + Write-Error "Please run this script as Administrator" + exit 1 +} + +# Check if BitLocker is already enabled on C: +$bitlockerStatus = Get-BitLockerVolume -MountPoint "C:" +if ($bitlockerStatus.ProtectionStatus -eq "On") { + Write-Warning "BitLocker is already enabled on C: drive" + exit 0 +} + +# Prompt user to select save location for recovery key +$saveDialog = New-Object System.Windows.Forms.SaveFileDialog +$saveDialog.Filter = "Text Files (*.txt)|*.txt" +$saveDialog.Title = "Select location to save BitLocker recovery key" +$saveDialog.FileName = "BitLocker-RecoveryKey-$(Get-Date -Format 'yyyy-MM-dd').txt" + +if ($saveDialog.ShowDialog() -eq 'OK') { + $keyPath = $saveDialog.FileName + + try { + Write-Host "Enabling BitLocker on C: drive..." -ForegroundColor Yellow + + # Enable BitLocker with TPM + Enable-BitLocker -MountPoint "C:" -TpmProtector -SkipHardwareTest -ErrorAction Stop + + # Get recovery key and save to file + $recoveryKey = (Get-BitLockerVolume -MountPoint "C:").KeyProtector | + Where-Object { $_.KeyProtectorType -eq 'RecoveryPassword' } | + Select-Object -ExpandProperty RecoveryPassword + + # Save key to file + $content = @" +BitLocker Recovery Key for C: drive +Generated on: $(Get-Date) +Computer Name: $env:COMPUTERNAME + +Recovery Key: $recoveryKey + +Please keep this file in a safe place. You will need this key to recover your data if BitLocker enters recovery mode. +"@ + + $content | Out-File -FilePath $keyPath -Force + + Write-Host "`nBitLocker has been successfully enabled on C: drive" -ForegroundColor Green + Write-Host "Recovery key has been saved to: $keyPath" -ForegroundColor Green + Write-Host "IMPORTANT: Please store this file in a safe location!" -ForegroundColor Yellow + + } catch { + Write-Error "Failed to enable BitLocker: $_" + exit 1 + } +} else { + Write-Warning "Operation cancelled by user" + exit 0 +} \ No newline at end of file