57 lines
2.2 KiB
PowerShell
57 lines
2.2 KiB
PowerShell
# set-executionpolicy unrestricted
|
|
|
|
# Check if running as administrator
|
|
if (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
|
|
Write-Host "This script requires administrator privileges. Attempting to restart as administrator..." -ForegroundColor Yellow
|
|
|
|
# Get the current script path
|
|
$scriptPath = $MyInvocation.MyCommand.Path
|
|
|
|
# Restart the script with administrator privileges
|
|
try {
|
|
Start-Process PowerShell -Verb RunAs -ArgumentList "-ExecutionPolicy Bypass -File `"$scriptPath`""
|
|
exit
|
|
}
|
|
catch {
|
|
Write-Error "Failed to restart as administrator. Please run this script as administrator manually."
|
|
Write-Host "Right-click on PowerShell and select 'Run as administrator', then run this script again." -ForegroundColor Red
|
|
pause
|
|
exit 1
|
|
}
|
|
}
|
|
|
|
Write-Host "Running with administrator privileges." -ForegroundColor Green
|
|
|
|
[Environment]::UserName
|
|
$uid = $Env:UserName # Get current username for use in paths
|
|
|
|
reg.exe add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /f /ve
|
|
Add-WindowsCapability -Online -Name 'OpenSSH.Client~~~~0.0.1.0'
|
|
Enable-WindowsOptionalFeature -FeatureName ServicesForNFS-ClientOnly, ClientForNFS-Infrastructure -Online -NoRestart
|
|
winget source remove msstore
|
|
winget import -i .\winget.json
|
|
winget pin add Discord.Discord
|
|
|
|
#RDP Magic
|
|
Enable-NetFirewallRule -DisplayGroup "Remote Desktop"
|
|
Set-Service -Name TermService -StartupType Automatic
|
|
Start-Service -Name TermService
|
|
|
|
# Font Install
|
|
$fontSourceFolder = ".\Fonts"
|
|
$fontDestFolder = "C:\Windows\Fonts"
|
|
$regPath = "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Fonts"
|
|
|
|
# Process each TTF file
|
|
Get-ChildItem -Path $fontSourceFolder -Filter "*.ttf" | ForEach-Object {
|
|
$fontFile = $_.FullName
|
|
$fontName = $_.BaseName
|
|
$destFile = Join-Path -Path $fontDestFolder -ChildPath $_.Name
|
|
|
|
Copy-Item -Path $fontFile -Destination $destFile -Force
|
|
New-ItemProperty -Path $regPath -Name "$fontName (TrueType)" -Value $_.Name -PropertyType String -Force
|
|
}
|
|
|
|
Write-Host "Fonts installed for all users. Restart may be required."
|
|
|