## Fragt nach Admin Rechten. if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { $arguments = "& '" + $myinvocation.mycommand.definition + "'" Start-Process powershell -Verb runAs -ArgumentList $arguments Break } ## Prüfen ob das Loggin Modul installiert ist if (Get-Module -ListAvailable -Name Logging) { } else { Write-Host "Erster Start des Scripts erkannt." -ForegroundColor Red -BackgroundColor Yellow Write-Host "Installiere Logging Modul" -ForegroundColor Red Install-Module -Name Logging -Force } ## Setze das default Log Level # Konfig für die prompts $choices = New-Object Collections.ObjectModel.Collection[Management.Automation.Host.ChoiceDescription] $choices.Add((New-Object Management.Automation.Host.ChoiceDescription -ArgumentList '&Yes')) $choices.Add((New-Object Management.Automation.Host.ChoiceDescription -ArgumentList '&No')) ## Konfig für die Software $toRemove = @('Clipchamp.Clipchamp_yxz26nhyzhsrt', 'Microsoft.549981C3F5F10_8wekyb3d8bbwe', 'Microsoft.BingNews_8wekyb3d8bbwe', 'Microsoft.BingWeather_8wekyb3d8bbwe', 'Microsoft.GetHelp_8wekyb3d8bbwe', 'Microsoft.MicrosoftOfficeHub_8wekyb3d8bbwe', 'Microsoft.MicrosoftSolitaireCollection_8wekyb3d8bbwe', 'Micorosoft.MicrosoftStickyNotes_8wekyb3d8bbwe', 'Microsoft.People_8wekyb3d8bbwe', 'Microsoft.PowerAutomateDesktop_8wekyb3d8bbwe', 'Microsoft.Todos_8wekyb3d8bbwe', 'Microsoft.Windows.Photos_8wekyb3d8bbwe', 'Microsoft.WindowsMaps_8wekyb3d8bbwe', 'Microsoft.WindowsSoundRecorder_8wekyb3d8bbwe', 'Microsoft.WindowsAlarms_8wekyb3d8bbwe', 'Microsoft.YourPhone_8wekyb3d8bbwe', 'Microsoft.ZuneMusic_8wekyb3d8bbwe', 'Microsoft.ZuneVideo_8wekyb3d8bbwe', 'MicrosoftCorporationII.QuickAssist_8wekyb3d8bbwe', 'MicrosoftTeams_8wekyb3d8bbwe', 'MicrosoftTeams_8wekyb3d8bbwe', 'Microsoft.OneDrive', 'microsoft.windowscommunicationsapps_8wekyb3d8bbwe','CanonicalGroupLimited.Ubuntu_79rhkp1fndgsc') $toInstall = @('mcmilk.7zip-zstd', 'VideoLAN.VLC','SumatraPDF.SumatraPDF','Microsoft.VisualStudioCode','Bitwarden.Bitwarden','Mozilla.Firefox','IrfanSkiljan.IrfanView','Microsoft.PowerToys','OO-Software.ShutUp10' ,'Joplin.Joplin','WireGuard.WireGuard','Devolutions.RemoteDesktopManager','TeamViewer.TeamViewer','NickeManarin.ScreenToGif','JanDeDobbeleer.OhMyPosh') $toInstallOpt = @('Element.Element','CPUID.CPU-Z','Discord.Discord','Corsair.iCUE.4','Valve.Steam','GOG.Galaxy','TeXstudio.TeXstudio','MiKTeX.MiKTeX','Citrix.Workspace','Nvidia.GeForceExperience','Mojang.MinecraftLauncher') function Show-Menu { param ( [string]$Title = 'Software installation' ) Clear-Host Write-Host "================ $Title ================" Write-Host "1: Remove unwanted" Write-Host "2: Installiere Software" Write-Host "3: Installiere optionale Software" Write-Host "4: Konfiguriere Windows" Write-Host "Q: Beenden" } do { Show-Menu $selection = Read-Host "Bitte Aufgabe auswählen" switch ($selection) { '1' { foreach ($utility in $toRemove) { winget uninstall --id $utility } remove-item ~\Desktop* -include *.lnk } '2' { # Winget config reinrödeln Remove-Item "%LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json" New-Item -Path "%LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json" -ItemType SymbolicLink -Value "~/.winconfig/winget/settings.json" New-Item -Path "~/.config/winfetch/config.ps1" -ItemType SymbolicLink -Value "~/.winconfig/winfetch/config.ps1" # Krempeln deinstallieren foreach ($utility in $toInstall) { $ergebnis = winget list --id $utility if ($ergebnis -eq "Es wurde kein installiertes Paket gefunden, das den Eingabekriterien entspricht.") { winget install -e --id $utility --silent } else { Write-Host "Programm $utility bereits installiert" } } remove-item ~\Desktop* -include *.lnk Start-Process OOSU10 -NoNewWindow -Wait } '3' { foreach ($utility in $toInstallOpt) { $ergebnis = winget list --id $utility if ($ergebnis -eq "Es wurde kein installiertes Paket gefunden, das den Eingabekriterien entspricht.") { $decision = $Host.UI.PromptForChoice("$utility", "Soll $utility installiert werden?" , $choices, 1) if ($decision -eq 0) { Write-Host "Installiere $utility" winget install -e --id $utility --silent } } } $decision = $Host.UI.PromptForChoice('WSL', 'Soll WSL mit Debian 11 installiert werden?' , $choices, 1) if ($decision -eq 0) { Write-Host "Installiere WSL" wsl --install Write-Host "Installiere Debian" wsl --install -d Debian Read-Host "Computer muss neugestartet werden!" } } '4' { # Windows Explorer Einrichten New-Item -Path "HKCU:\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" -Value "" -Force Set-Itemproperty -path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'Hidden' -value '00000001' Set-Itemproperty -path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'HideFileExt' -value '00000000' Set-Itemproperty -path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CabinetState' -Name 'FullPath' -value '00000001' Remove-ItemProperty -path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'TaskbarSi' New-ItemProperty -path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'TaskbarSi' -value '0000001' -PropertyType DWORD Write-Host "Starte Explorer neu um änderungen zu übernehmen" Get-Process explorer | Stop-Process # Powershell Modul für Updates Install-Module -Name PSWindowsUpdate -Force # Windows Terminal Settings Remove-Item "~\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json" ; New-Item -Path "~\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json" -ItemType SymbolicLink -Value "~/.winconfig/terminal/settings.json" # Winfetch installieren & konfigurieren Install-Script winfetch Remove-Item -Recurse -Force ~/.config/winfetch mkdir ~/.config/winfetch New-Item -Path "~/.config/winfetch/config.ps1" -ItemType SymbolicLink -Value "~/.winconfig/winfetch/config.ps1" # Powershell Profile Datei erzeugen Remove-Item -Force "~/Documents/WindowsPowerShell/profile.ps1" New-Item -Path "~/Documents/WindowsPowerShell/profile.ps1" -ItemType SymbolicLink -Value "~/.winconfig/profile.ps1" Read-Host "Bitte das Terminal / Powershell neu starten damit die Aenderungen uebernommen werden." } } pause } until ($selection -eq 'q')