Files
winconfig/install.ps1
2022-12-15 16:36:57 +01:00

139 lines
8.0 KiB
PowerShell

[CmdletBinding()]
param (
[Parameter()]
# To exclude modules from the update process
[String[]]$ExcludedModules,
# To include only these modules for the update process
[String[]]$IncludedModules,
[switch]$SkipPublisherCheck,
[switch]$SimulationMode
)
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
# if needed, register PSGallery
# Register PSGallery PSprovider and set as Trusted source
# Register-PSRepository -Default -ErrorAction SilentlyContinue
# Set-PSRepository -Name PSGallery -InstallationPolicy trusted -ErrorAction SilentlyContinue
## 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
}
# 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' {
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' {
$decision = $Host.UI.PromptForChoice('Explorer', 'Sollen Explorer und Taskbar Settings eingerichtet werden?' , $choices, 1)
if ($decision -eq 0) {
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'
# Taskbar größe ändern
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
}
if (!(Get-Module -ListAvailable -Name PSWindowsUpdate)) {
$decision = $Host.UI.PromptForChoice('Updates', 'Soll das Powershell Modul zum updaten von Windows installiert werden?' , $choices, 1)
if ($decision -eq 0) {
Install-Module -Name PSWindowsUpdate -Force
}
}
$decision = $Host.UI.PromptForChoice('Windows Termin', 'Soll das Windows Terminal eingerichtet werden?' , $choices, 1)
if ($decision -eq 0) {
New-Item -Path "~\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json" -ItemType SymbolicLink -Value "~/.winconfig/settings.json"
Read-Host "Bitte das Terminal / Powershell neu starten damit Winfetch funktioniert."
}
$decision = $Host.UI.PromptForChoice('Winfetch', 'Soll Winfetch eingerichtet werden?' , $choices, 1)
if ($decision -eq 0) {
Install-Script winfetch
Remove-Item -Recurse -Force ~/.config/winfetch
mkdir ~/.config/winfetch
New-Item -Path "~/.config/winfetch/config.ps1" -ItemType SymbolicLink -Value "~/.winconfig/config.ps1"
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 Winfetch funktioniert."
}
}
}
pause
}
until ($selection -eq 'q')