winutil/functions/private/Test-WinUtilPackageManager.ps1
Chris Titus 5cd75c0ed6
Test 2024 02 07 refactor noapps (#1717)
* pull workflow github actions (#1716)

* Update close-old-issues.yaml

* Compile Winutil

* Update close-old-issues.yaml

* Update close-old-issues.yaml

* Update close-old-issues.yaml

* Compile Winutil

---------

Co-authored-by: ChrisTitusTech <ChrisTitusTech@users.noreply.github.com>

* Improve unattended answer file creation for MicroWin and add automatic conversion of ESD files (#1595)

* Update applications.json

Fake app add made by linux fanboy

* Compile Winutil

* Update files

- Add detections for whether the image to be processed by MicroWin is Windows 10 or later
- Add procedure to clear the indexes ComboBox (WinForms term) every time an ISO is specified

* Update screen-install.png (#1464)

* Compile Winutil

* applications.jsonAdded Foxit Reader app and updated Foxit Editor to show the difference.

* applications.json

Added Foxit Reader app and updated Foxit Editor to show the difference.

* Compile Winutil

* Fix Broken Link and add syncthingtray (#1508)

* Compile Winutil

* Remove Nano-Removed bugged Nano package for now

* Remove Nano

-Removed bugged Nano package for now

* Compile Winutil

* tweaks and fetures tabs clean up automation from inputXML.xaml

* tweaks and fetures tabs clean up automation from inputXML.xaml

* fixed some commas in tweaks.json file

* recompile

* Update tweaks.json

* Compile Winutil

* Choosing Alternate Scartch Path and Busy Messages

* Choosing Alternate Scartch Path and Busy Messages

* Change Selected index to be pro

* Compile Winutil

* Improve detection for Professional editions

* Update files

Updated the Test-CompatibleImage function to compare against a desired version, which is useful for determining if the Specialize pass needs to be added to the unattended answer file

* Automatic conversion of ESD files

Automatically convert the install.esd file from installation media into a WIM file that can be mounted, then delete the ESD file

---------

Co-authored-by: Chris Titus <dfm.titus@gmail.com>
Co-authored-by: ChrisTitusTech <ChrisTitusTech@users.noreply.github.com>
Co-authored-by: Samq64 <81489795+Samq64@users.noreply.github.com>
Co-authored-by: Chris Titus <contact@christitus.com>
Co-authored-by: LoopTJ <34551682+LoopTJ@users.noreply.github.com>
Co-authored-by: Roc Wang <rocwang911@gmail.com>
Co-authored-by: Jes Herring <123990927+jesjess243@users.noreply.github.com>
Co-authored-by: ogfrm <96927197+ogfrm@users.noreply.github.com>
Co-authored-by: LeeDowA <157072913+LeeDowA@users.noreply.github.com>

* Compile Winutil

* Change the Theme Configuration for low spec. (#1643)

* Update close-old-issues.yaml

* Compile Winutil

* Update close-old-issues.yaml

* Update close-old-issues.yaml

* Update close-old-issues.yaml

* Added New Dark Themes for Low Spec PC and added GPU Detection

* Compile Winutil

---------

Co-authored-by: Chris Titus <dfm.titus@gmail.com>
Co-authored-by: ChrisTitusTech <ChrisTitusTech@users.noreply.github.com>
Co-authored-by: Chris Titus <contact@christitus.com>

* Compile Winutil

* Fix OneDrive Remove Tweak not cleaning-up 'OneDrive' Folder under the 'localappdata' Environment Folder (#1654)

Besides the 'OneDrive' Folder found in 'Microsoft' Folder in 'localappdata', there's Yet Another Cache Folder that OneDrive uses, which's found under the 'localappdata' Environment Folder, read the commit patches for exact details.

* Compile Winutil

* MicroWin - Make the New Shortcut have 'Run as administrator' property on (#1659)

The added lines of PowerShell Code was taken from public function 'Invoke-WPFShortcut.ps1' under the 'functions/public' Folder.

* Compile Winutil

* Fixing an issue related to winget install & Improving winget uninstall command (#1662)

* Add the argument '--accept-source-agreements' to the Uninstall command of Winget

Added '--accept-source-agreements' to insure that the Package Uninstall process is completely unattended.

* Improve the Wording of the 'WPFInstall' function and 'inputXML.xaml' file

* Compile Winutil

* Handle preview versions of winget (#1682)

* Update close-old-issues.yaml

* Compile Winutil

* Update close-old-issues.yaml

* Update close-old-issues.yaml

* Update close-old-issues.yaml

* Added compatibility with preview versions of Winget

* Update winutil.ps1

* Update Test-WinUtilPackageManager.ps1

* Document Formatting

---------

Co-authored-by: Chris Titus <dfm.titus@gmail.com>
Co-authored-by: ChrisTitusTech <ChrisTitusTech@users.noreply.github.com>
Co-authored-by: Chris Titus <contact@christitus.com>

* Compile Winutil

* fix typo in applications (#1683)

* Compile Winutil

* fix DevToys winget id (#1685) (#1689)

* Compile Winutil

* fix DevToys winget id (#1685)

DevToys doesn't have a proper winget id unlike other programs

* Compile Winutil

* fix case

* Compile Winutil

* Compile Winutil

---------

Co-authored-by: K-Saikrishnan <K-Saikrishnan@users.noreply.github.com>
Co-authored-by: Chris Titus <contact@christitus.com>
Co-authored-by: ChrisTitusTech <ChrisTitusTech@users.noreply.github.com>

* Fixed and improved software URLs and updated names based on creator formatting (#1704)

Co-authored-by: Tyler Robb <tylerrobb@users.noreply.github.com>

* Compile Winutil

---------

Co-authored-by: ChrisTitusTech <ChrisTitusTech@users.noreply.github.com>
Co-authored-by: CodingWonders <101426328+CodingWonders@users.noreply.github.com>
Co-authored-by: Samq64 <81489795+Samq64@users.noreply.github.com>
Co-authored-by: LoopTJ <34551682+LoopTJ@users.noreply.github.com>
Co-authored-by: Roc Wang <rocwang911@gmail.com>
Co-authored-by: Jes Herring <123990927+jesjess243@users.noreply.github.com>
Co-authored-by: ogfrm <96927197+ogfrm@users.noreply.github.com>
Co-authored-by: LeeDowA <157072913+LeeDowA@users.noreply.github.com>
Co-authored-by: Justawildwolf <62820836+blusewill@users.noreply.github.com>
Co-authored-by: Mr.k <mineshtine28546271@gmail.com>
Co-authored-by: Martin Wiethan <47688561+Marterich@users.noreply.github.com>
Co-authored-by: glorp <152878702+choccyy-milk@users.noreply.github.com>
Co-authored-by: Saikrishnan K <53394202+K-Saikrishnan@users.noreply.github.com>
Co-authored-by: K-Saikrishnan <K-Saikrishnan@users.noreply.github.com>
Co-authored-by: Tyler Robb <6801620+tylerrobb@users.noreply.github.com>
Co-authored-by: Tyler Robb <tylerrobb@users.noreply.github.com>
2024-03-21 16:23:24 -07:00

64 lines
1.9 KiB
PowerShell

function Test-WinUtilPackageManager {
<#
.SYNOPSIS
Checks if Winget and/or Choco are installed
.PARAMETER winget
Check if Winget is installed
.PARAMETER choco
Check if Chocolatey is installed
#>
Param(
[System.Management.Automation.SwitchParameter]$winget,
[System.Management.Automation.SwitchParameter]$choco
)
# Install Winget if not detected
$wingetExists = Get-Command -Name winget -ErrorAction SilentlyContinue
if ($wingetExists) {
$wingetversionfull = (winget --version)
$wingetversiontrim = $wingetversionfull.Trim('v')
if ($wingetversiontrim.EndsWith("-preview")) {
$wingetversiontrim = $wingetversiontrim.Trim('-preview')
$wingetpreview = $true
}
$wingetVersion = [System.Version]::Parse($wingetversiontrim)
$minimumWingetVersion = [System.Version]::new(1,2,10691) # Win 11 23H2 comes with bad winget v1.2.10691
$wingetOutdated = $wingetVersion -le $minimumWingetVersion
Write-Host "Winget $wingetVersionfull"
}
if (!$wingetExists -or $wingetOutdated) {
if (!$wingetExists) {
Write-Host "Winget not detected"
} else {
Write-Host "- Winget out-dated"
}
}
if ($winget) {
if ($wingetExists -and !$wingetOutdated) {
if (!$wingetpreview) {
Write-Host "- Winget up-to-date"
} else {
Write-Host "- Winget preview version detected. Unexptected problems may occur" -ForegroundColor Yellow
}
return $true
}
}
if ($choco) {
if ((Get-Command -Name choco -ErrorAction Ignore) -and ($chocoVersion = (Get-Item "$env:ChocolateyInstall\choco.exe" -ErrorAction Ignore).VersionInfo.ProductVersion)) {
Write-Host "Chocolatey v$chocoVersion"
return $true
}
}
return $false
}