Skip to content
This repository was archived by the owner on Oct 18, 2024. It is now read-only.

Commit 1ec5d85

Browse files
committed
Added WAU new features and updated pkgs versions
1 parent 5ecba47 commit 1ec5d85

File tree

1 file changed

+92
-86
lines changed

1 file changed

+92
-86
lines changed

Sources/Winget-Install-GUI.ps1

Lines changed: 92 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ https://github.com/Romanitho/Winget-AllinOne
1313
<# APP INFO #>
1414

1515
$Script:WiGuiVersion = "1.7.1"
16-
$Script:WAUGithubLink = "https://github.com/Romanitho/Winget-AutoUpdate/archive/refs/tags/v1.13.2.zip"
17-
$Script:WIGithubLink = "https://github.com/Romanitho/Winget-Install/archive/refs/tags/v1.8.0.zip"
16+
$Script:WAUGithubLink = "https://github.com/Romanitho/Winget-AutoUpdate/archive/refs/tags/v1.15.0.zip"
17+
$Script:WIGithubLink = "https://github.com/Romanitho/Winget-Install/archive/refs/tags/v1.8.1.zip"
1818
$Script:WingetLink = "https://github.com/microsoft/winget-cli/releases/download/v.1.3.1611/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"
1919

2020
<# FUNCTIONS #>
@@ -220,54 +220,6 @@ function Get-WingetAppInfo ($SearchApp) {
220220
return $searchList
221221
}
222222

