Update Funktion angepasst.

This commit is contained in:
2022-12-31 11:24:30 +01:00
parent b02e406305
commit 483846aaaa

View File

@@ -1,22 +1,21 @@
#Updatet all the things #Updatet all the things
function Update { function Update {
Write-Host "Beginne mit dem Update aller Pakete..." Das gute Write-Host "Beginne mit dem Update aller Pakete..."
# Winget upgrades ausführen
winget upgrade --all winget upgrade --all
# ooshutup10 ausführen. Manchmal werden settings nach Windos updates zurückgesetzt
./OOSU10.exe $HOME/.winconfig/ooshutup10/ooshutup10.cfg /quiet
remove-item ~\Desktop* -include *.lnk remove-item ~\Desktop* -include *.lnk
if (Get-Module -ListAvailable -Name PSWindowsUpdate) { if (Get-Module -ListAvailable -Name PSWindowsUpdate) {
Write-Host "Installiere Windows Updates..." Write-Host "Installiere Windows Updates..."
Install-WindowsUpdate -MicrosoftUpdate -AcceptAll -IgnoreReboot Install-WindowsUpdate -MicrosoftUpdate -AcceptAll -IgnoreReboot
Write-Host "Update aller Powershell Module..." Write-Host "Update aller Powershell Module..."
if ($SimulationMode) {
Write-Host -ForegroundColor yellow 'Simulation mode is ON, nothing will be installed / removed / updated'
}
Write-Host -ForegroundColor Cyan 'Get all PowerShell modules' Write-Host -ForegroundColor Cyan 'Get all PowerShell modules'
function Remove-OldPowerShellModules { function Remove-OldPowerShellModules {
param ( param (
[string]$ModuleName, [string]$ModuleName,
[string]$GalleryVersion [string]$GalleryVersion
) )
try { try {
$oldVersions = Get-InstalledModule -Name $ModuleName -AllVersions -ErrorAction Stop | Where-Object { $_.Version -ne $GalleryVersion } $oldVersions = Get-InstalledModule -Name $ModuleName -AllVersions -ErrorAction Stop | Where-Object { $_.Version -ne $GalleryVersion }