Skip to content

Commit

Permalink
Merge pull request #681 from Romanitho/system-apps
Browse files Browse the repository at this point in the history
Move winget_system_apps.txt to \config folder + Auto Format code
  • Loading branch information
Romanitho committed Sep 2, 2024
2 parents fc5cf9c + b14dcc0 commit d0334a8
Show file tree
Hide file tree
Showing 25 changed files with 90 additions and 88 deletions.
2 changes: 1 addition & 1 deletion .github/.powershell-psscriptanalyzer.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
'PSUseShouldProcessForStateChangingFunctions',
'PSUseDeclaredVarsMoreThanAssignments'
)
}
}
25 changes: 23 additions & 2 deletions .github/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,28 @@
"Notif",
"HKLM",
"MSIX",
"msixbundle"
"msixbundle",
"notinstalled",
"norestart",
"wekyb*",
"azcopy*",
"Destinationpath",
"Redistributable",
"redist",
"tasktrigger",
"Dont",
"Listpath",
"ncsi",
"msftconnecttest",
"connecttest",
"Balise",
"logfile",
"Uninst",
"inputobject",
"msiexec",
"VERYSILENT",
"SUPPRESSMSGBOXES",
"subfolders"
],
"ignorePaths": [
".github/*",
Expand All @@ -25,4 +46,4 @@
"*.csv",
"*.txt"
]
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This project uses the Winget tool to daily update apps (with system context) and