223-
function Get-WingetInstalledApps {
224-
class Software {
225-
[string]$Name
226-
[string]$Id
227-
}
228-
229-
#Get list of installed apps on winget format
230-
$AppResult = & $Winget list --accept-source-agreements --source winget
231-
232-
#Start Convertion of winget format to an array. Check if "-----" exists
233-
if (!($AppResult -match "-----")) {
234-
Write-Host "No application found."
235-
return
236-
}
237-
238-
#Split winget output to lines
239-
$lines = $AppResult.Split([Environment]::NewLine) | Where-Object { $_ }
240-
241-
# Find the line that starts with "------"
242-
$fl = 0
243-
while (-not $lines[$fl].StartsWith("-----")) {
244-
$fl++
245-
}
246-
247-
$fl = $fl - 1
248-
249-
#Get header titles
250-
$index = $lines[$fl] -split '\s+'
251-
252-
# Line $fl has the header, we can find char where we find ID and Version
253-
$idStart = $lines[$fl].IndexOf($index[1])
254-
$versionStart = $lines[$fl].IndexOf($index[2])
255-
256-
# Now cycle in real package and split accordingly
257-
$installedList = @()
258-
For ($i = $fl + 2; $i -le $lines.Length; $i++) {
259-
$line = $lines[$i]
260-
if ($line.Length -gt ($sourceStart + 5)) {
261-
$software = [Software]::new()
262-
$software.Name = $line.Substring(0, $idStart).TrimEnd()
263-
$software.Id = $line.Substring($idStart, $versionStart - $idStart).TrimEnd()
264-
#add formated soft to list
265-
$installedList += $software
266-
}
267-
}
268-
return $installedList
269-
}
270-
271223
function Get-WingetInstalledAppsV2 {
272224

273225
#Json File where to export install apps
@@ -307,6 +259,9 @@ function Start-InstallGUI {
307259
$SearchTextBox = New-Object System.Windows.Forms.TextBox
308260
$SearchButton = New-Object System.Windows.Forms.Button
309261
$WAUTabPage = New-Object System.Windows.Forms.TabPage
262+
$WAUShortcutsGroupBox = New-Object System.Windows.Forms.GroupBox
263+
$DesktopCheckBox = New-Object System.Windows.Forms.CheckBox
264+
$StartMenuCheckBox = New-Object System.Windows.Forms.CheckBox
310265
$WAUStatusLabel = New-Object System.Windows.Forms.Label
311266
$WAUWhiteBlackGroupBox = New-Object System.Windows.Forms.GroupBox
312267
$WAULoadListButton = New-Object System.Windows.Forms.Button
@@ -320,8 +275,10 @@ function Start-InstallGUI {
320275
$WeeklyRadioBut = New-Object System.Windows.Forms.RadioButton
321276
$BiweeklyRadioBut = New-Object System.Windows.Forms.RadioButton
322277
$MonthlyRatioBut = New-Object System.Windows.Forms.RadioButton
278+
$NeverRatioBut = New-Object System.Windows.Forms.RadioButton
323279
$UpdAtLogonCheckBox = New-Object System.Windows.Forms.CheckBox
324280
$WAUConfGroupBox = New-Object System.Windows.Forms.GroupBox
281+
$WAUonMeteredCheckBox = New-Object System.Windows.Forms.CheckBox
325282
$NotifLevelLabel = New-Object System.Windows.Forms.Label
326283
$NotifLevelComboBox = New-Object System.Windows.Forms.ComboBox
327284
$WAUDisableAUCheckBox = New-Object System.Windows.Forms.CheckBox
@@ -339,7 +296,6 @@ function Start-InstallGUI {
339296
$SaveFileDialog = New-Object System.Windows.Forms.SaveFileDialog
340297
$OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
341298
$WAUListOpenFile = New-Object System.Windows.Forms.OpenFileDialog
342-
$WAUonMeteredCheckBox = New-Object System.Windows.Forms.CheckBox
343299
#
344300
# WiGuiTabControl
345301
#
@@ -482,6 +438,7 @@ function Start-InstallGUI {
482438
#
483439
# WAUTabPage
484440
#
441+
$WAUTabPage.Controls.Add($WAUShortcutsGroupBox)
485442
$WAUTabPage.Controls.Add($WAUStatusLabel)
486443
$WAUTabPage.Controls.Add($WAUWhiteBlackGroupBox)
487444
$WAUTabPage.Controls.Add($WAUFreqGroupBox)
@@ -494,6 +451,40 @@ function Start-InstallGUI {
494451
$WAUTabPage.TabIndex = 1
495452
$WAUTabPage.Text = "Configure WAU"
496453
#
454+
# WAUShortcutsGroupBox
455+
#
456+
$WAUShortcutsGroupBox.Controls.Add($DesktopCheckBox)
457+
$WAUShortcutsGroupBox.Controls.Add($StartMenuCheckBox)
458+
$WAUShortcutsGroupBox.Enabled = $false
459+
$WAUShortcutsGroupBox.Location = New-Object System.Drawing.Point(31, 343)
460+
$WAUShortcutsGroupBox.Name = "WAUShortcutsGroupBox"
461+
$WAUShortcutsGroupBox.Size = New-Object System.Drawing.Size(445, 69)
462+
$WAUShortcutsGroupBox.TabIndex = 27
463+
$WAUShortcutsGroupBox.TabStop = $false
464+
$WAUShortcutsGroupBox.Text = "Shortcuts"
465+
#
466+
# DesktopCheckBox
467+
#
468+
$DesktopCheckBox.AutoSize = $true
469+
$DesktopCheckBox.Checked = $true
470+
$DesktopCheckBox.CheckState = [System.Windows.Forms.CheckState]::Checked
471+
$DesktopCheckBox.Location = New-Object System.Drawing.Point(7, 20)
472+
$DesktopCheckBox.Name = "DesktopCheckBox"
473+
$DesktopCheckBox.Size = New-Object System.Drawing.Size(66, 17)
474+
$DesktopCheckBox.TabIndex = 22
475+
$DesktopCheckBox.Text = "Desktop"
476+
#
477+
# StartMenuCheckBox
478+
#
479+
$StartMenuCheckBox.AutoSize = $true
480+
$StartMenuCheckBox.Checked = $true
481+
$StartMenuCheckBox.CheckState = [System.Windows.Forms.CheckState]::Checked
482+
$StartMenuCheckBox.Location = New-Object System.Drawing.Point(7, 43)
483+
$StartMenuCheckBox.Name = "StartMenuCheckBox"
484+
$StartMenuCheckBox.Size = New-Object System.Drawing.Size(78, 17)
485+
$StartMenuCheckBox.TabIndex = 21
486+
$StartMenuCheckBox.Text = "Start Menu"
487+
#
497488
# WAUStatusLabel
498489
#
499490
$WAUStatusLabel.AutoSize = $true
@@ -516,7 +507,7 @@ function Start-InstallGUI {
516507
$WAUWhiteBlackGroupBox.Size = New-Object System.Drawing.Size(445, 72)
517508
$WAUWhiteBlackGroupBox.TabIndex = 24
518509
$WAUWhiteBlackGroupBox.TabStop = $false
519-
$WAUWhiteBlackGroupBox.Text = "WAU White / Black List"
510+
$WAUWhiteBlackGroupBox.Text = "White / Black List"
520511
#
521512
# WAULoadListButton
522513
#
@@ -574,33 +565,31 @@ function Start-InstallGUI {
574565
$WAUFreqGroupBox.Enabled = $false
575566
$WAUFreqGroupBox.Location = New-Object System.Drawing.Point(31, 174)
576567
$WAUFreqGroupBox.Name = "WAUFreqGroupBox"
577-
$WAUFreqGroupBox.Size = New-Object System.Drawing.Size(284, 69)
568+
$WAUFreqGroupBox.Size = New-Object System.Drawing.Size(445, 69)
578569
$WAUFreqGroupBox.TabIndex = 23
579570
$WAUFreqGroupBox.TabStop = $false
580-
$WAUFreqGroupBox.Text = "WAU Update Frequency"
571+
$WAUFreqGroupBox.Text = "Update Frequency"
581572
#
582573
# WAUFreqLayoutPanel
583574
#
584575
$WAUFreqLayoutPanel.Controls.Add($DailyRadioBut)
585576
$WAUFreqLayoutPanel.Controls.Add($WeeklyRadioBut)
586577
$WAUFreqLayoutPanel.Controls.Add($BiweeklyRadioBut)
587578
$WAUFreqLayoutPanel.Controls.Add($MonthlyRatioBut)
579+
$WAUFreqLayoutPanel.Controls.Add($NeverRatioBut)
588580
$WAUFreqLayoutPanel.Location = New-Object System.Drawing.Point(4, 18)
589581
$WAUFreqLayoutPanel.Name = "WAUFreqLayoutPanel"
590-
$WAUFreqLayoutPanel.Size = New-Object System.Drawing.Size(275, 24)
582+
$WAUFreqLayoutPanel.Size = New-Object System.Drawing.Size(334, 24)
591583
$WAUFreqLayoutPanel.TabIndex = 26
592584
#
593585
# DailyRadioBut
594586
#
595587
$DailyRadioBut.AutoSize = $true
596-
$DailyRadioBut.Checked = $true
597588
$DailyRadioBut.Location = New-Object System.Drawing.Point(3, 3)
598589
$DailyRadioBut.Name = "DailyRadioBut"
599590
$DailyRadioBut.Size = New-Object System.Drawing.Size(48, 17)
600591
$DailyRadioBut.TabIndex = 22
601-
$DailyRadioBut.TabStop = $true
602592
$DailyRadioBut.Text = "Daily"
603-
$DailyRadioBut.TextAlign = [System.Drawing.ContentAlignment]::MiddleCenter
604593
#
605594
# WeeklyRadioBut
606595
#
@@ -629,6 +618,17 @@ function Start-InstallGUI {
629618
$MonthlyRatioBut.TabIndex = 25
630619
$MonthlyRatioBut.Text = "Monthly"
631620
#
621+
# NeverRatioBut
622+
#
623+
$NeverRatioBut.AutoSize = $true
624+
$NeverRatioBut.Checked = $true
625+
$NeverRatioBut.Location = New-Object System.Drawing.Point(265, 3)
626+
$NeverRatioBut.Name = "NeverRatioBut"
627+
$NeverRatioBut.Size = New-Object System.Drawing.Size(54, 17)
628+
$NeverRatioBut.TabIndex = 26
629+
$NeverRatioBut.TabStop = $true
630+
$NeverRatioBut.Text = "Never"
631+
#
632632
# UpdAtLogonCheckBox
633633
#
634634
$UpdAtLogonCheckBox.AutoSize = $true
@@ -650,10 +650,19 @@ function Start-InstallGUI {
650650
$WAUConfGroupBox.Enabled = $false
651651
$WAUConfGroupBox.Location = New-Object System.Drawing.Point(31, 46)
652652
$WAUConfGroupBox.Name = "WAUConfGroupBox"
653-
$WAUConfGroupBox.Size = New-Object System.Drawing.Size(214, 114)
653+
$WAUConfGroupBox.Size = New-Object System.Drawing.Size(445, 114)
654654
$WAUConfGroupBox.TabIndex = 20
655655
$WAUConfGroupBox.TabStop = $false
656-
$WAUConfGroupBox.Text = "WAU Configurations"
656+
$WAUConfGroupBox.Text = "Configurations"
657+
#
658+
# WAUonMeteredCheckBox
659+
#
660+
$WAUonMeteredCheckBox.AutoSize = $true
661+
$WAUonMeteredCheckBox.Location = New-Object System.Drawing.Point(6, 65)
662+
$WAUonMeteredCheckBox.Name = "WAUonMeteredCheckBox"
663+
$WAUonMeteredCheckBox.Size = New-Object System.Drawing.Size(183, 17)
664+
$WAUonMeteredCheckBox.TabIndex = 23
665+
$WAUonMeteredCheckBox.Text = "Run WAU on metered connexion"
657666
#
658667
# NotifLevelLabel
659668
#
@@ -667,7 +676,10 @@ function Start-InstallGUI {
667676
# NotifLevelComboBox
668677
#
669678
$NotifLevelComboBox.DropDownStyle = [System.Windows.Forms.ComboBoxStyle]::DropDownList
670-
$NotifLevelComboBox.Items.AddRange(@("Full","SuccessOnly","None"))
679+
$NotifLevelComboBox.Items.AddRange(@(
680+
"Full",
681+
"SuccessOnly",
682+
"None"))
671683
$NotifLevelComboBox.Location = New-Object System.Drawing.Point(97, 86)
672684
$NotifLevelComboBox.Name = "NotifLevelComboBox"
673685
$NotifLevelComboBox.Size = New-Object System.Drawing.Size(100, 21)
@@ -753,9 +765,9 @@ function Start-InstallGUI {
753765
$CMTraceCheckBox.AutoSize = $true
754766
$CMTraceCheckBox.Location = New-Object System.Drawing.Point(18, 61)
755767
$CMTraceCheckBox.Name = "CMTraceCheckBox"
756-
$CMTraceCheckBox.Size = New-Object System.Drawing.Size(288, 17)
768+
$CMTraceCheckBox.Size = New-Object System.Drawing.Size(100, 17)
757769
$CMTraceCheckBox.TabIndex = 19
758-
$CMTraceCheckBox.Text = "Install ConfigMgr Toolkit (With CMTrace log viewer tool)"
770+
$CMTraceCheckBox.Text = "Install CMTrace"
759771
#
760772
# InstallButton
761773
#
@@ -795,15 +807,6 @@ function Start-InstallGUI {
795807
#
796808
$WAUListOpenFile.Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*"
797809
#
798-
# WAUonMeteredCheckBox
799-
#
800-
$WAUonMeteredCheckBox.AutoSize = $true
801-
$WAUonMeteredCheckBox.Location = New-Object System.Drawing.Point(6, 65)
802-
$WAUonMeteredCheckBox.Name = "WAUonMeteredCheckBox"
803-
$WAUonMeteredCheckBox.Size = New-Object System.Drawing.Size(183, 17)
804-
$WAUonMeteredCheckBox.TabIndex = 23
805-
$WAUonMeteredCheckBox.Text = "Run WAU on metered connexion"
806-
#
807810
# WiGuiForm
808811
#
809812
$WiGuiForm.AcceptButton = $SearchButton
@@ -915,12 +918,14 @@ function Start-InstallGUI {
915918
$WAUConfGroupBox.Enabled = $true
916919
$WAUFreqGroupBox.Enabled = $true
917920
$WAUWhiteBlackGroupBox.Enabled = $true
921+
$WAUShortcutsGroupBox.Enabled = $true
918922
}
919923
elseif ($WAUCheckBox.Checked -eq $false) {
920924
$WAUConfGroupBox.Enabled = $false
921925
$WAUFreqGroupBox.Enabled = $false
922926
$WAUWhiteBlackGroupBox.Enabled = $false
923-
}
927+
$WAUShortcutsGroupBox.Enabled = $false
928+
}
924929
})
925930
#
926931
$WAUMoreInfoLabel.add_click({
@@ -999,10 +1004,13 @@ function Start-InstallGUI {
9991004
$Script:UninstallView = $UninstallViewCheckBox.Checked
10001005
$Script:CMTrace = $CMTraceCheckBox.Checked
10011006
$Script:WAUonMetered = $WAUonMeteredCheckBox.Checked
1007+
$Script:WAUDesktopShortcut = $DesktopCheckBox.Checked
1008+
$Script:WAUStartMenuShortcut = $StartMenuCheckBox.Checked
10021009
Start-Installations
10031010
$WAUCheckBox.Checked = $false
10041011
$WAUConfGroupBox.Enabled = $false
10051012
$WAUFreqGroupBox.Enabled = $false
1013+
$WAUShortcutsGroupBox.Enabled =$false
10061014
$WAUWhiteBlackGroupBox.Enabled = $false
10071015
$AdvancedRunCheckBox.Checked = $false
10081016
$UninstallViewCheckBox.Checked = $false
@@ -1086,6 +1094,13 @@ function Start-Installations {
10861094
else {
10871095
if ($WAUListPath) { Copy-Item $WAUListPath -Destination "$WAUInstallFolder\excluded_apps.txt" -Force -ErrorAction SilentlyContinue }
10881096
}
1097+
if ($WAUDesktopShortcut) {
1098+
$WAUParameters += "-DesktopShortcut "
1099+
}
1100+
if ($WAUStartMenuShortcut) {
1101+
$WAUParameters += "-StartMenuShortcut "
1102+
}
1103+
10891104

10901105
#Install Winget-Autoupdate
10911106
Start-Process "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -Command `"$WAUInstallFile $WAUParameters`"" -Wait -Verb RunAs
@@ -1094,20 +1109,11 @@ function Start-Installations {
10941109
## ADMIN PART ##
10951110

10961111
if ($CMTrace) {
1097-
Start-PopUp "Installing ConfigMgr 2012 Toolkit..."
1098-
$CMToolkitLink = "https://download.microsoft.com/download/5/0/8/508918E1-3627-4383-B7D8-AA07B3490D21/ConfigMgrTools.msi"
1099-
$CMToolkitPath = "C:\Tools\ConfigMgrTools.msi"
1112+
Start-PopUp "Installing CMTrace..."
1113+
$CMToolkitLink = "https://github.com/Romanitho/Winget-Install-GUI/raw/main/Tools/cmtrace.exe"
1114+
$CMToolkitPath = "C:\Tools\CMTrace.exe"
11001115
Invoke-WebRequest $CMToolkitLink -OutFile (New-Item -Path $CMToolkitPath -Force)
1101-
msiexec.exe /I $CMToolkitPath /passive
1102-
Start-Sleep 3
1103-
#Create CMTrace Shortcut to C:\Tools
1104-
$WScriptShell = New-Object -ComObject WScript.Shell
1105-
$TargetFile = "${env:ProgramFiles(x86)}\ConfigMgr 2012 Toolkit R2\ClientTools\CMTrace.exe"
1106-
$ShortcutFile = "C:\Tools\CMTrace.lnk"
1107-
$Shortcut = $WScriptShell.CreateShortcut($ShortcutFile)
1108-
$Shortcut.TargetPath = $TargetFile
1109-
$Shortcut.Save()
1110-
Remove-Item $CMToolkitPath
1116+
Start-Sleep 1
11111117
}
11121118

11131119
if ($AdvancedRun) {

0 commit comments

Comments
 (0)