From 1a87f65d9295b979eda1a758a240f4126b451a67 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 22 Dec 2022 19:09:03 +0100 Subject: [PATCH] Nice changes:D --- .gitignore | 5 +- aliases.ps1 | 3 +- install.ps1 | 74 +++++++++++------------- settings.json => terminal/settings.json | 0 config.ps1 => winfetch/config.ps1 | 2 +- image.jpg => winfetch/image.jpg | Bin winget/settings.json | 22 +++++++ 7 files changed, 63 insertions(+), 43 deletions(-) rename settings.json => terminal/settings.json (100%) rename config.ps1 => winfetch/config.ps1 (97%) rename image.jpg => winfetch/image.jpg (100%) create mode 100644 winget/settings.json diff --git a/.gitignore b/.gitignore index c3dfe09..99ab515 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ -test.ps1 \ No newline at end of file +test.* +*.log +.history/ + diff --git a/aliases.ps1 b/aliases.ps1 index 92eda43..17126bd 100644 --- a/aliases.ps1 +++ b/aliases.ps1 @@ -3,4 +3,5 @@ function edit { Set-Location ~/.winconfig/ code . -} \ No newline at end of file +} +Set-Alias -name install -value "~\.winconfig\install.ps1" \ No newline at end of file diff --git a/install.ps1 b/install.ps1 index 7ec19c3..83d97a0 100644 --- a/install.ps1 +++ b/install.ps1 @@ -1,27 +1,25 @@ -[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. +## 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')) @@ -63,6 +61,11 @@ do { } 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.") { @@ -94,43 +97,34 @@ do { 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) { + # 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' - # 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" + + # Powershell Modul für Updates + Install-Module -Name PSWindowsUpdate -Force - Read-Host "Bitte das Terminal / Powershell neu starten damit Winfetch funktioniert." + # 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" - } - - $decision = $Host.UI.PromptForChoice('Winfetch', 'Soll Winfetch eingerichtet werden?' , $choices, 1) - if ($decision -eq 0) { + # 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/config.ps1" + 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 Winfetch funktioniert." - - } + Read-Host "Bitte das Terminal / Powershell neu starten damit die Aenderungen uebernommen werden." + + } } pause diff --git a/settings.json b/terminal/settings.json similarity index 100% rename from settings.json rename to terminal/settings.json diff --git a/config.ps1 b/winfetch/config.ps1 similarity index 97% rename from config.ps1 rename to winfetch/config.ps1 index ce33337..f468b15 100644 --- a/config.ps1 +++ b/winfetch/config.ps1 @@ -1,5 +1,5 @@ # ===== WINFETCH CONFIGURATION ===== -$image = "~/.winconfig/image.jpg" +$image = "~/.winconfig/winfetch/image.jpg" $ascii = $false #$noimage = $false diff --git a/image.jpg b/winfetch/image.jpg similarity index 100% rename from image.jpg rename to winfetch/image.jpg diff --git a/winget/settings.json b/winget/settings.json new file mode 100644 index 0000000..d58a3b1 --- /dev/null +++ b/winget/settings.json @@ -0,0 +1,22 @@ +{ + "$schema": "https://aka.ms/winget-settings.schema.json", + "visual": { + "progressBar": "rainbow" + }, + "telemetry": { + "disable": true + }, + "installBehavior": { + "preferences": { + "locale": [ "de-DE","en-US" ] + } + }, + "experimentalFeatures": { + "pinning": true + } + + // For documentation on these settings, see: https://aka.ms/winget-settings + // "source": { + // "autoUpdateIntervalInMinutes": 5 + // }, +} \ No newline at end of file