From 2132bd086de448db20d0cf985f828e3937d92d3b Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 6 Jan 2023 13:03:29 +0100 Subject: [PATCH] Update auf Ui --- .gitignore | 1 + config.ps1 | 315 +++++++++++++++++++++++++++ configs/ooshutup10/ooshutup10.cfg | 38 ++-- install.ps1 | 344 ++++-------------------------- menu/menu.xaml | 7 +- 5 files changed, 384 insertions(+), 321 deletions(-) create mode 100644 config.ps1 diff --git a/.gitignore b/.gitignore index 859ed27..08b4bff 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ test* *.log .history/ OOSU10.exe +logs/ diff --git a/config.ps1 b/config.ps1 new file mode 100644 index 0000000..4fe2ebd --- /dev/null +++ b/config.ps1 @@ -0,0 +1,315 @@ +# Enthält konfigurationen für das Script + +# 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 = @('7zip.7zip', 'VideoLAN.VLC', 'SumatraPDF.SumatraPDF', 'Microsoft.VisualStudioCode', 'Bitwarden.Bitwarden', 'Mozilla.Firefox', 'IrfanSkiljan.IrfanView', 'Microsoft.PowerToys', + 'Joplin.Joplin', 'WireGuard.WireGuard', 'Devolutions.RemoteDesktopManager', 'TeamViewer.TeamViewer', 'NickeManarin.ScreenToGif', 'JanDeDobbeleer.OhMyPosh', 'WiresharkFoundation.Wireshark', 'Famatech.AdvancedIPScanner', + 'yt-dlp.yt-dlp'.'Audacity.Audacity', 'ffmpeg') + +$toInstallOpt = @('Element.Element', 'Discord.Discord', 'Corsair.iCUE.4', 'Valve.Steam', 'GOG.Galaxy', 'TeXstudio.TeXstudio', 'MiKTeX.MiKTeX', 'Citrix.Workspace', 'Nvidia.GeForceExperience', 'Mojang.MinecraftLauncher', + 'Elgato.StreamDeck', 'REALiX.HWiNFO', '9P4CLT2RJ1RS', 'Microsoft.SQLServerManagementStudio', 'Soundboard', 'VMware.WorkstationPro') + +# Deinstalliert den Crap +function RemoveSoftware { + Read-Host "BLA" + $wingetResult = New-Object System.Collections.Generic.List[System.Object] + foreach ($utility in $toRemove) { + Try { + winget uninstall -e $utility + $wingetResult.Add("$node`n") + Start-Sleep -s 6 + Wait-Process winget -Timeout 90 -ErrorAction SilentlyContinue + } + Catch { + Write-Host "Paket $utility konnte nicht deinstalliert werden. " -ForegroundColor red + } + } + $wingetResult.ToArray() + $wingetResult | ForEach-Object { $_ } | Out-Host + # Popup after finished + $ButtonType = [System.Windows.MessageBoxButton]::OK + if ($wingetResult -ne "") { + $Messageboxbody = "Deinstallierter Crap `n$($wingetResult)" + } + else { + $Messageboxbody = "Kein Crap deinstalliert." + } + $MessageIcon = [System.Windows.MessageBoxImage]::Information + + [System.Windows.MessageBox]::Show($Messageboxbody, $AppTitle, $ButtonType, $MessageIcon) +} + +# Installiert die Default Software +function InstallSoftware { + # Winget config installieren. + if (-not(Test-Path -Path '~\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json' -PathType leaf)) { + Write-Host "Lege Winget config an." -ForegroundColor Blue + try { + New-Item -Path "~\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json" -ItemType SymbolicLink -Value "~/.winconfig/configs/winget/settings.json" | Out-Null + Write-Host "Winget config erfolgreich verlinkt." -ForegroundColor Green + } + catch { + Write-Host "Probleme beim verlinken der Wignet configt" -ForegroundColor Red + } + } + else { + if (CheckForLink(~\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json) -eq $False) { + Write-Host "Lege Winget config an." -ForegroundColor Blue + Remove-Item "~\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json" + try { + New-Item -Path "~\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json" -ItemType SymbolicLink -Value "~/.winconfig/configs/winget/settings.json" | Out-Null + Write-Host "Winget config erfolgreich verlinkt." -ForegroundColor Green + } + catch { + Write-Host "Probleme beim verlinken der Wignet configt" -ForegroundColor Red + } + + } + } + # Software installieren. + foreach ($utility in $toInstall) { + $ergebnis = winget list --id -e $utility + if ($ergebnis -eq "Es wurde kein installiertes Paket gefunden, das den Eingabekriterien entspricht.") { + Try { + winget install -e --id $utility --silent + # Killt Programme die nach der Installation automatisch die UI starten. Ätzend! + if ($utility -eq 'Famatech.AdvancedIPScanner' ) { + Start-Sleep -Seconds 5 + taskkill /IM advanced_ip_scanner.exe | Out-Null + + } + elseif ($utility -eq 'Microsoft.PowerToys') { + Start-Sleep -Seconds 5 + taskkill /IM PowerToys.Settings.exe | Out-Null + } + elseif ($utility -eq 'ffmpeg') { + Write-Host "Installiere ffmpeg..." -ForegroundColor Blue + try { + curl.exe -L https://www.gyan.dev/ffmpeg/builds/ffmpeg-git-essentials.7z -o ~/.winconfig/ffmpeg.7z + & "C:\Program Files\7-Zip\7z.exe" e ~/.winconfig/ffmpeg.7z -o"c:\Program Files\ffmpeg\" + Remove-Item ~/.winconfig/ffmpeg.7z + Write-Host "ffmpeg wurde erfolgreich installiert." -ForegroundColor Green + } + catch { + Write-Host "Es ist ein Fehler bei der Installation von ffmpeg auftreten. Bitte das Log durchsuchen." -ForegroundColor Red + } + } + } + Catch { + Write-Host "Paket $utility konnte nicht installiert werden. " -ForegroundColor Red + } + } + else { + Write-Host "Programm $utility bereits installiert" -ForegroundColor Green + } + } + + # OOShutup10 herunterladen und config reinrendern. + Write-Host "Lade OOshutup10 herunter bitte warten..." -ForegroundColor Blue + Try { + curl.exe -s "https://dl5.oo-software.com/files/ooshutup10/OOSU10.exe" -o OOSU10.exe + Write-Host "OOshutup10 erfolgreich heruntergeladen." -ForegroundColor Green + Write-Host "Versuche OOshutup10 config einzulesen..." -ForegroundColor Blue + ./OOSU10.exe $HOME\.winconfig\configs\ooshutup10\ooshutup10.cfg /quiet + Write-Host "OOshutup10 config erfolgreich eingelesen." -ForegroundColor Green + } + Catch { + Write-Host "Problem beim herunterladen von OOshutup 10." -ForegroundColor Red + } + Write-Host "Richte Powershell und Terminal ein..." -ForegroundColor Blue + # Fonts installieren. + $LocalPath = "~/.winconfig/fonts/" + $FONTS = 0x14 + $objShell = New-Object -ComObject Shell.Application + $objFolder = $objShell.Namespace($FONTS) + $Fontdir = Get-ChildItem $LocalPath + foreach ($File in $Fontdir) { + Write-Host "Versuche Schriftart $File zu installieren ..." -ForegroundColor Blue + Try { + if ((Test-Path "C:\Windows\Fonts\$File") -eq $False) { + $objFolder.CopyHere($File.fullname, 0x10) + } + Write-Host "Schriftart $File erfolgreich installiert." -ForegroundColor Green + } + Catch { + Write-Host "Probleme beim installieren der Schriftart $File" -ForegroundColor Red + } + } + # Windows Terminal Settings + Write-Host "Richte Windows Terminal config ein..." -ForegroundColor Blue + if (CheckForLink(~\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json) -eq $False) { + Try { + 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/configs/terminal/settings.json" | Out-Null + Write-Host "Windows Terminal config erfolgreich eingerichtet" -ForegroundColor Green + } + Catch { + Write-Host "Fehler beim einrichten der Windows Terminal config." -ForegroundColor Red + } + } + # Winfetch installieren & konfigurieren + + if (Get-Module -ListAvailable -Name winfetch) { + Write-Host "Winfetch ist bereits installiert." -ForegroundColor Blue + } + else { + Write-Host "Installiere und konfiguriere Winfetch..." -ForegroundColor Blue + Try { + Install-Script winfetch + Write-Host "Winfetch erfolgreich installiert." -ForegroundColor Green + if ((Test-Path ~/.config/winfetch -PathType Leaf) -eq $True) { + Write-Host "Lösche default config..." -ForegroundColor Blue + Remove-Item -Recurse -Force ~/.config/winfetch + } + Write-Host "Lege Winfetch config Ordner an..." -ForegroundColor Blue + mkdir ~/.config/winfetch | Out-Null + Write-Host "Winfetch config Ordner erfolgreich angelegt!" -ForegroundColor Green + Try { + New-Item -Path "~/.config/winfetch/config.ps1" -ItemType SymbolicLink -Value "~/.winconfig/configs/winfetch/config.ps1" | Out-Null + Write-Host "Winfetch config sauber gelinkt." -ForegroundColor Green + } + Catch { + Write-Host "Probleme beim verlinken der Winfetch config" -ForegroundColor Red + } + } + Catch { + Write-Host "Probleme beim installieren von Winfetch" -ForegroundColor Red + } + } + if (CheckForLink(~/.config/winfetch/config.ps1) -eq $False) { + Remove-Item "~/.config/winfetch/config.ps1" + New-Item -Path "~/.config/winfetch/config.ps1" -ItemType SymbolicLink -Value "~/.winconfig/configs/winfetch/config.ps1" | Out-Null + } + # Powershell Profile Datei erzeugen + Write-Host "Löschen des default Powershell profiles..." -ForegroundColor Blue + if ((Test-Path "~/Documents/PowerShell/profile.ps1" -PathType Leaf) -eq $True) { + if (CheckForLink(~/Documents/PowerShell/profile.ps1) -eq $False) { + Remove-Item -Force "~/Documents/PowerShell/profile.ps1" + Write-Host "Powershell config ~/Documents/PowerShell/profile.ps1 erfolgreich gelöscht." -ForegroundColor Green + Try { + New-Item -Path "~/Documents/PowerShell/profile.ps1" -ItemType SymbolicLink -Value "~/.winconfig/profile.ps1" | Out-Null + Write-Host "Powershell config ~/Documents/PowerShell/profile.ps1 erfolgreich verlinkt." + } + Catch { + Write-Host "Probleme beim verlinken der Powershell config ~/Documents/PowerShell/profile.ps1 " -ForegroundColor Red + } + } + } + if ((Test-Path "~/Documents/WindowsPowerShell/profile.ps1" -PathType Leaf) -eq $True) { + if (CheckForLink(~/Documents/WindowsPowerShell/profile.ps1) -eq $False) { + Remove-Item -Force "~/Documents/WindowsPowerShell/profile.ps1" + Write-Host "Powershell config ~/Documents/WindowsPowerShell/profile.ps1 erfolgreich gelöscht." -ForegroundColor Green + Try { + New-Item -Path "~/Documents/WindowsPowerShell/profile.ps1" -ItemType SymbolicLink -Value "~/.winconfig/profile.ps1" | Out-Null + Write-Host "Powershell config ~/Documents/WindowsPowerShell/profile.ps1 erfolgreich verlinkt." + } + Catch { + Write-Host "Probleme beim verlinken der Powershell config ~/Documents/WindowsPowerShell/profile.ps1" -ForegroundColor Red + } + } + } + if ((Test-Path "~/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1" -PathType Leaf) -eq $True) { + if (CheckForLink("~/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1") -eq $True) { + Remove-Item -Force "~/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1" + Write-Host "Powershell ~/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1 config erfolgreich gelöscht." -ForegroundColor Green + Try { + New-Item -Path "~\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1" -ItemType SymbolicLink -Value "~/.winconfig/profile.ps1" | Out-Null + Write-Host "Powershell config ~/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1 erfolgreich verlinkt." + } + Catch { + Write-Host "Probleme beim verlinken der Powershell config ~/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1 ." -ForegroundColor Red + } + } + } + # Powershell Modul für Updates + if (Get-Module -ListAvailable -Name PSWindowsUpdate) { + Write-Hoste "Windows Update Powershell Modul ist bereits installiert." -ForegroundColor Blue + } + else { + + Write-Host "Beginne mit der Insallation des Powershell Update Modul..." -ForegroundColor Blue + Try { + Install-Module -Name PSWindowsUpdate -Force + Write-Host "Powershell update Modul erfolgreich installiert..." -ForegroundColor Green + } + Catch { + Write-Host "Fehler beim installieren des Powershell update Modul." -ForegroundColor Red + } + } + Read-Host "Bitte das Terminal / Powershell neu starten damit die Aenderungen uebernommen werden." + + + +} + +# Funktion um optionale Software zu insatllieren +function InstallSoftwareOpt { + foreach ($utility in $toInstallOpt) { + $ergebnis = winget list --id -e $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) { + if (-Not $utility -eq 'Soundboard') { + Write-Host "Installiere $utility" + winget install -e --id $utility --silent + } + else { + Invoke-WebRequest -UseBasicParsing -Uri "https://www.leppsoft.com/soundpad/de/download/64/20230101-SZQED1RN/" ` + -UserAgent "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:108.0) Gecko/20100101 Firefox/108.0" ` + -Headers @{ + "Accept" = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8" + "Accept-Language" = "de,en-US;q=0.7,en;q=0.3" + "Accept-Encoding" = "gzip, deflate, br" + "Referer" = "https://www.leppsoft.com/soundpad/de/download/64/20230101-U1KGSLJC/Soundpad_x64-3.4.10.msi" + "Upgrade-Insecure-Requests" = "1" + "Sec-Fetch-Dest" = "document" + "Sec-Fetch-Mode" = "navigate" + "Sec-Fetch-Site" = "same-origin" + "Sec-Fetch-User" = "?1" + } + } + + } + } + } + $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!" + } + +} + +# Funktion um Windows zu debloaten +fucntion DebloatWindows { + Write-Host "Beginne das Windows zu debloaten und hardening auszuführen..." - -ForegroundColor Blue + debloatwindows + # 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 +} + +# Funktion um zu prüfen ob die config Files schon vorhanden sind. +function CheckForLink ($Path) { + + if (((Get-Item $Path).LinkType -eq "SymbolicLink")) { + Return $True + } + else { + Return $False + } +} diff --git a/configs/ooshutup10/ooshutup10.cfg b/configs/ooshutup10/ooshutup10.cfg index dec460b..2dd5731 100644 --- a/configs/ooshutup10/ooshutup10.cfg +++ b/configs/ooshutup10/ooshutup10.cfg @@ -36,7 +36,7 @@ P069 + P009 - P010 - P015 - -P068 - +P068 + P016 - A001 + A002 + @@ -92,16 +92,6 @@ P058 - P059 - P060 - P061 - -P071 - -P072 - -P073 - -P074 - -P075 - -P076 - -P077 - -P078 - -P079 - -P080 - P024 - S001 + S002 + @@ -157,6 +147,22 @@ E005 - E013 - E014 - E006 - +F002 + +F014 + +F015 + +F016 + +F001 + +F003 + +F004 + +F005 + +F007 + +F008 + +F009 + +F006 - +F010 - +F011 - +F012 - +F013 - Y001 + Y002 + Y003 + @@ -190,12 +196,12 @@ W010 - W009 - P017 - W006 - -W008 + +W008 - M006 + -M011 + +M011 - M010 - O003 - -O001 - +O001 + S012 - S013 - S014 - @@ -215,6 +221,6 @@ M016 + M017 - M018 - M019 - -M020 - -M021 + +M020 + +M023 + N001 - diff --git a/install.ps1 b/install.ps1 index 71a37d0..6d0ec2c 100644 --- a/install.ps1 +++ b/install.ps1 @@ -1,320 +1,62 @@ -# Log starten -Start-Transcript -Path $HOME/.winconfig/run.log - -# Einbinden der debloat.ps1 -. .\debloat.ps1 - -## Fragt nach Admin Rechten. +## 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 } -# Funktion um zu prüfen ob die config Files schon vorhanden sind. -function CheckForLink ($Path) { +# Log starten +if ((Test-Path $HOME/.winconfig/logs) -eq $False){ + New-Item $HOME/.winconfig/logs +} +Start-Transcript -Path $HOME/.winconfig/logs/run.log - if (((Get-Item $Path).LinkType -eq "SymbolicLink")) { - Return $True - } - else { - Return $False +# Menü laden +$inputXML = Get-Content "menu\menu.xaml" +[void][System.Reflection.Assembly]::LoadWithPartialName('presentationframework') +[xml]$XAML = $inputXML +$reader = (New-Object System.Xml.XmlNodeReader $xaml) +try { $Form = [Windows.Markup.XamlReader]::Load( $reader ) } +catch [System.Management.Automation.MethodInvocationException] { + Write-Warning "We ran into a problem with the XAML code. Check the syntax for this control..." + write-host $error[0].Exception.Message -ForegroundColor Red + If ($error[0].Exception.Message -like "*button*") { + write-warning "Ensure your <button in the `$inputXML does NOT have a Click=ButtonClick property. PS can't handle this`n`n`n`n" } } +catch { + Write-Host "Unable to load Windows.Markup.XamlReader. Double-check syntax and ensure .net is installed." +} + +$xaml.SelectNodes("//*[@Name]") | ForEach-Object { Set-Variable -Name "WPF$($_.Name)" -Value $Form.FindName($_.Name) } + +# Einbinden der debloat.ps1 +. .\debloat.ps1 # 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 = @('7zip.7zip', 'VideoLAN.VLC', 'SumatraPDF.SumatraPDF', 'Microsoft.VisualStudioCode', 'Bitwarden.Bitwarden', 'Mozilla.Firefox', 'IrfanSkiljan.IrfanView', 'Microsoft.PowerToys', - 'Joplin.Joplin', 'WireGuard.WireGuard', 'Devolutions.RemoteDesktopManager', 'TeamViewer.TeamViewer', 'NickeManarin.ScreenToGif', 'JanDeDobbeleer.OhMyPosh', 'WiresharkFoundation.Wireshark', 'Famatech.AdvancedIPScanner', - 'yt-dlp.yt-dlp'.'Audacity.Audacity','ffmpeg') -$toInstallOpt = @('Element.Element', 'Discord.Discord', 'Corsair.iCUE.4', 'Valve.Steam', 'GOG.Galaxy', 'TeXstudio.TeXstudio', 'MiKTeX.MiKTeX', 'Citrix.Workspace', 'Nvidia.GeForceExperience', 'Mojang.MinecraftLauncher', - 'Elgato.StreamDeck', 'REALiX.HWiNFO', '9P4CLT2RJ1RS', 'Microsoft.SQLServerManagementStudio', 'Soundboard','VMware.WorkstationPro') -# Menü konfiguration -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' { - # Crap deinstallieren - foreach ($utility in $toRemove) { - Try { - winget uninstall --id $utility - } - Catch { - Write-Host "Paket $utility konnte nicht deinstalliert werden. " -ForegroundColor red - } - } - } '2' { - # Winget config installieren. - if (-not(Test-Path -Path '~\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json' -PathType leaf)) { - Write-Host "Lege Winget config an." -ForegroundColor Blue - try { - New-Item -Path "~\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json" -ItemType SymbolicLink -Value "~/.winconfig/configs/winget/settings.json" | Out-Null - Write-Host "Winget config erfolgreich verlinkt." -ForegroundColor Green - } - catch { - Write-Host "Probleme beim verlinken der Wignet configt" -ForegroundColor Red - } - } - else { - if (CheckForLink(~\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json) -eq $False) { - Write-Host "Lege Winget config an." -ForegroundColor Blue - Remove-Item "~\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json" - try { - New-Item -Path "~\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json" -ItemType SymbolicLink -Value "~/.winconfig/configs/winget/settings.json" | Out-Null - Write-Host "Winget config erfolgreich verlinkt." -ForegroundColor Green - } - catch { - Write-Host "Probleme beim verlinken der Wignet configt" -ForegroundColor Red - } +$WPFremove.Add_Click({ + # Crap deinstallieren + Start-Process powershell.exe -Verb RunAs -ArgumentList "-command Start-Transcript ~/.winconfig/logs/winget-remove.log -Append; . ./config.ps1 ; RemoveSoftware | Out-Host" -WindowStyle Normal + }) +$WPFinstall.Add_Click({ + # Software installieren + Start-Process powershell.exe -Verb RunAs -ArgumentList "-command Start-Transcript ~/.winconfig/logs/winget-install.log -Append; . ./config.ps1 ; InstallSoftware | Out-Host" -WindowStyle Normal + }) + $WPFinstallop.Add_Click({ + # Optionale Software installieren + Start-Process powershell.exe -Verb RunAs -ArgumentList "-command Start-Transcript ~/.winconfig/logs/winget-installopt.log -Append; . ./config.ps1 ; InstallSoftwareOpt | Out-Host" -WindowStyle Normal + }) + $WPFinstallop.Add_Click({ + # Optionale Software installieren + Start-Process powershell.exe -Verb RunAs -ArgumentList "-command Start-Transcript ~/.winconfig/logs/winget-debloat.log -Append; . ./config.ps1 ; DebloatWindows | Out-Host" -WindowStyle Normal + }) - } - } - # Software installieren. - foreach ($utility in $toInstall) { - $ergebnis = winget list --id -e $utility - if ($ergebnis -eq "Es wurde kein installiertes Paket gefunden, das den Eingabekriterien entspricht.") { - Try { - winget install -e --id $utility --silent - # Killt Programme die nach der Installation automatisch die UI starten. Ätzend! - if ($utility -eq 'Famatech.AdvancedIPScanner' ) { - Start-Sleep -Seconds 5 - taskkill /IM advanced_ip_scanner.exe | Out-Null - } - elseif ($utility -eq 'Microsoft.PowerToys') { - Start-Sleep -Seconds 5 - taskkill /IM PowerToys.Settings.exe | Out-Null - } - elseif ($utility -eq 'ffmpeg'){ - Write-Host "Installiere ffmpeg..." -ForegroundColor Blue - try { - curl.exe -L https://www.gyan.dev/ffmpeg/builds/ffmpeg-git-essentials.7z -o ~/.winconfig/ffmpeg.7z - & "C:\Program Files\7-Zip\7z.exe" e ~/.winconfig/ffmpeg.7z -o"c:\Program Files\ffmpeg\" - Remove-Item ~/.winconfig/ffmpeg.7z - Write-Host "ffmpeg wurde erfolgreich installiert." -ForegroundColor Green - } - catch { - Write-Host "Es ist ein Fehler bei der Installation von ffmpeg auftreten. Bitte das Log durchsuchen." -ForegroundColor Red - } - } - } - Catch { - Write-Host "Paket $utility konnte nicht installiert werden. " -ForegroundColor Red - } - } - else { - Write-Host "Programm $utility bereits installiert" -ForegroundColor Green - } - } - - # OOShutup10 herunterladen und config reinrendern. - Write-Host "Lade OOshutup10 herunter bitte warten..." -ForegroundColor Blue - Try { - curl.exe -s "https://dl5.oo-software.com/files/ooshutup10/OOSU10.exe" -o OOSU10.exe - Write-Host "OOshutup10 erfolgreich heruntergeladen." -ForegroundColor Green - Write-Host "Versuche OOshutup10 config einzulesen..." -ForegroundColor Blue - ./OOSU10.exe $HOME\.winconfig\configs\ooshutup10\ooshutup10.cfg /quiet - Write-Host "OOshutup10 config erfolgreich eingelesen." -ForegroundColor Green - } - Catch { - Write-Host "Problem beim herunterladen von OOshutup 10." -ForegroundColor Red - } - Write-Host "Richte Powershell und Terminal ein..." -ForegroundColor Blue - # Fonts installieren. - $LocalPath = "~/.winconfig/fonts/" - $FONTS = 0x14 - $objShell = New-Object -ComObject Shell.Application - $objFolder = $objShell.Namespace($FONTS) - $Fontdir = Get-ChildItem $LocalPath - foreach ($File in $Fontdir) { - Write-Host "Versuche Schriftart $File zu installieren ..." -ForegroundColor Blue - Try { - if ((Test-Path "C:\Windows\Fonts\$File") -eq $False) { - $objFolder.CopyHere($File.fullname, 0x10) - } - Write-Host "Schriftart $File erfolgreich installiert." -ForegroundColor Green - } - Catch { - Write-Host "Probleme beim installieren der Schriftart $File" -ForegroundColor Red - } - } - # Windows Terminal Settings - Write-Host "Richte Windows Terminal config ein..." -ForegroundColor Blue - if (CheckForLink(~\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json) -eq $False) { - Try { - 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/configs/terminal/settings.json" | Out-Null - Write-Host "Windows Terminal config erfolgreich eingerichtet" -ForegroundColor Green - } - Catch { - Write-Host "Fehler beim einrichten der Windows Terminal config." -ForegroundColor Red - } - } - # Winfetch installieren & konfigurieren - - if (Get-Module -ListAvailable -Name winfetch) { - Write-Host "Winfetch ist bereits installiert." -ForegroundColor Blue - } - else { - Write-Host "Installiere und konfiguriere Winfetch..." -ForegroundColor Blue - Try { - Install-Script winfetch - Write-Host "Winfetch erfolgreich installiert." -ForegroundColor Green - if ((Test-Path ~/.config/winfetch -PathType Leaf) -eq $True) { - Write-Host "Lösche default config..." -ForegroundColor Blue - Remove-Item -Recurse -Force ~/.config/winfetch - } - Write-Host "Lege Winfetch config Ordner an..." -ForegroundColor Blue - mkdir ~/.config/winfetch | Out-Null - Write-Host "Winfetch config Ordner erfolgreich angelegt!" -ForegroundColor Green - Try { - New-Item -Path "~/.config/winfetch/config.ps1" -ItemType SymbolicLink -Value "~/.winconfig/configs/winfetch/config.ps1" | Out-Null - Write-Host "Winfetch config sauber gelinkt." -ForegroundColor Green - } - Catch { - Write-Host "Probleme beim verlinken der Winfetch config" -ForegroundColor Red - } - } - Catch { - Write-Host "Probleme beim installieren von Winfetch" -ForegroundColor Red - } - } - if (CheckForLink(~/.config/winfetch/config.ps1) -eq $False) { - Remove-Item "~/.config/winfetch/config.ps1" - New-Item -Path "~/.config/winfetch/config.ps1" -ItemType SymbolicLink -Value "~/.winconfig/configs/winfetch/config.ps1" | Out-Null - } - # Powershell Profile Datei erzeugen - Write-Host "Löschen des default Powershell profiles..." -ForegroundColor Blue - if ((Test-Path "~/Documents/PowerShell/profile.ps1" -PathType Leaf) -eq $True) { - if (CheckForLink(~/Documents/PowerShell/profile.ps1) -eq $False) { - Remove-Item -Force "~/Documents/PowerShell/profile.ps1" - Write-Host "Powershell config ~/Documents/PowerShell/profile.ps1 erfolgreich gelöscht." -ForegroundColor Green - Try { - New-Item -Path "~/Documents/PowerShell/profile.ps1" -ItemType SymbolicLink -Value "~/.winconfig/profile.ps1" | Out-Null - Write-Host "Powershell config ~/Documents/PowerShell/profile.ps1 erfolgreich verlinkt." - } - Catch { - Write-Host "Probleme beim verlinken der Powershell config ~/Documents/PowerShell/profile.ps1 " -ForegroundColor Red - } - } - } - if ((Test-Path "~/Documents/WindowsPowerShell/profile.ps1" -PathType Leaf) -eq $True) { - if (CheckForLink(~/Documents/WindowsPowerShell/profile.ps1) -eq $False) { - Remove-Item -Force "~/Documents/WindowsPowerShell/profile.ps1" - Write-Host "Powershell config ~/Documents/WindowsPowerShell/profile.ps1 erfolgreich gelöscht." -ForegroundColor Green - Try { - New-Item -Path "~/Documents/WindowsPowerShell/profile.ps1" -ItemType SymbolicLink -Value "~/.winconfig/profile.ps1" | Out-Null - Write-Host "Powershell config ~/Documents/WindowsPowerShell/profile.ps1 erfolgreich verlinkt." - } - Catch { - Write-Host "Probleme beim verlinken der Powershell config ~/Documents/WindowsPowerShell/profile.ps1" -ForegroundColor Red - } - } - } - if ((Test-Path "~/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1" -PathType Leaf) -eq $True) { - if (CheckForLink("~/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1") -eq $True) { - Remove-Item -Force "~/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1" - Write-Host "Powershell ~/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1 config erfolgreich gelöscht." -ForegroundColor Green - Try { - New-Item -Path "~\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1" -ItemType SymbolicLink -Value "~/.winconfig/profile.ps1" | Out-Null - Write-Host "Powershell config ~/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1 erfolgreich verlinkt." - } - Catch { - Write-Host "Probleme beim verlinken der Powershell config ~/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1 ." -ForegroundColor Red - } - } - } - # Powershell Modul für Updates - if (Get-Module -ListAvailable -Name PSWindowsUpdate) { - Write-Hoste "Windows Update Powershell Modul ist bereits installiert." -ForegroundColor Blue - } - else { +$Form.ShowDialog() | out-null +Stop-Transcript - Write-Host "Beginne mit der Insallation des Powershell Update Modul..." -ForegroundColor Blue - Try { - Install-Module -Name PSWindowsUpdate -Force - Write-Host "Powershell update Modul erfolgreich installiert..." -ForegroundColor Green - } - Catch { - Write-Host "Fehler beim installieren des Powershell update Modul." -ForegroundColor Red - } - } - Read-Host "Bitte das Terminal / Powershell neu starten damit die Aenderungen uebernommen werden." - - } '3' { - foreach ($utility in $toInstallOpt) { - $ergebnis = winget list --id -e $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) { - if (-Not $utility -eq 'Soundboard') { - Write-Host "Installiere $utility" - winget install -e --id $utility --silent - } - else { - Invoke-WebRequest -UseBasicParsing -Uri "https://www.leppsoft.com/soundpad/de/download/64/20230101-SZQED1RN/" ` - -UserAgent "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:108.0) Gecko/20100101 Firefox/108.0" ` - -Headers @{ - "Accept" = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8" - "Accept-Language" = "de,en-US;q=0.7,en;q=0.3" - "Accept-Encoding" = "gzip, deflate, br" - "Referer" = "https://www.leppsoft.com/soundpad/de/download/64/20230101-U1KGSLJC/Soundpad_x64-3.4.10.msi" - "Upgrade-Insecure-Requests" = "1" - "Sec-Fetch-Dest" = "document" - "Sec-Fetch-Mode" = "navigate" - "Sec-Fetch-Site" = "same-origin" - "Sec-Fetch-User" = "?1" - } - } - - } - } - } - $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' { - Write-Host "Beginne das Windows zu debloaten und hardening auszuführen..." - -ForegroundColor Blue - # 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 - } - } - pause -} -until ($selection -eq 'q') -Stop-Transcript \ No newline at end of file diff --git a/menu/menu.xaml b/menu/menu.xaml index e08dc30..06a4708 100644 --- a/menu/menu.xaml +++ b/menu/menu.xaml @@ -1,9 +1,8 @@ - +