From 2eac70cc649e61bb6c9c02fb5039be05684cc071 Mon Sep 17 00:00:00 2001 From: Romain <96626929+Romanitho@users.noreply.github.com> Date: Sun, 1 Sep 2024 15:12:10 +0200 Subject: [PATCH 1/7] restruct --- Sources/WAU Configurator.lnk | Bin 2668 -> 0 bytes Sources/{WAU/Gui.ps1 => WAU Configurator.ps1} | 0 Sources/{WAU => }/Winget-AutoUpdate-Install.ps1 | 0 .../{WAU => }/Winget-AutoUpdate/Invisible.vbs | 0 Sources/{WAU => }/Winget-AutoUpdate/User-Run.ps1 | 0 Sources/{WAU => }/Winget-AutoUpdate/Version.txt | 0 .../{WAU => }/Winget-AutoUpdate/WAU-Policies.ps1 | 0 .../Winget-AutoUpdate/WAU-Uninstall.ps1 | 0 .../Winget-AutoUpdate/Winget-Install.ps1 | 0 .../Winget-AutoUpdate/Winget-Notify.ps1 | 0 .../Winget-AutoUpdate/Winget-Upgrade.ps1 | 0 .../config/default_excluded_apps.txt} | 13 ++++++------- .../functions/Add-ScopeMachine.ps1 | 0 .../Winget-AutoUpdate/functions/Add-Shortcut.ps1 | 0 .../functions/Confirm-Installation.ps1 | 0 .../Winget-AutoUpdate/functions/Get-AZCopy.ps1 | 0 .../Winget-AutoUpdate/functions/Get-AppInfo.ps1 | 0 .../functions/Get-ExcludedApps.ps1 | 6 +++--- .../functions/Get-IncludedApps.ps1 | 0 .../functions/Get-NotifLocale.ps1 | 0 .../functions/Get-WAUAvailableVersion.ps1 | 0 .../functions/Get-WAUConfig.ps1 | 0 .../functions/Get-WingetCmd.ps1 | 0 .../functions/Get-WingetOutdatedApps.ps1 | 0 .../functions/Get-WingetSystemApps.ps1 | 0 .../functions/Install-Prerequisites.ps1 | 0 .../functions/Invoke-DirProtect.ps1 | 0 .../functions/Invoke-LogRotation.ps1 | 0 .../functions/Invoke-PostUpdateActions.ps1 | 0 .../functions/Start-NotifTask.ps1 | 0 .../functions/Test-ListPath.ps1 | 0 .../Winget-AutoUpdate/functions/Test-Mods.ps1 | 0 .../functions/Test-ModsPath.ps1 | 0 .../Winget-AutoUpdate/functions/Test-Network.ps1 | 0 .../functions/Test-PendingReboot.ps1 | 0 .../Winget-AutoUpdate/functions/Update-App.ps1 | 0 .../functions/Update-StoreApps.ps1 | 0 .../Winget-AutoUpdate/functions/Update-WAU.ps1 | 0 .../functions/Update-WinGet.ps1 | 0 .../functions/Write-CMTraceLog.ps1 | 0 .../Winget-AutoUpdate/functions/Write-ToLog.ps1 | 0 .../{WAU => }/Winget-AutoUpdate/icons/error.png | Bin .../{WAU => }/Winget-AutoUpdate/icons/info.png | Bin .../Winget-AutoUpdate/icons/success.png | Bin .../Winget-AutoUpdate/icons/warning.png | Bin .../{WAU => }/Winget-AutoUpdate/locale/cz.xml | 0 .../{WAU => }/Winget-AutoUpdate/locale/de.xml | 0 .../{WAU => }/Winget-AutoUpdate/locale/en.xml | 0 .../{WAU => }/Winget-AutoUpdate/locale/es.xml | 0 .../{WAU => }/Winget-AutoUpdate/locale/fi.xml | 0 .../{WAU => }/Winget-AutoUpdate/locale/fr.xml | 0 .../{WAU => }/Winget-AutoUpdate/locale/hu.xml | 0 .../{WAU => }/Winget-AutoUpdate/locale/it.xml | 0 .../{WAU => }/Winget-AutoUpdate/locale/nb.xml | 0 .../{WAU => }/Winget-AutoUpdate/locale/nl.xml | 0 .../{WAU => }/Winget-AutoUpdate/locale/pl.xml | 0 .../{WAU => }/Winget-AutoUpdate/locale/pt.xml | 0 .../{WAU => }/Winget-AutoUpdate/locale/ru.xml | 0 .../{WAU => }/Winget-AutoUpdate/locale/sv.xml | 0 .../{WAU => }/Winget-AutoUpdate/locale/uk.xml | 0 .../Winget-AutoUpdate/locale/zh-CHS.xml | 0 .../Winget-AutoUpdate/locale/zh-CHT.xml | 0 .../{WAU => }/Winget-AutoUpdate/mods/README.md | 0 .../Winget-AutoUpdate/mods/_AppID-template.ps1 | 0 .../Winget-AutoUpdate/mods/_Mods-Functions.ps1 | 0 .../mods/_WAU-mods-template.ps1 | 0 .../mods/_WAU-notinstalled-template.ps1 | 0 .../Winget-AutoUpdate/mods/bins/README.md | 0 68 files changed, 9 insertions(+), 10 deletions(-) delete mode 100644 Sources/WAU Configurator.lnk rename Sources/{WAU/Gui.ps1 => WAU Configurator.ps1} (100%) rename Sources/{WAU => }/Winget-AutoUpdate-Install.ps1 (100%) rename Sources/{WAU => }/Winget-AutoUpdate/Invisible.vbs (100%) rename Sources/{WAU => }/Winget-AutoUpdate/User-Run.ps1 (100%) rename Sources/{WAU => }/Winget-AutoUpdate/Version.txt (100%) rename Sources/{WAU => }/Winget-AutoUpdate/WAU-Policies.ps1 (100%) rename Sources/{WAU => }/Winget-AutoUpdate/WAU-Uninstall.ps1 (100%) rename Sources/{WAU => }/Winget-AutoUpdate/Winget-Install.ps1 (100%) rename Sources/{WAU => }/Winget-AutoUpdate/Winget-Notify.ps1 (100%) rename Sources/{WAU => }/Winget-AutoUpdate/Winget-Upgrade.ps1 (100%) rename Sources/{WAU/excluded_apps.txt => Winget-AutoUpdate/config/default_excluded_apps.txt} (51%) rename Sources/{WAU => }/Winget-AutoUpdate/functions/Add-ScopeMachine.ps1 (100%) rename Sources/{WAU => }/Winget-AutoUpdate/functions/Add-Shortcut.ps1 (100%) rename Sources/{WAU => }/Winget-AutoUpdate/functions/Confirm-Installation.ps1 (100%) rename Sources/{WAU => }/Winget-AutoUpdate/functions/Get-AZCopy.ps1 (100%) rename Sources/{WAU => }/Winget-AutoUpdate/functions/Get-AppInfo.ps1 (100%) rename Sources/{WAU => }/Winget-AutoUpdate/functions/Get-ExcludedApps.ps1 (95%) rename Sources/{WAU => }/Winget-AutoUpdate/functions/Get-IncludedApps.ps1 (100%) rename Sources/{WAU => }/Winget-AutoUpdate/functions/Get-NotifLocale.ps1 (100%) rename Sources/{WAU => }/Winget-AutoUpdate/functions/Get-WAUAvailableVersion.ps1 (100%) rename Sources/{WAU => }/Winget-AutoUpdate/functions/Get-WAUConfig.ps1 (100%) rename Sources/{WAU => }/Winget-AutoUpdate/functions/Get-WingetCmd.ps1 (100%) rename Sources/{WAU => }/Winget-AutoUpdate/functions/Get-WingetOutdatedApps.ps1 (100%) rename Sources/{WAU => }/Winget-AutoUpdate/functions/Get-WingetSystemApps.ps1 (100%) rename Sources/{WAU => }/Winget-AutoUpdate/functions/Install-Prerequisites.ps1 (100%) rename Sources/{WAU => }/Winget-AutoUpdate/functions/Invoke-DirProtect.ps1 (100%) rename Sources/{WAU => }/Winget-AutoUpdate/functions/Invoke-LogRotation.ps1 (100%) rename Sources/{WAU => }/Winget-AutoUpdate/functions/Invoke-PostUpdateActions.ps1 (100%) rename Sources/{WAU => }/Winget-AutoUpdate/functions/Start-NotifTask.ps1 (100%) rename Sources/{WAU => }/Winget-AutoUpdate/functions/Test-ListPath.ps1 (100%) rename Sources/{WAU => }/Winget-AutoUpdate/functions/Test-Mods.ps1 (100%) rename Sources/{WAU => }/Winget-AutoUpdate/functions/Test-ModsPath.ps1 (100%) rename Sources/{WAU => }/Winget-AutoUpdate/functions/Test-Network.ps1 (100%) rename Sources/{WAU => }/Winget-AutoUpdate/functions/Test-PendingReboot.ps1 (100%) rename Sources/{WAU => }/Winget-AutoUpdate/functions/Update-App.ps1 (100%) rename Sources/{WAU => }/Winget-AutoUpdate/functions/Update-StoreApps.ps1 (100%) rename Sources/{WAU => }/Winget-AutoUpdate/functions/Update-WAU.ps1 (100%) rename Sources/{WAU => }/Winget-AutoUpdate/functions/Update-WinGet.ps1 (100%) rename Sources/{WAU => }/Winget-AutoUpdate/functions/Write-CMTraceLog.ps1 (100%) rename Sources/{WAU => }/Winget-AutoUpdate/functions/Write-ToLog.ps1 (100%) rename Sources/{WAU => }/Winget-AutoUpdate/icons/error.png (100%) rename Sources/{WAU => }/Winget-AutoUpdate/icons/info.png (100%) rename Sources/{WAU => }/Winget-AutoUpdate/icons/success.png (100%) rename Sources/{WAU => }/Winget-AutoUpdate/icons/warning.png (100%) rename Sources/{WAU => }/Winget-AutoUpdate/locale/cz.xml (100%) rename Sources/{WAU => }/Winget-AutoUpdate/locale/de.xml (100%) rename Sources/{WAU => }/Winget-AutoUpdate/locale/en.xml (100%) rename Sources/{WAU => }/Winget-AutoUpdate/locale/es.xml (100%) rename Sources/{WAU => }/Winget-AutoUpdate/locale/fi.xml (100%) rename Sources/{WAU => }/Winget-AutoUpdate/locale/fr.xml (100%) rename Sources/{WAU => }/Winget-AutoUpdate/locale/hu.xml (100%) rename Sources/{WAU => }/Winget-AutoUpdate/locale/it.xml (100%) rename Sources/{WAU => }/Winget-AutoUpdate/locale/nb.xml (100%) rename Sources/{WAU => }/Winget-AutoUpdate/locale/nl.xml (100%) rename Sources/{WAU => }/Winget-AutoUpdate/locale/pl.xml (100%) rename Sources/{WAU => }/Winget-AutoUpdate/locale/pt.xml (100%) rename Sources/{WAU => }/Winget-AutoUpdate/locale/ru.xml (100%) rename Sources/{WAU => }/Winget-AutoUpdate/locale/sv.xml (100%) rename Sources/{WAU => }/Winget-AutoUpdate/locale/uk.xml (100%) rename Sources/{WAU => }/Winget-AutoUpdate/locale/zh-CHS.xml (100%) rename Sources/{WAU => }/Winget-AutoUpdate/locale/zh-CHT.xml (100%) rename Sources/{WAU => }/Winget-AutoUpdate/mods/README.md (100%) rename Sources/{WAU => }/Winget-AutoUpdate/mods/_AppID-template.ps1 (100%) rename Sources/{WAU => }/Winget-AutoUpdate/mods/_Mods-Functions.ps1 (100%) rename Sources/{WAU => }/Winget-AutoUpdate/mods/_WAU-mods-template.ps1 (100%) rename Sources/{WAU => }/Winget-AutoUpdate/mods/_WAU-notinstalled-template.ps1 (100%) rename Sources/{WAU => }/Winget-AutoUpdate/mods/bins/README.md (100%) diff --git a/Sources/WAU Configurator.lnk b/Sources/WAU Configurator.lnk deleted file mode 100644 index d62ed85a67202bd7ffeab8ee83a202b09ebe27d8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2668 zcmds3U1*bM6n+wwTAi9=lq%bdLPo0QGf5l!1G3g;ZP8MzU$@W6S5T5q6K&eiIMeQ8 zY~U`GdNHQpg_A03b@+oD(hGl3yc~?OG0}n`Qt+o(_09`nd(NBmtI0a8;Ej7f&iixT z^Pcm(=bXGJ%>W#3Cwt(!>d`RjoCy!-Uym4fZ#st^D^_N{3rrh!+}ib}TI1UyjB&px zD{uF6oNg>>y|-b=^SCDAI(~a5Rs;e+EyAk$8q*ef}urJl*)~hzBWwo)+ku)nkFSvYwaSHlr^h-Z?d$T@L><`x?uSRU&00PTPnz zBJUvqACuyw4|Atw%tjH|!FdTuAn(1OI^yC8rbsRW%<-6wGbUVYiUZ6--0OKi4d#^k ze6O4TinBR|xR|z2&DVP2Q{MP9<&P-7V)i8Hu}(;&J2;Or!#vE&Uh3G!TuXE1&$F)c zOfO|E?lkd4jGsjfBGFc;g$CZ^ zwKtb35yrdwKO&l+>yy1OQ_bY}*irv;=x12Di}{<_$9o3#R{crf>To^wH4eNOntvj_ zeOZ$HnD}4`Ngm+wa^Qgv^(-ZY58h-?!J z-xK7kS|UJJl61lelES2rnuS=UDo}}P_SNKv$@im*qwuP@D^#g?aw5PTkzB3h!s;{? zvt1$yh`@92;M2y%u9MH5Tl7CE5R|I6p=b(5H4reQOT=QF7@Pu5Y+gIwT&I za;iYraC~=Rd%NF%HEj#Piwl#Ha|cpQ15LHsi8VcaACWJ$o&^NxdpxQq`gg4R_1?LI M4@Szzgg@T?0jYhEQUCw| diff --git a/Sources/WAU/Gui.ps1 b/Sources/WAU Configurator.ps1 similarity index 100% rename from Sources/WAU/Gui.ps1 rename to Sources/WAU Configurator.ps1 diff --git a/Sources/WAU/Winget-AutoUpdate-Install.ps1 b/Sources/Winget-AutoUpdate-Install.ps1 similarity index 100% rename from Sources/WAU/Winget-AutoUpdate-Install.ps1 rename to Sources/Winget-AutoUpdate-Install.ps1 diff --git a/Sources/WAU/Winget-AutoUpdate/Invisible.vbs b/Sources/Winget-AutoUpdate/Invisible.vbs similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/Invisible.vbs rename to Sources/Winget-AutoUpdate/Invisible.vbs diff --git a/Sources/WAU/Winget-AutoUpdate/User-Run.ps1 b/Sources/Winget-AutoUpdate/User-Run.ps1 similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/User-Run.ps1 rename to Sources/Winget-AutoUpdate/User-Run.ps1 diff --git a/Sources/WAU/Winget-AutoUpdate/Version.txt b/Sources/Winget-AutoUpdate/Version.txt similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/Version.txt rename to Sources/Winget-AutoUpdate/Version.txt diff --git a/Sources/WAU/Winget-AutoUpdate/WAU-Policies.ps1 b/Sources/Winget-AutoUpdate/WAU-Policies.ps1 similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/WAU-Policies.ps1 rename to Sources/Winget-AutoUpdate/WAU-Policies.ps1 diff --git a/Sources/WAU/Winget-AutoUpdate/WAU-Uninstall.ps1 b/Sources/Winget-AutoUpdate/WAU-Uninstall.ps1 similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/WAU-Uninstall.ps1 rename to Sources/Winget-AutoUpdate/WAU-Uninstall.ps1 diff --git a/Sources/WAU/Winget-AutoUpdate/Winget-Install.ps1 b/Sources/Winget-AutoUpdate/Winget-Install.ps1 similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/Winget-Install.ps1 rename to Sources/Winget-AutoUpdate/Winget-Install.ps1 diff --git a/Sources/WAU/Winget-AutoUpdate/Winget-Notify.ps1 b/Sources/Winget-AutoUpdate/Winget-Notify.ps1 similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/Winget-Notify.ps1 rename to Sources/Winget-AutoUpdate/Winget-Notify.ps1 diff --git a/Sources/WAU/Winget-AutoUpdate/Winget-Upgrade.ps1 b/Sources/Winget-AutoUpdate/Winget-Upgrade.ps1 similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/Winget-Upgrade.ps1 rename to Sources/Winget-AutoUpdate/Winget-Upgrade.ps1 diff --git a/Sources/WAU/excluded_apps.txt b/Sources/Winget-AutoUpdate/config/default_excluded_apps.txt similarity index 51% rename from Sources/WAU/excluded_apps.txt rename to Sources/Winget-AutoUpdate/config/default_excluded_apps.txt index 3c24afd..585f87b 100644 --- a/Sources/WAU/excluded_apps.txt +++ b/Sources/Winget-AutoUpdate/config/default_excluded_apps.txt @@ -1,10 +1,9 @@ -Google.Chrome -Microsoft.Edge -Microsoft.EdgeWebView2Runtime +Google.Chrome* +Microsoft.Edge* Microsoft.Office Microsoft.OneDrive -Microsoft.Teams -Microsoft.Teams.Classic -Mozilla.Firefox* -TeamViewer.TeamViewer* Microsoft.RemoteDesktopClient +Microsoft.Teams* +Mozilla.Firefox* +Opera.Opera* +TeamViewer.TeamViewer* diff --git a/Sources/WAU/Winget-AutoUpdate/functions/Add-ScopeMachine.ps1 b/Sources/Winget-AutoUpdate/functions/Add-ScopeMachine.ps1 similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/functions/Add-ScopeMachine.ps1 rename to Sources/Winget-AutoUpdate/functions/Add-ScopeMachine.ps1 diff --git a/Sources/WAU/Winget-AutoUpdate/functions/Add-Shortcut.ps1 b/Sources/Winget-AutoUpdate/functions/Add-Shortcut.ps1 similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/functions/Add-Shortcut.ps1 rename to Sources/Winget-AutoUpdate/functions/Add-Shortcut.ps1 diff --git a/Sources/WAU/Winget-AutoUpdate/functions/Confirm-Installation.ps1 b/Sources/Winget-AutoUpdate/functions/Confirm-Installation.ps1 similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/functions/Confirm-Installation.ps1 rename to Sources/Winget-AutoUpdate/functions/Confirm-Installation.ps1 diff --git a/Sources/WAU/Winget-AutoUpdate/functions/Get-AZCopy.ps1 b/Sources/Winget-AutoUpdate/functions/Get-AZCopy.ps1 similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/functions/Get-AZCopy.ps1 rename to Sources/Winget-AutoUpdate/functions/Get-AZCopy.ps1 diff --git a/Sources/WAU/Winget-AutoUpdate/functions/Get-AppInfo.ps1 b/Sources/Winget-AutoUpdate/functions/Get-AppInfo.ps1 similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/functions/Get-AppInfo.ps1 rename to Sources/Winget-AutoUpdate/functions/Get-AppInfo.ps1 diff --git a/Sources/WAU/Winget-AutoUpdate/functions/Get-ExcludedApps.ps1 b/Sources/Winget-AutoUpdate/functions/Get-ExcludedApps.ps1 similarity index 95% rename from Sources/WAU/Winget-AutoUpdate/functions/Get-ExcludedApps.ps1 rename to Sources/Winget-AutoUpdate/functions/Get-ExcludedApps.ps1 index ce5811e..1a59e21 100644 --- a/Sources/WAU/Winget-AutoUpdate/functions/Get-ExcludedApps.ps1 +++ b/Sources/Winget-AutoUpdate/functions/Get-ExcludedApps.ps1 @@ -16,21 +16,21 @@ function Get-ExcludedApps { } - } + } #endregion blacklist in registry #region blacklist pulled from URI elseif ($URIList) { $RegPath = "$WAU_GPORoot"; $RegValueName = 'WAU_URIList'; - + if (Test-Path -Path $RegPath) { $RegKey = Get-Item -Path $RegPath; $WAUURI = $RegKey.GetValue($RegValueName); if ($null -ne $WAUURI) { $resp = Invoke-WebRequest -Uri $WAUURI -UseDefaultCredentials; if ($resp.BaseResponse.StatusCode -eq [System.Net.HttpStatusCode]::OK) { - $resp.Content.Split([System.Environment]::NewLine, [System.StringSplitOptions]::RemoveEmptyEntries) | + $resp.Content.Split([System.Environment]::NewLine, [System.StringSplitOptions]::RemoveEmptyEntries) | ForEach-Object { $AppIds += $_ } diff --git a/Sources/WAU/Winget-AutoUpdate/functions/Get-IncludedApps.ps1 b/Sources/Winget-AutoUpdate/functions/Get-IncludedApps.ps1 similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/functions/Get-IncludedApps.ps1 rename to Sources/Winget-AutoUpdate/functions/Get-IncludedApps.ps1 diff --git a/Sources/WAU/Winget-AutoUpdate/functions/Get-NotifLocale.ps1 b/Sources/Winget-AutoUpdate/functions/Get-NotifLocale.ps1 similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/functions/Get-NotifLocale.ps1 rename to Sources/Winget-AutoUpdate/functions/Get-NotifLocale.ps1 diff --git a/Sources/WAU/Winget-AutoUpdate/functions/Get-WAUAvailableVersion.ps1 b/Sources/Winget-AutoUpdate/functions/Get-WAUAvailableVersion.ps1 similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/functions/Get-WAUAvailableVersion.ps1 rename to Sources/Winget-AutoUpdate/functions/Get-WAUAvailableVersion.ps1 diff --git a/Sources/WAU/Winget-AutoUpdate/functions/Get-WAUConfig.ps1 b/Sources/Winget-AutoUpdate/functions/Get-WAUConfig.ps1 similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/functions/Get-WAUConfig.ps1 rename to Sources/Winget-AutoUpdate/functions/Get-WAUConfig.ps1 diff --git a/Sources/WAU/Winget-AutoUpdate/functions/Get-WingetCmd.ps1 b/Sources/Winget-AutoUpdate/functions/Get-WingetCmd.ps1 similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/functions/Get-WingetCmd.ps1 rename to Sources/Winget-AutoUpdate/functions/Get-WingetCmd.ps1 diff --git a/Sources/WAU/Winget-AutoUpdate/functions/Get-WingetOutdatedApps.ps1 b/Sources/Winget-AutoUpdate/functions/Get-WingetOutdatedApps.ps1 similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/functions/Get-WingetOutdatedApps.ps1 rename to Sources/Winget-AutoUpdate/functions/Get-WingetOutdatedApps.ps1 diff --git a/Sources/WAU/Winget-AutoUpdate/functions/Get-WingetSystemApps.ps1 b/Sources/Winget-AutoUpdate/functions/Get-WingetSystemApps.ps1 similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/functions/Get-WingetSystemApps.ps1 rename to Sources/Winget-AutoUpdate/functions/Get-WingetSystemApps.ps1 diff --git a/Sources/WAU/Winget-AutoUpdate/functions/Install-Prerequisites.ps1 b/Sources/Winget-AutoUpdate/functions/Install-Prerequisites.ps1 similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/functions/Install-Prerequisites.ps1 rename to Sources/Winget-AutoUpdate/functions/Install-Prerequisites.ps1 diff --git a/Sources/WAU/Winget-AutoUpdate/functions/Invoke-DirProtect.ps1 b/Sources/Winget-AutoUpdate/functions/Invoke-DirProtect.ps1 similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/functions/Invoke-DirProtect.ps1 rename to Sources/Winget-AutoUpdate/functions/Invoke-DirProtect.ps1 diff --git a/Sources/WAU/Winget-AutoUpdate/functions/Invoke-LogRotation.ps1 b/Sources/Winget-AutoUpdate/functions/Invoke-LogRotation.ps1 similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/functions/Invoke-LogRotation.ps1 rename to Sources/Winget-AutoUpdate/functions/Invoke-LogRotation.ps1 diff --git a/Sources/WAU/Winget-AutoUpdate/functions/Invoke-PostUpdateActions.ps1 b/Sources/Winget-AutoUpdate/functions/Invoke-PostUpdateActions.ps1 similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/functions/Invoke-PostUpdateActions.ps1 rename to Sources/Winget-AutoUpdate/functions/Invoke-PostUpdateActions.ps1 diff --git a/Sources/WAU/Winget-AutoUpdate/functions/Start-NotifTask.ps1 b/Sources/Winget-AutoUpdate/functions/Start-NotifTask.ps1 similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/functions/Start-NotifTask.ps1 rename to Sources/Winget-AutoUpdate/functions/Start-NotifTask.ps1 diff --git a/Sources/WAU/Winget-AutoUpdate/functions/Test-ListPath.ps1 b/Sources/Winget-AutoUpdate/functions/Test-ListPath.ps1 similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/functions/Test-ListPath.ps1 rename to Sources/Winget-AutoUpdate/functions/Test-ListPath.ps1 diff --git a/Sources/WAU/Winget-AutoUpdate/functions/Test-Mods.ps1 b/Sources/Winget-AutoUpdate/functions/Test-Mods.ps1 similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/functions/Test-Mods.ps1 rename to Sources/Winget-AutoUpdate/functions/Test-Mods.ps1 diff --git a/Sources/WAU/Winget-AutoUpdate/functions/Test-ModsPath.ps1 b/Sources/Winget-AutoUpdate/functions/Test-ModsPath.ps1 similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/functions/Test-ModsPath.ps1 rename to Sources/Winget-AutoUpdate/functions/Test-ModsPath.ps1 diff --git a/Sources/WAU/Winget-AutoUpdate/functions/Test-Network.ps1 b/Sources/Winget-AutoUpdate/functions/Test-Network.ps1 similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/functions/Test-Network.ps1 rename to Sources/Winget-AutoUpdate/functions/Test-Network.ps1 diff --git a/Sources/WAU/Winget-AutoUpdate/functions/Test-PendingReboot.ps1 b/Sources/Winget-AutoUpdate/functions/Test-PendingReboot.ps1 similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/functions/Test-PendingReboot.ps1 rename to Sources/Winget-AutoUpdate/functions/Test-PendingReboot.ps1 diff --git a/Sources/WAU/Winget-AutoUpdate/functions/Update-App.ps1 b/Sources/Winget-AutoUpdate/functions/Update-App.ps1 similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/functions/Update-App.ps1 rename to Sources/Winget-AutoUpdate/functions/Update-App.ps1 diff --git a/Sources/WAU/Winget-AutoUpdate/functions/Update-StoreApps.ps1 b/Sources/Winget-AutoUpdate/functions/Update-StoreApps.ps1 similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/functions/Update-StoreApps.ps1 rename to Sources/Winget-AutoUpdate/functions/Update-StoreApps.ps1 diff --git a/Sources/WAU/Winget-AutoUpdate/functions/Update-WAU.ps1 b/Sources/Winget-AutoUpdate/functions/Update-WAU.ps1 similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/functions/Update-WAU.ps1 rename to Sources/Winget-AutoUpdate/functions/Update-WAU.ps1 diff --git a/Sources/WAU/Winget-AutoUpdate/functions/Update-WinGet.ps1 b/Sources/Winget-AutoUpdate/functions/Update-WinGet.ps1 similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/functions/Update-WinGet.ps1 rename to Sources/Winget-AutoUpdate/functions/Update-WinGet.ps1 diff --git a/Sources/WAU/Winget-AutoUpdate/functions/Write-CMTraceLog.ps1 b/Sources/Winget-AutoUpdate/functions/Write-CMTraceLog.ps1 similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/functions/Write-CMTraceLog.ps1 rename to Sources/Winget-AutoUpdate/functions/Write-CMTraceLog.ps1 diff --git a/Sources/WAU/Winget-AutoUpdate/functions/Write-ToLog.ps1 b/Sources/Winget-AutoUpdate/functions/Write-ToLog.ps1 similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/functions/Write-ToLog.ps1 rename to Sources/Winget-AutoUpdate/functions/Write-ToLog.ps1 diff --git a/Sources/WAU/Winget-AutoUpdate/icons/error.png b/Sources/Winget-AutoUpdate/icons/error.png similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/icons/error.png rename to Sources/Winget-AutoUpdate/icons/error.png diff --git a/Sources/WAU/Winget-AutoUpdate/icons/info.png b/Sources/Winget-AutoUpdate/icons/info.png similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/icons/info.png rename to Sources/Winget-AutoUpdate/icons/info.png diff --git a/Sources/WAU/Winget-AutoUpdate/icons/success.png b/Sources/Winget-AutoUpdate/icons/success.png similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/icons/success.png rename to Sources/Winget-AutoUpdate/icons/success.png diff --git a/Sources/WAU/Winget-AutoUpdate/icons/warning.png b/Sources/Winget-AutoUpdate/icons/warning.png similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/icons/warning.png rename to Sources/Winget-AutoUpdate/icons/warning.png diff --git a/Sources/WAU/Winget-AutoUpdate/locale/cz.xml b/Sources/Winget-AutoUpdate/locale/cz.xml similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/locale/cz.xml rename to Sources/Winget-AutoUpdate/locale/cz.xml diff --git a/Sources/WAU/Winget-AutoUpdate/locale/de.xml b/Sources/Winget-AutoUpdate/locale/de.xml similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/locale/de.xml rename to Sources/Winget-AutoUpdate/locale/de.xml diff --git a/Sources/WAU/Winget-AutoUpdate/locale/en.xml b/Sources/Winget-AutoUpdate/locale/en.xml similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/locale/en.xml rename to Sources/Winget-AutoUpdate/locale/en.xml diff --git a/Sources/WAU/Winget-AutoUpdate/locale/es.xml b/Sources/Winget-AutoUpdate/locale/es.xml similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/locale/es.xml rename to Sources/Winget-AutoUpdate/locale/es.xml diff --git a/Sources/WAU/Winget-AutoUpdate/locale/fi.xml b/Sources/Winget-AutoUpdate/locale/fi.xml similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/locale/fi.xml rename to Sources/Winget-AutoUpdate/locale/fi.xml diff --git a/Sources/WAU/Winget-AutoUpdate/locale/fr.xml b/Sources/Winget-AutoUpdate/locale/fr.xml similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/locale/fr.xml rename to Sources/Winget-AutoUpdate/locale/fr.xml diff --git a/Sources/WAU/Winget-AutoUpdate/locale/hu.xml b/Sources/Winget-AutoUpdate/locale/hu.xml similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/locale/hu.xml rename to Sources/Winget-AutoUpdate/locale/hu.xml diff --git a/Sources/WAU/Winget-AutoUpdate/locale/it.xml b/Sources/Winget-AutoUpdate/locale/it.xml similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/locale/it.xml rename to Sources/Winget-AutoUpdate/locale/it.xml diff --git a/Sources/WAU/Winget-AutoUpdate/locale/nb.xml b/Sources/Winget-AutoUpdate/locale/nb.xml similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/locale/nb.xml rename to Sources/Winget-AutoUpdate/locale/nb.xml diff --git a/Sources/WAU/Winget-AutoUpdate/locale/nl.xml b/Sources/Winget-AutoUpdate/locale/nl.xml similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/locale/nl.xml rename to Sources/Winget-AutoUpdate/locale/nl.xml diff --git a/Sources/WAU/Winget-AutoUpdate/locale/pl.xml b/Sources/Winget-AutoUpdate/locale/pl.xml similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/locale/pl.xml rename to Sources/Winget-AutoUpdate/locale/pl.xml diff --git a/Sources/WAU/Winget-AutoUpdate/locale/pt.xml b/Sources/Winget-AutoUpdate/locale/pt.xml similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/locale/pt.xml rename to Sources/Winget-AutoUpdate/locale/pt.xml diff --git a/Sources/WAU/Winget-AutoUpdate/locale/ru.xml b/Sources/Winget-AutoUpdate/locale/ru.xml similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/locale/ru.xml rename to Sources/Winget-AutoUpdate/locale/ru.xml diff --git a/Sources/WAU/Winget-AutoUpdate/locale/sv.xml b/Sources/Winget-AutoUpdate/locale/sv.xml similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/locale/sv.xml rename to Sources/Winget-AutoUpdate/locale/sv.xml diff --git a/Sources/WAU/Winget-AutoUpdate/locale/uk.xml b/Sources/Winget-AutoUpdate/locale/uk.xml similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/locale/uk.xml rename to Sources/Winget-AutoUpdate/locale/uk.xml diff --git a/Sources/WAU/Winget-AutoUpdate/locale/zh-CHS.xml b/Sources/Winget-AutoUpdate/locale/zh-CHS.xml similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/locale/zh-CHS.xml rename to Sources/Winget-AutoUpdate/locale/zh-CHS.xml diff --git a/Sources/WAU/Winget-AutoUpdate/locale/zh-CHT.xml b/Sources/Winget-AutoUpdate/locale/zh-CHT.xml similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/locale/zh-CHT.xml rename to Sources/Winget-AutoUpdate/locale/zh-CHT.xml diff --git a/Sources/WAU/Winget-AutoUpdate/mods/README.md b/Sources/Winget-AutoUpdate/mods/README.md similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/mods/README.md rename to Sources/Winget-AutoUpdate/mods/README.md diff --git a/Sources/WAU/Winget-AutoUpdate/mods/_AppID-template.ps1 b/Sources/Winget-AutoUpdate/mods/_AppID-template.ps1 similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/mods/_AppID-template.ps1 rename to Sources/Winget-AutoUpdate/mods/_AppID-template.ps1 diff --git a/Sources/WAU/Winget-AutoUpdate/mods/_Mods-Functions.ps1 b/Sources/Winget-AutoUpdate/mods/_Mods-Functions.ps1 similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/mods/_Mods-Functions.ps1 rename to Sources/Winget-AutoUpdate/mods/_Mods-Functions.ps1 diff --git a/Sources/WAU/Winget-AutoUpdate/mods/_WAU-mods-template.ps1 b/Sources/Winget-AutoUpdate/mods/_WAU-mods-template.ps1 similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/mods/_WAU-mods-template.ps1 rename to Sources/Winget-AutoUpdate/mods/_WAU-mods-template.ps1 diff --git a/Sources/WAU/Winget-AutoUpdate/mods/_WAU-notinstalled-template.ps1 b/Sources/Winget-AutoUpdate/mods/_WAU-notinstalled-template.ps1 similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/mods/_WAU-notinstalled-template.ps1 rename to Sources/Winget-AutoUpdate/mods/_WAU-notinstalled-template.ps1 diff --git a/Sources/WAU/Winget-AutoUpdate/mods/bins/README.md b/Sources/Winget-AutoUpdate/mods/bins/README.md similarity index 100% rename from Sources/WAU/Winget-AutoUpdate/mods/bins/README.md rename to Sources/Winget-AutoUpdate/mods/bins/README.md From 8c0c94cc4e6b82abb870c19e6826b66c4dc24587 Mon Sep 17 00:00:00 2001 From: Romain <96626929+Romanitho@users.noreply.github.com> Date: Sun, 1 Sep 2024 15:13:47 +0200 Subject: [PATCH 2/7] using a default blacklist instead --- .../functions/Get-ExcludedApps.ps1 | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/Sources/Winget-AutoUpdate/functions/Get-ExcludedApps.ps1 b/Sources/Winget-AutoUpdate/functions/Get-ExcludedApps.ps1 index 1a59e21..bd5deed 100644 --- a/Sources/Winget-AutoUpdate/functions/Get-ExcludedApps.ps1 +++ b/Sources/Winget-AutoUpdate/functions/Get-ExcludedApps.ps1 @@ -4,21 +4,20 @@ function Get-ExcludedApps { $AppIDs = @() - #region blacklist in registry + #blacklist in registry if ($GPOList) { + Write-ToLog "-> Excluded apps from GPO is activated" if (Test-Path "HKLM:\SOFTWARE\Policies\Romanitho\Winget-AutoUpdate\BlackList") { $ValueNames = (Get-Item -Path "HKLM:\SOFTWARE\Policies\Romanitho\Winget-AutoUpdate\BlackList").Property - foreach ($ValueName in $ValueNames) { $AppIDs += (Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Policies\Romanitho\Winget-AutoUpdate\BlackList" -Name $ValueName).Trim() } - + Write-ToLog "-> Successsfully loaded excluded apps list." } } - #endregion blacklist in registry - #region blacklist pulled from URI + #blacklist pulled from URI elseif ($URIList) { $RegPath = "$WAU_GPORoot"; @@ -27,6 +26,7 @@ function Get-ExcludedApps { if (Test-Path -Path $RegPath) { $RegKey = Get-Item -Path $RegPath; $WAUURI = $RegKey.GetValue($RegValueName); + Write-ToLog "-> Excluded apps from URI is activated" if ($null -ne $WAUURI) { $resp = Invoke-WebRequest -Uri $WAUURI -UseDefaultCredentials; if ($resp.BaseResponse.StatusCode -eq [System.Net.HttpStatusCode]::OK) { @@ -34,17 +34,26 @@ function Get-ExcludedApps { ForEach-Object { $AppIds += $_ } + Write-ToLog "-> Successsfully loaded excluded apps list." } } } } - #endregion blacklist pulled from URI + #blacklist pulled from local file elseif (Test-Path "$WorkingDir\excluded_apps.txt") { - return (Get-Content -Path "$WorkingDir\excluded_apps.txt").Trim() | Where-Object { $_.length -gt 0 } + $AppIDs = (Get-Content -Path "$WorkingDir\excluded_apps.txt").Trim() | Where-Object { $_.length -gt 0 } + Write-ToLog "-> Successsfully loaded local excluded apps list." + + } + #blacklist pulled from default file + elseif (Test-Path "$WorkingDir\config\default_excluded_apps.txt") { + + $AppIDs = (Get-Content -Path "$WorkingDir\config\default_excluded_apps.txt").Trim() | Where-Object { $_.length -gt 0 } + Write-ToLog "-> Successsfully loaded default excluded apps list." } return $AppIDs | Where-Object { $_.length -gt 0 } -} +} \ No newline at end of file From 8a41e74df4b9751417c2d151a895b2f6d16eb25c Mon Sep 17 00:00:00 2001 From: Romain <96626929+Romanitho@users.noreply.github.com> Date: Sun, 1 Sep 2024 15:40:49 +0200 Subject: [PATCH 3/7] Changed shortcut to bat (no admin rights needed) --- .github/workflows/WAU-AutoCreatePreVersion.yml | 6 +++--- .github/workflows/WAU-CreateNewVersion.yml | 14 +++++++------- ...AU Configurator.ps1 => WAU Configurator.bat} | 17 ++++++++++++----- 3 files changed, 22 insertions(+), 15 deletions(-) rename Sources/{WAU Configurator.ps1 => WAU Configurator.bat} (97%) diff --git a/.github/workflows/WAU-AutoCreatePreVersion.yml b/.github/workflows/WAU-AutoCreatePreVersion.yml index b5d77d2..1037696 100644 --- a/.github/workflows/WAU-AutoCreatePreVersion.yml +++ b/.github/workflows/WAU-AutoCreatePreVersion.yml @@ -68,7 +68,7 @@ jobs: - name: Overwrite Version.txt file uses: DamianReeves/write-file-action@6929a9a6d1807689191dcc8bbe62b54d70a32b42 # v1.3 with: - path: Sources/WAU/Winget-AutoUpdate/Version.txt + path: Sources/Winget-AutoUpdate/Version.txt write-mode: overwrite contents: ${{ steps.versioning.outputs.version }} @@ -88,8 +88,8 @@ jobs: echo "### Extract MSI ###" 7z x MicrosoftDeploymentToolkit_x64.msi - echo "### Copy ServiceUI.exe to 'Sources/WAU/Winget-AutoUpdate' folder ###" - mv Modena_File206 Sources/WAU/Winget-AutoUpdate/ServiceUI.exe -v + echo "### Copy ServiceUI.exe to 'Sources/Winget-AutoUpdate' folder ###" + mv Modena_File206 Sources/Winget-AutoUpdate/ServiceUI.exe -v echo "### Go to Sources ###" cd Sources diff --git a/.github/workflows/WAU-CreateNewVersion.yml b/.github/workflows/WAU-CreateNewVersion.yml index d829715..12801be 100644 --- a/.github/workflows/WAU-CreateNewVersion.yml +++ b/.github/workflows/WAU-CreateNewVersion.yml @@ -31,7 +31,7 @@ jobs: lfs: "true" - name: Auto Increment Semver Action - uses: MCKanpolat/auto-semver-action@5003b8d37f4b03d95f15303ea10242cbf7c13141 # 2 + uses: MCKanpolat/auto-semver-action@5003b8d37f4b03d95f15303ea10242cbf7c13141 # 2 id: versioning with: releaseType: ${{ github.event.inputs.version }} @@ -39,14 +39,14 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} - name: Overwrite Version.txt file - uses: DamianReeves/write-file-action@6929a9a6d1807689191dcc8bbe62b54d70a32b42 # v1.3 + uses: DamianReeves/write-file-action@6929a9a6d1807689191dcc8bbe62b54d70a32b42 # v1.3 with: - path: Sources/WAU/Winget-AutoUpdate/Version.txt + path: Sources/Winget-AutoUpdate/Version.txt write-mode: overwrite contents: "${{ steps.versioning.outputs.version }}" - name: Commit & Push - uses: actions-js/push@5a7cbd780d82c0c937b5977586e641b2fd94acc5 # v1.5 + uses: actions-js/push@5a7cbd780d82c0c937b5977586e641b2fd94acc5 # v1.5 with: github_token: ${{ secrets.GITHUB_TOKEN }} branch: main @@ -61,8 +61,8 @@ jobs: echo "### Extract MSI ###" 7z x MicrosoftDeploymentToolkit_x64.msi - echo "### Copy ServiceUI.exe to 'Sources/WAU/Winget-AutoUpdate' folder ###" - mv Modena_File206 Sources/WAU/Winget-AutoUpdate/ServiceUI.exe -v + echo "### Copy ServiceUI.exe to 'Sources/Winget-AutoUpdate' folder ###" + mv Modena_File206 Sources/Winget-AutoUpdate/ServiceUI.exe -v echo "### Go to Sources ###" cd Sources @@ -87,7 +87,7 @@ jobs: echo "Install counter file." > WAU_InstallCounter - name: Create release - uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0 + uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0 with: tag: "v${{ steps.versioning.outputs.version }}" prerelease: ${{ github.event.inputs.pre-release }} diff --git a/Sources/WAU Configurator.ps1 b/Sources/WAU Configurator.bat similarity index 97% rename from Sources/WAU Configurator.ps1 rename to Sources/WAU Configurator.bat index a521f2a..fe86b2c 100644 --- a/Sources/WAU Configurator.ps1 +++ b/Sources/WAU Configurator.bat @@ -1,3 +1,10 @@ +@@:: This prolog allows a PowerShell script to be embedded in a .CMD file. +@@:: Any non-PowerShell content must be preceeded by "@@" +@@setlocal +@@set POWERSHELL_BAT_ARGS=%* +@@if defined POWERSHELL_BAT_ARGS set POWERSHELL_BAT_ARGS=%POWERSHELL_BAT_ARGS:"=\"% +@@PowerShell -NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass -Command Invoke-Expression $('$args=@(^&{$args} %POWERSHELL_BAT_ARGS%);'+[String]::Join([char]10,$((Get-Content '%~f0') -notmatch '^^@@'))) & goto :EOF + <# .SYNOPSIS Install and configure Winget-AutoUpdate @@ -21,7 +28,7 @@ if ( $psversionTable.PSEdition -eq "core" ) { import-Module -name Appx -UseWIndowsPowershell -WarningAction:SilentlyContinue } -$Script:WAUConfiguratorVersion = Get-Content "$PSScriptRoot\Winget-AutoUpdate\Version.txt" +$Script:WAUConfiguratorVersion = Get-Content ".\Winget-AutoUpdate\Version.txt" <# FUNCTIONS #> @@ -176,12 +183,12 @@ function Start-Installations { if ($WAUUseWhiteList) { $WAUParameters += "-UseWhiteList " if ($WAUListPath) { - Copy-Item $WAUListPath -Destination "$PSScriptRoot\included_apps.txt" -Force -ErrorAction SilentlyContinue + Copy-Item $WAUListPath -Destination ".\included_apps.txt" -Force -ErrorAction SilentlyContinue } } else { if ($WAUListPath) { - Copy-Item $WAUListPath -Destination "$PSScriptRoot\excluded_apps.txt" -Force -ErrorAction SilentlyContinue + Copy-Item $WAUListPath -Destination ".\excluded_apps.txt" -Force -ErrorAction SilentlyContinue } } if ($WAUDesktopShortcut) { @@ -195,7 +202,7 @@ function Start-Installations { } #Install Winget-Autoupdate - Start-Process "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -Command ""& '$PSScriptRoot\Winget-AutoUpdate-Install.ps1' $WAUParameters""" -Wait -Verb RunAs + Start-Process "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -Command ""& '.\Winget-AutoUpdate-Install.ps1' $WAUParameters""" -Wait -Verb RunAs } @@ -268,7 +275,7 @@ function Start-Uninstallations ($AppToUninstall) { #Run Winget-Install -Uninstall $AppsToUninstall = "'$($AppToUninstall -join "','")'" - Start-Process "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -Command `"$PSScriptRoot\Winget-AutoUpdate\Winget-Install.ps1 -AppIDs $AppsToUninstall -Uninstall`"" -Wait -Verb RunAs + Start-Process "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -Command `".\Winget-AutoUpdate\Winget-Install.ps1 -AppIDs $AppsToUninstall -Uninstall`"" -Wait -Verb RunAs Close-PopUp } From 513b45995567de7db5d226bc35b4f40766d57e38 Mon Sep 17 00:00:00 2001 From: Romain <96626929+Romanitho@users.noreply.github.com> Date: Sun, 1 Sep 2024 15:44:58 +0200 Subject: [PATCH 4/7] $PSScriptRoot --- Sources/WAU Configurator.bat | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Sources/WAU Configurator.bat b/Sources/WAU Configurator.bat index fe86b2c..4097b76 100644 --- a/Sources/WAU Configurator.bat +++ b/Sources/WAU Configurator.bat @@ -28,7 +28,7 @@ if ( $psversionTable.PSEdition -eq "core" ) { import-Module -name Appx -UseWIndowsPowershell -WarningAction:SilentlyContinue } -$Script:WAUConfiguratorVersion = Get-Content ".\Winget-AutoUpdate\Version.txt" +$Script:WAUConfiguratorVersion = Get-Content "$PSScriptRoot\Winget-AutoUpdate\Version.txt" <# FUNCTIONS #> @@ -183,12 +183,12 @@ function Start-Installations { if ($WAUUseWhiteList) { $WAUParameters += "-UseWhiteList " if ($WAUListPath) { - Copy-Item $WAUListPath -Destination ".\included_apps.txt" -Force -ErrorAction SilentlyContinue + Copy-Item $WAUListPath -Destination "$PSScriptRoot\included_apps.txt" -Force -ErrorAction SilentlyContinue } } else { if ($WAUListPath) { - Copy-Item $WAUListPath -Destination ".\excluded_apps.txt" -Force -ErrorAction SilentlyContinue + Copy-Item $WAUListPath -Destination "$PSScriptRoot\excluded_apps.txt" -Force -ErrorAction SilentlyContinue } } if ($WAUDesktopShortcut) { @@ -202,7 +202,7 @@ function Start-Installations { } #Install Winget-Autoupdate - Start-Process "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -Command ""& '.\Winget-AutoUpdate-Install.ps1' $WAUParameters""" -Wait -Verb RunAs + Start-Process "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -Command ""& '$PSScriptRoot\Winget-AutoUpdate-Install.ps1' $WAUParameters""" -Wait -Verb RunAs } @@ -275,7 +275,7 @@ function Start-Uninstallations ($AppToUninstall) { #Run Winget-Install -Uninstall $AppsToUninstall = "'$($AppToUninstall -join "','")'" - Start-Process "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -Command `".\Winget-AutoUpdate\Winget-Install.ps1 -AppIDs $AppsToUninstall -Uninstall`"" -Wait -Verb RunAs + Start-Process "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -Command `"$PSScriptRoot\Winget-AutoUpdate\Winget-Install.ps1 -AppIDs $AppsToUninstall -Uninstall`"" -Wait -Verb RunAs Close-PopUp } From 8379e72f868790dac8a5d17bbc5bcf8d484a5911 Mon Sep 17 00:00:00 2001 From: Romain <96626929+Romanitho@users.noreply.github.com> Date: Sun, 1 Sep 2024 15:54:36 +0200 Subject: [PATCH 5/7] clean --- .../functions/Get-ExcludedApps.ps1 | 6 ++--- .../functions/Get-IncludedApps.ps1 | 22 ++++++++++--------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Sources/Winget-AutoUpdate/functions/Get-ExcludedApps.ps1 b/Sources/Winget-AutoUpdate/functions/Get-ExcludedApps.ps1 index bd5deed..a81ceda 100644 --- a/Sources/Winget-AutoUpdate/functions/Get-ExcludedApps.ps1 +++ b/Sources/Winget-AutoUpdate/functions/Get-ExcludedApps.ps1 @@ -43,17 +43,17 @@ function Get-ExcludedApps { #blacklist pulled from local file elseif (Test-Path "$WorkingDir\excluded_apps.txt") { - $AppIDs = (Get-Content -Path "$WorkingDir\excluded_apps.txt").Trim() | Where-Object { $_.length -gt 0 } + $AppIDs = (Get-Content -Path "$WorkingDir\excluded_apps.txt").Trim() Write-ToLog "-> Successsfully loaded local excluded apps list." } #blacklist pulled from default file elseif (Test-Path "$WorkingDir\config\default_excluded_apps.txt") { - $AppIDs = (Get-Content -Path "$WorkingDir\config\default_excluded_apps.txt").Trim() | Where-Object { $_.length -gt 0 } + $AppIDs = (Get-Content -Path "$WorkingDir\config\default_excluded_apps.txt").Trim() Write-ToLog "-> Successsfully loaded default excluded apps list." } return $AppIDs | Where-Object { $_.length -gt 0 } -} \ No newline at end of file +} diff --git a/Sources/Winget-AutoUpdate/functions/Get-IncludedApps.ps1 b/Sources/Winget-AutoUpdate/functions/Get-IncludedApps.ps1 index 950cede..2474edd 100644 --- a/Sources/Winget-AutoUpdate/functions/Get-IncludedApps.ps1 +++ b/Sources/Winget-AutoUpdate/functions/Get-IncludedApps.ps1 @@ -3,45 +3,47 @@ function Get-IncludedApps { $AppIDs = @() - #region whitelist in registry + #whitelist in registry if ($GPOList) { + Write-ToLog "-> Included apps from GPO is activated" if (Test-Path "HKLM:\SOFTWARE\Policies\Romanitho\Winget-AutoUpdate\WhiteList") { $ValueNames = (Get-Item -Path "HKLM:\SOFTWARE\Policies\Romanitho\Winget-AutoUpdate\WhiteList").Property - foreach ($ValueName in $ValueNames) { $AppIDs += (Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Policies\Romanitho\Winget-AutoUpdate\WhiteList" -Name $ValueName).Trim() } - + Write-ToLog "-> Successsfully loaded included apps list." } - } - #endregion whitelist in registry - #region whitelist pulled from URI + } + #whitelist pulled from URI elseif ($URIList) { $RegPath = "$WAU_GPORoot"; $RegValueName = 'WAU_URIList'; - + if (Test-Path -Path $RegPath) { $RegKey = Get-Item -Path $RegPath; $WAUURI = $RegKey.GetValue($RegValueName); + Write-ToLog "-> Included apps from URI is activated" if ($null -ne $WAUURI) { $resp = Invoke-WebRequest -Uri $WAUURI -UseDefaultCredentials; if ($resp.BaseResponse.StatusCode -eq [System.Net.HttpStatusCode]::OK) { - $resp.Content.Split([System.Environment]::NewLine, [System.StringSplitOptions]::RemoveEmptyEntries) | + $resp.Content.Split([System.Environment]::NewLine, [System.StringSplitOptions]::RemoveEmptyEntries) | ForEach-Object { $AppIds += $_ } + Write-ToLog "-> Successsfully loaded included apps list." } } } } - #endregion whitelist pulled from URI + #whitelist pulled from local file elseif (Test-Path "$WorkingDir\included_apps.txt") { - return (Get-Content -Path "$WorkingDir\included_apps.txt").Trim() | Where-Object { $_.length -gt 0 } + $AppIDs = (Get-Content -Path "$WorkingDir\included_apps.txt").Trim() + Write-ToLog "-> Successsfully loaded local included apps list." } From 606aa3e6e1142bb1e40d409adcd8a7a4689c2320 Mon Sep 17 00:00:00 2001 From: Romain <96626929+Romanitho@users.noreply.github.com> Date: Sun, 1 Sep 2024 16:04:58 +0200 Subject: [PATCH 6/7] fix powershell tests --- .github/workflows/powershell-tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/powershell-tests.yaml b/.github/workflows/powershell-tests.yaml index a8e19ce..e30850d 100644 --- a/.github/workflows/powershell-tests.yaml +++ b/.github/workflows/powershell-tests.yaml @@ -21,7 +21,7 @@ jobs: - name: Perform a Pester test for the WAU installation shell: powershell run: | - $command = New-PesterContainer -Path Sources/WAU/Winget-AutoUpdate-Install.ps1 -Data @{ Silent = $true } + $command = New-PesterContainer -Path Sources/Winget-AutoUpdate-Install.ps1 -Data @{ Silent = $true } Invoke-Pester -PassThru -Container $command -ErrorAction Continue - name: Perform a Pester test for WAU run shell: powershell From 4c9eb00d36ca4464b227f06ff84f1efa8237de33 Mon Sep 17 00:00:00 2001 From: Romain <96626929+Romanitho@users.noreply.github.com> Date: Sun, 1 Sep 2024 16:05:46 +0200 Subject: [PATCH 7/7] Delete CMTraceLog that can be false positive --- .../functions/Write-CMTraceLog.ps1 | 319 ------------------ 1 file changed, 319 deletions(-) delete mode 100644 Sources/Winget-AutoUpdate/functions/Write-CMTraceLog.ps1 diff --git a/Sources/Winget-AutoUpdate/functions/Write-CMTraceLog.ps1 b/Sources/Winget-AutoUpdate/functions/Write-CMTraceLog.ps1 deleted file mode 100644 index 62d815a..0000000 --- a/Sources/Winget-AutoUpdate/functions/Write-CMTraceLog.ps1 +++ /dev/null @@ -1,319 +0,0 @@ -# Obtain UTC offset (think about moving it to the parent method) - $DateTime = New-Object -ComObject 'WbemScripting.SWbemDateTime'; - $DateTime.SetVarDate($(Get-Date)); - $UtcValue = $DateTime.Value; - $global:CMTraceLog_UtcOffset = $UtcValue.Substring(21, $UtcValue.Length - 21); - [System.Runtime.InteropServices.Marshal]::ReleaseComObject($DateTime) | Out-Null; - -# Set context of process which writes a message - $global:CMTraceLog_Context = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name; - -# set string templates for formatting later -[string]$global:logline_part1_template_nonerror = ""; -[string]$global:logline_part1_template_error = ""; -[string]$global:logline_part2_template = ""; - -# (full help at the end of file) - -enum CMTraceLogSeverity -{ - Warning = 2 - Error = 3 - Verbose = 4 - Debug = 5 - Information = 6 -} - -Function Write-CMTraceLog -{ - # Define and validate parameters - [CmdletBinding()] - Param( - - #Path to the log file - [parameter(Mandatory=$False)] - [String]$Logfile = "$Script:WorkingDir\logs\updates.log", - - #The information to log - [parameter(Mandatory=$True)] - $Message, - - #The severity (Error, Warning, Verbose, Debug, Information) - [parameter(Mandatory=$True)] - [ValidateSet('Warning','Error','Verbose','Debug', 'Information', IgnoreCase=$True)] - [String]$Type, - - #Write back to the console or just to the log file. By default it will write back to the host. - [parameter(Mandatory=$False)] - [switch]$WriteBackToHost = $False - - )#Param - - # Get the info about the calling script, function etc - $callinginfo = (Get-PSCallStack)[1]; - - # Set Source Information - $Source = (Get-PSCallStack)[1].Location; - - # Set Component Information - $Component = (Get-Process -Id $PID).ProcessName; - - # Set PID Information - $ProcessID = $PID; - - # Set date/time of message - $dt = Get-Date; - [string]$time = [string]::Format("{0:HH:mm:ss.fff}", $dt); - [string]$date = [string]::Format("{0:MM-dd-yyyy}", $dt); - - # Set the order - <# - switch($Type) - { - 'Warning' {$Severity = 2;} #Warning - 'Error' {$Severity = 3;} #Error - 'Verbose' {$Severity = 4;} #Verbose - 'Debug' {$Severity = 5;} #Debug - 'Information' {$Severity = 6;} #Information - } - #> - $severity = [int]([CMTraceLogSeverity]::$Type); - - #region set the 1st part of logged entry (templates for formatting) - if($Type -eq 'Error') - { - if($Message.exception.Message) - { - # cool! we have an exception, we can use it - } - else - { - # we do not have an exception, we need to prepare out own custom error to use later - [System.Exception]$Exception = $Message; - [String]$ErrorID = 'Custom Error'; - [System.Management.Automation.ErrorCategory]$ErrorCategory = [Management.Automation.ErrorCategory]::WriteError; - $ErrorRecord = [System.Management.Automation.ErrorRecord]::new($Exception, $ErrorID, $ErrorCategory, $Message); - $Message = $ErrorRecord; - } - [string]$logline_part1 = [string]::Format( - $global:logline_part1_template_error, - $Type.ToUpper(), - $Message.exception.message, - $Message.InvocationInfo.MyCommand, - $Message.InvocationInfo.ScriptName, - $Message.InvocationInfo.ScriptLineNumber, - $Message.InvocationInfo.OffsetInLine, - $Message.InvocationInfo.Line - ); - } - else - { - [string]$logline_part1 = [string]::Format($global:logline_part1_template_nonerror, $Type.ToUpper(), $message); - } - #endregion set the 1st part of logged entry (templates for formatting) - - #region set the 2nd part of logged entry - [string]$logline_part2 = [string]::Format( - $global:logline_part2_template, - $time, - $global:CMTraceLog_UtcOffset, - $date, - $Component, - $global:CMTraceLog_Context, - $Severity, - $ProcessID, - $Source - ); - #endregion set the 2nd part of logged entry - - #region Switch statement to write out to the log and/or back to the host. - - # Write the log entry in the CMTrace Format. - $logline = $logline_part1 + $logline_part2; - $logline | Out-File -Append -Encoding utf8 -FilePath $Logfile; - - switch ($severity) - { - #region Warning - 2{ - #Write back to the host if $Writebacktohost is true. - if(($WriteBackToHost)) - { - Switch($PSCmdlet.GetVariableValue('WarningPreference')){ - 'Continue' {$WarningPreference = 'Continue';Write-Warning -Message "$Message";$WarningPreference=''} - 'Stop' {$WarningPreference = 'Stop';Write-Warning -Message "$Message";$WarningPreference=''} - 'Inquire' {$WarningPreference ='Inquire';Write-Warning -Message "$Message";$WarningPreference=''} - 'SilentlyContinue' {} - } - } - } - #endregion Warning - - #region Error - 3{ - #This if statement is to catch the two different types of errors that may come through. A normal terminating exception will have all the information that is needed, if it's a user generated error by using Write-Error, - #then the else statement will setup all the information we would like to log. - - #Write back to the host if $Writebacktohost is true. - if(($WriteBackToHost)) - { - #Write back to Host - Switch($PSCmdlet.GetVariableValue('ErrorActionPreference')) - { - 'Stop'{$ErrorActionPreference = 'Stop';$Host.Ui.WriteErrorLine("ERROR: $([String]$Message.Exception.Message)");Write-Error $Message -ErrorAction 'Stop';$ErrorActionPreference=''} - 'Inquire'{$ErrorActionPreference = 'Inquire';$Host.Ui.WriteErrorLine("ERROR: $([String]$Message.Exception.Message)");Write-Error $Message -ErrorAction 'Inquire';$ErrorActionPreference=''} - 'Continue'{$ErrorActionPreference = 'Continue';$Host.Ui.WriteErrorLine("ERROR: $([String]$Message.Exception.Message)");$ErrorActionPreference=''} - 'Suspend'{$ErrorActionPreference = 'Suspend';$Host.Ui.WriteErrorLine("ERROR: $([String]$Message.Exception.Message)");Write-Error $Message -ErrorAction 'Suspend';$ErrorActionPreference=''} - 'SilentlyContinue'{} - } - - } - } - #endregion Error - - #region Verbose - 4{ - #Write back to the host if $Writebacktohost is true. - if(($WriteBackToHost)){ - Switch ($PSCmdlet.GetVariableValue('VerbosePreference')) { - 'Continue' {$VerbosePreference = 'Continue'; Write-Verbose -Message "$Message";$VerbosePreference = ''} - 'Inquire' {$VerbosePreference = 'Inquire'; Write-Verbose -Message "$Message";$VerbosePreference = ''} - 'Stop' {$VerbosePreference = 'Stop'; Write-Verbose -Message "$Message";$VerbosePreference = ''} - } - } - } - #endregion Verbose - - #region Debug - 5{ - #Write back to the host if $Writebacktohost is true. - if(($WriteBackToHost)) - { - Switch ($PSCmdlet.GetVariableValue('DebugPreference')){ - 'Continue' {$DebugPreference = 'Continue'; Write-Debug -Message "$Message";$DebugPreference = ''} - 'Inquire' {$DebugPreference = 'Inquire'; Write-Debug -Message "$Message";$DebugPreference = ''} - 'Stop' {$DebugPreference = 'Stop'; Write-Debug -Message "$Message";$DebugPreference = ''} - } - } - } - #endregion Debug - - #region Information - 6{ - #Write back to the host if $Writebacktohost is true. - if(($WriteBackToHost)){ - Switch ($PSCmdlet.GetVariableValue('InformationPreference')){ - 'Continue' {$InformationPreference = [System.Management.Automation.ActionPreference]::Continue; Write-Information "INFORMATION: $Message" -InformationAction Continue ; $InformationPreference = ''} - 'Inquire' {$InformationPreference = [System.Management.Automation.ActionPreference]::Inquire; Write-Information "INFORMATION: $Message" -InformationAction Inquire; $InformationPreference = ''} - 'Stop' {$InformationPreference = [System.Management.Automation.ActionPreference]::Stop; Write-Information "INFORMATION: $Message" -InformationAction Stop; $InformationPreference = ''} - 'Suspend' {$InformationPreference = [System.Management.Automation.ActionPreference]::Suspend; Write-Information "INFORMATION: $Message" -InformationAction Suspend; $InformationPreference = ''} - } - } - } - #endregion Information - - } - #endregion Switch statement to write out to the log and/or back to the host. -} - -<# -.SYNOPSIS - Write to a log file in a format that takes advantage of the CMTrace.exe log viewer that comes with SCCM. - Found @ https://wolffhaven.gitlab.io/wolffhaven_icarus_test/powershell/write-cmtracelog-dropping-logs-like-a-boss/ - heavily modified for the purpose of WAU project - -.DESCRIPTION - Output strings to a log file that is formatted for use with CMTRace.exe and also writes back to the host. - - The severity of the logged line can be set as: - - 2-Error - 3-Warning - 4-Verbose - 5-Debug - 6-Information - - - Warnings will be highlighted in yellow. Errors are highlighted in red. - - The tools to view the log: - - SMS Trace - http://www.microsoft.com/en-us/download/details.aspx?id=18153 - CM Trace - https://www.microsoft.com/en-us/download/details.aspx?id=50012 or the Installation directory on Configuration Manager 2012 Site Server - \tools\ - - With current atomization of the code, the component parameter should be passed as one of parameters - [string]$component_name = (Get-PSCallStack)[0].FunctionName - If logger function is not called in the function, then we could designate a decriptive name for it. - -.EXAMPLE -Try{ - Get-Process -Name DoesnotExist -ea stop -} -Catch{ - Write-CMTraceLog -Logfile "C:\output\logfile.log -Message $Error[0] -Type Error -} - - This will write a line to the logfile.log file in c:\output\logfile.log. It will state the errordetails in the log file - and highlight the line in Red. It will also write back to the host in a friendlier red on black message than - the normal error record. - -.EXAMPLE - $VerbosePreference = Continue - Write-CMTraceLog -Message "This is a verbose message." -Type Verbose - - This example will write a verbose entry into the log file and also write back to the host. The Write-CMTraceLog will obey - the preference variables. - -.EXAMPLE -Write-CMTraceLog -Message "This is an informational message" -Type Information -WritebacktoHost:$false - - This example will write the informational message to the log but not back to the host. - -.EXAMPLE -Function Test{ - [cmdletbinding()] - Param() - Write-CMTraceLog -Message "This is a verbose message" -Type Verbose -} -Test -Verbose - -This example shows how to use write-cmtracelog inside a function and then call the function with the -verbose switch. -The write-cmtracelog function will then print the verbose message. - -.NOTES - - ########## - Change Log - ########## - - v1.6 - 2024-04-01 - reorganized com handling triggered by UTC Offset calculation, reduced the parallelism by moving err/non-err strings generation to the front - - ########## - - v1.5 - 2015-03-12 - Found bug with Error writing back to host twice. Fixed. - - ########## - - v1.4 - 2015-03-12 - Found bug with Warning writebackto host duplicating warning error message. - Fixed. - - ########## - - v1.3 - 2015-02-23 - Commented out line 224 and 249 as it was causing a duplicaton of the message. - - ########## - - v1.2 - Fixed inheritance of preference variables from child scopes finally!! Changed from using - using get-variable -scope 1 (which doesn't work when a script modules calls a function: - See this Microsoft Connect bug https://connect.microsoft.com/PowerShell/feedback/details/1606119.) - Anyway now now i use the $PSCmdlet.GetVariableValue('VerbosePreference') command and it works. - - ########## - - v1.1 - Found a bug with the get-variable scope. Need to refer to 2 parent scopes for the writebacktohost to work. - - Changed all Get-Variable commands to use Scope 2, instead of Scope 1. - - ########## - - v1.0 - Script Created -#>