Nice changes:D

This commit is contained in:
2022-12-22 19:09:03 +01:00
parent 7bab621f93
commit 1a87f65d92
7 changed files with 63 additions and 43 deletions

5
.gitignore vendored
View File

@@ -1 +1,4 @@
test.ps1 test.*
*.log
.history/

View File

@@ -4,3 +4,4 @@ function edit {
code . code .
} }
Set-Alias -name install -value "~\.winconfig\install.ps1"

View File

@@ -1,27 +1,25 @@
[CmdletBinding()] ## Fragt nach Admin Rechten.
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")) { if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
$arguments = "& '" + $myinvocation.mycommand.definition + "'" $arguments = "& '" + $myinvocation.mycommand.definition + "'"
Start-Process powershell -Verb runAs -ArgumentList $arguments Start-Process powershell -Verb runAs -ArgumentList $arguments
Break 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 # Konfig für die prompts
$choices = New-Object Collections.ObjectModel.Collection[Management.Automation.Host.ChoiceDescription] $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 '&Yes'))
@@ -63,6 +61,11 @@ do {
} }
remove-item ~\Desktop* -include *.lnk remove-item ~\Desktop* -include *.lnk
} '2' { } '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) { foreach ($utility in $toInstall) {
$ergebnis = winget list --id $utility $ergebnis = winget list --id $utility
if ($ergebnis -eq "Es wurde kein installiertes Paket gefunden, das den Eingabekriterien entspricht.") { if ($ergebnis -eq "Es wurde kein installiertes Paket gefunden, das den Eingabekriterien entspricht.") {
@@ -94,43 +97,34 @@ do {
Read-Host "Computer muss neugestartet werden!" Read-Host "Computer muss neugestartet werden!"
} }
} '4' { } '4' {
$decision = $Host.UI.PromptForChoice('Explorer', 'Sollen Explorer und Taskbar Settings eingerichtet werden?' , $choices, 1) # Windows Explorer Einrichten
if ($decision -eq 0) {
New-Item -Path "HKCU:\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" -Value "" -Force 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 '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\Advanced' -Name 'HideFileExt' -value '00000000'
Set-Itemproperty -path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CabinetState' -Name 'FullPath' -value '00000001' 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' 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 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" Write-Host "Starte Explorer neu um änderungen zu übernehmen"
Get-Process explorer | Stop-Process 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." # 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"
$decision = $Host.UI.PromptForChoice('Winfetch', 'Soll Winfetch eingerichtet werden?' , $choices, 1) # Winfetch installieren & konfigurieren
if ($decision -eq 0) {
Install-Script winfetch Install-Script winfetch
Remove-Item -Recurse -Force ~/.config/winfetch Remove-Item -Recurse -Force ~/.config/winfetch
mkdir ~/.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" Remove-Item -Force "~/Documents/WindowsPowerShell/profile.ps1"
New-Item -Path "~/Documents/WindowsPowerShell/profile.ps1" -ItemType SymbolicLink -Value "~/.winconfig/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 pause

View File

@@ -1,5 +1,5 @@
# ===== WINFETCH CONFIGURATION ===== # ===== WINFETCH CONFIGURATION =====
$image = "~/.winconfig/image.jpg" $image = "~/.winconfig/winfetch/image.jpg"
$ascii = $false $ascii = $false
#$noimage = $false #$noimage = $false

View File

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

22
winget/settings.json Normal file
View File

@@ -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
// },
}