![image](https://user-images.githubusercontent.com/96626929/150645599-9460def4-0818-4fe9-819c-dd7081ff8447.png)

## Intallation
## installation
Just [download latest release (WAU-Configurator.zip)](https://github.com/Romanitho/Winget-AutoUpdate/releases/latest/download/WAU-Configurator.zip), unzip, run "WAU Configurator":

![WAU Configurator Screenshot](https://github.com/Romanitho/Winget-AutoUpdate/assets/96626929/e3c3a331-1c49-40c5-8f70-e39cf9fc7fd1)
Expand Down
6 changes: 3 additions & 3 deletions Sources/WAU Configurator.bat
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function Get-WingetAppInfo ($SearchApp) {
#Search for winget apps
$AppResult = & $Winget search $SearchApp --accept-source-agreements --source winget | Out-String

#Start Convertion of winget format to an array. Check if "-----" exists
#Start Conversion of winget format to an array. Check if "-----" exists
if (!($AppResult -match "-----")) {
Start-PopUp "No application found!"
Start-Sleep 2
Expand All @@ -111,7 +111,7 @@ function Get-WingetAppInfo ($SearchApp) {

$fl = $fl - 1

#Get header titles [without remove seperator]
#Get header titles [without remove separator]
$index = $lines[$fl] -split '(?<=\s)(?!\s)'

# Line $fl has the header, we can find char where we find ID and Version [and manage non latin characters]
Expand All @@ -129,7 +129,7 @@ function Get-WingetAppInfo ($SearchApp) {
$nameDeclination = $($line.Substring(0, $idStart) -replace '[\u4e00-\u9fa5]', '**').Length - $line.Substring(0, $idStart).Length
$software.Name = $line.Substring(0, $idStart - $nameDeclination).TrimEnd()
$software.Id = $line.Substring($idStart - $nameDeclination, $versionStart - $idStart).TrimEnd()
#add formated soft to list
#add formatted soft to list
$searchList += $software
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Winget-AutoUpdate/WAU-Policies.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,4 @@ if ($WAUConfig.WAU_RunGPOManagement -eq 1) {
$WAUConfig.PSObject.Properties | Where-Object { $_.Name -like "WAU_*" } | Select-Object Name, Value | Out-File -Encoding default -FilePath $GPOLogFile -Append
}

Exit 0
Exit 0
4 changes: 2 additions & 2 deletions Sources/Winget-AutoUpdate/Winget-Install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ function Uninstall-App ($AppID, $AppArgs) {

#Function to Add app to WAU white list
function Add-WAUWhiteList ($AppID) {
#Check if WAU default intall path is defined
#Check if WAU default install path is defined
if ($WAUInstallLocation) {
$WhiteList = "$WAUInstallLocation\included_apps.txt"
#Create included_apps.txt if it doesn't exist
Expand All @@ -281,7 +281,7 @@ function Add-WAUWhiteList ($AppID) {

#Function to Remove app from WAU white list
function Remove-WAUWhiteList ($AppID) {
#Check if WAU default intall path exists
#Check if WAU default install path exists
$WhiteList = "$WAUInstallLocation\included_apps.txt"
if (Test-Path $WhiteList) {
Write-ToLog "-> Remove $AppID from WAU included_apps.txt"
Expand Down
4 changes: 2 additions & 2 deletions Sources/Winget-AutoUpdate/functions/Add-ScopeMachine.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Function to configure the prefered scope option as Machine
#Function to configure the preferred scope option as Machine
function Add-ScopeMachine {

#Get Settings path for system or current user
Expand Down Expand Up @@ -29,4 +29,4 @@ function Add-ScopeMachine {
}

$ConfigFile | ConvertTo-Json -Depth 100 | Out-File $SettingsPath -Encoding utf8 -Force
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ Function Confirm-Installation ($AppName, $AppVer) {
else {
return $false
}
}
}
2 changes: 1 addition & 1 deletion Sources/Winget-AutoUpdate/functions/Get-AZCopy.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ Function Get-AZCopy ($WingetUpdatePath) {
$AZCopyCurrentVersion = $AZCopyVersionRegex.Match($AZCopyCurrentVersion).Value
Write-ToLog "AZCopy version $AZCopyCurrentVersion installed"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ function Get-WAUAvailableVersion {
#Return version
return $WAUAvailableVersion

}
}
2 changes: 1 addition & 1 deletion Sources/Winget-AutoUpdate/functions/Get-WAUConfig.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ Function Get-WAUConfig {

#Return config
return $WAUConfig
}
}
2 changes: 1 addition & 1 deletion Sources/Winget-AutoUpdate/functions/Get-WingetCmd.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ Function Get-WingetCmd {

return $WingetCmd

}
}
10 changes: 5 additions & 5 deletions Sources/Winget-AutoUpdate/functions/Get-WingetOutdatedApps.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function Get-WingetOutdatedApps {
#Get list of available upgrades on winget format
$upgradeResult = & $Winget upgrade --source winget | Out-String

#Start Convertion of winget format to an array. Check if "-----" exists (Winget Error Handling)
#Start Conversion of winget format to an array. Check if "-----" exists (Winget Error Handling)
if (!($upgradeResult -match "-----")) {
return "An unusual thing happened (maybe all apps are upgraded):`n$upgradeResult"
}
Expand All @@ -28,7 +28,7 @@ function Get-WingetOutdatedApps {
#Get header line
$fl = $fl - 1

#Get header titles [without remove seperator]
#Get header titles [without remove separator]
$index = $lines[$fl] -split '(?<=\s)(?!\s)'

# Line $fl has the header, we can find char where we find ID and Version [and manage non latin characters]
Expand All @@ -44,7 +44,7 @@ function Get-WingetOutdatedApps {
#Get header line
$fl = $i - 1

#Get header titles [without remove seperator]
#Get header titles [without remove separator]
$index = $lines[$fl] -split '(?<=\s)(?!\s)'

# Line $fl has the header, we can find char where we find ID and Version [and manage non latin characters]
Expand All @@ -61,14 +61,14 @@ function Get-WingetOutdatedApps {
$software.Id = $line.Substring($idStart - $nameDeclination, $versionStart - $idStart).TrimEnd()
$software.Version = $line.Substring($versionStart - $nameDeclination, $availableStart - $versionStart).TrimEnd()
$software.AvailableVersion = $line.Substring($availableStart - $nameDeclination).TrimEnd()
#add formated soft to list
#add formatted soft to list
$upgradeList += $software
}
}

#If current user is not system, remove system apps from list
if ($IsSystem -eq $false) {
$SystemApps = Get-Content -Path "$WorkingDir\winget_system_apps.txt" -ErrorAction SilentlyContinue
$SystemApps = Get-Content -Path "$WorkingDir\config\winget_system_apps.txt" -ErrorAction SilentlyContinue
$upgradeList = $upgradeList | Where-Object { $SystemApps -notcontains $_.Id }
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function Get-WingetSystemApps {

#Json File, where to export system installed apps
$jsonFile = "$WorkingDir\winget_system_apps.txt"
$jsonFile = "$WorkingDir\config\winget_system_apps.txt"

#Get list of installed Winget apps to json file
& $Winget export -o $jsonFile --accept-source-agreements -s winget | Out-Null
Expand Down
6 changes: 3 additions & 3 deletions Sources/Winget-AutoUpdate/functions/Install-Prerequisites.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function Install-Prerequisites {
Write-ToLog "-> Microsoft.VCLibs.140.00.UWPDesktop installed successfully." "Green"
}
catch {
Write-ToLog "-> Failed to intall Microsoft.VCLibs.140.00.UWPDesktop..." "Red"
Write-ToLog "-> Failed to install Microsoft.VCLibs.140.00.UWPDesktop..." "Red"
}
finally {
Remove-Item -Path $VCLibsFile -Force
Expand All @@ -79,7 +79,7 @@ function Install-Prerequisites {
Write-ToLog "-> Microsoft.UI.Xaml.2.8 installed successfully." "Green"
}
catch {
Write-ToLog "-> Failed to intall Microsoft.UI.Xaml.2.8..." "Red"
Write-ToLog "-> Failed to install Microsoft.UI.Xaml.2.8..." "Red"
}
finally {
Remove-Item -Path $UIXamlFile -Force
Expand All @@ -96,4 +96,4 @@ function Install-Prerequisites {
}


}
}
2 changes: 1 addition & 1 deletion Sources/Winget-AutoUpdate/functions/Invoke-DirProtect.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ function Invoke-DirProtect ($ModsPath) {
catch {
return $false
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ function Invoke-PostUpdateActions {
"$WorkingDir\functions\Write-Log.ps1",
"$WorkingDir\functions\Get-WinGetAvailableVersion.ps1",
"$WorkingDir\functions\Invoke-ModsProtect.ps1",
"$WorkingDir\Version.txt"
"$WorkingDir\functions\Write-CMTraceLog.ps1",
"$WorkingDir\Version.txt",
"$WorkingDir\winget_system_apps.txt"
)
foreach ($FileName in $FileNames) {
if (Test-Path $FileName) {
Expand Down
3 changes: 0 additions & 3 deletions Sources/Winget-AutoUpdate/functions/Start-NotifTask.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,6 @@ function Start-NotifTask {

#Save XML to File
$ToastTemplateLocation = "$($WAUConfig.InstallLocation)\config\"
if (!(Test-Path $ToastTemplateLocation)) {
New-Item -ItemType Directory -Force -Path $ToastTemplateLocation
}
$ToastTemplate.Save("$ToastTemplateLocation\notif.xml")

#Run Notify scheduled task to notify conneted users
Expand Down
2 changes: 1 addition & 1 deletion Sources/Winget-AutoUpdate/functions/Test-ListPath.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function Test-ListPath ($ListPath, $UseWhiteList, $WingetUpdatePath) {

# Assign the second string (after "?" to the end) to the variable $sasToken
$sasToken = $splitPath[1]

# Join the parts and add "/$ListType?" in between the parts
$ExternalList = -join ($resourceURI, "/$ListType`?", $sasToken)
}
Expand Down
8 changes: 5 additions & 3 deletions Sources/Winget-AutoUpdate/functions/Test-Network.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,18 @@ function Test-Network {
$ncsiHost = Get-ItemPropertyValue -Path $NlaRegKey -Name ActiveWebProbeHost
$ncsiPath = Get-ItemPropertyValue -Path $NlaRegKey -Name ActiveWebProbePath
$ncsiContent = Get-ItemPropertyValue -Path $NlaRegKey -Name ActiveWebProbeContent
} catch {
}
catch {
$ncsiHost = "www.msftconnecttest.com"
$ncsiPath = "connecttest.txt"
$ncsiContent = "Microsoft Connect Test"
}

While ($timeout -lt 1800) {
try {
$ncsiResponse = Invoke-WebRequest -Uri "http://$($ncsiHost)/$($ncsiPath)" -UseBasicParsing -UserAgent ([Microsoft.PowerShell.Commands.PSUserAgent]::Chrome)
} catch {
}
catch {
$ncsiResponse = $false
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/Winget-AutoUpdate/functions/Update-App.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,4 @@ Function Update-App ($app) {

}

}
}
2 changes: 1 addition & 1 deletion Sources/Winget-AutoUpdate/functions/Write-ToLog.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function Write-ToLog {

#If header requested
if ($IsHeader) {
$Log = "#"*65 + "`n#`t$(Get-Date -Format (Get-culture).DateTimeFormat.ShortDatePattern) - $LogMsg`n" + "#"*65
$Log = "#" * 65 + "`n#`t$(Get-Date -Format (Get-culture).DateTimeFormat.ShortDatePattern) - $LogMsg`n" + "#" * 65
}
else {
$Log = "$(Get-Date -UFormat "%T") - $LogMsg"
Expand Down
4 changes: 2 additions & 2 deletions Sources/Winget-AutoUpdate/mods/_AppID-template.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ if ($Proc) {
Stop-ModsProc $Proc
}
if ($Svc) {
Stop-ModsSvc $Svc
Stop-ModsSvc $Svc
}
if ($Wait) {
Wait-ModsProc $Wait
Expand Down Expand Up @@ -135,4 +135,4 @@ if ($RunUser) {
Invoke-ModsApp $RunUser "" "" $User
}

<# EXTRAS #>
<# EXTRAS #>
Loading

0 comments on commit d0334a8

Please sign in to comment.