In attempting to use the Winget Extension with 4.1.7, the script works perfectly when on my test system.
When deployed via Intune, I was getting nothing except immediate fail. After turning on system wide powershell transcription, I found error messages on launching the ToolKit that state that 'The term Find-ADTWinGetPackage is not recognized as the name of a cmdlet, function..blahblah.
I suspect this may be because I am using Find-ADTWinGetPackage early in the script, outside of the Install functions. The idea is this package can be used for multiple apps so is using that to get the app name for the variables. (When the vendor updates once, we dont need to rebuild 15 packages)
[CmdletBinding()]
param
(
# Default is 'Install'.
[Parameter(Mandatory = $false)]
[ValidateSet('Install', 'Uninstall', 'Repair')]
[System.String]$DeploymentType,
# Default is 'Auto'. Don't hard-code this unless required.
[Parameter(Mandatory = $false)]
[ValidateSet('Auto', 'Interactive', 'NonInteractive', 'Silent')]
[System.String]$DeployMode,
[Parameter(Mandatory = $false)]
[ValidateSet('JRE8x86', 'JRE8x64', 'JRE11', 'JDK11', 'JRE17', 'JDK17', 'JRE21', 'JDK21', 'IcedTea')]
[System.String]$Product,
[Parameter(Mandatory = $false)]
[System.Management.Automation.SwitchParameter]$SuppressRebootPassThru,
[Parameter(Mandatory = $false)]
[System.Management.Automation.SwitchParameter]$TerminalServerMode,
[Parameter(Mandatory = $false)]
[System.Management.Automation.SwitchParameter]$DisableLogging
)
# Product and Version Specification
switch ($Product.ToLower()) {
'JRE8x86' {$wingetID = 'Azul.Zulu.8.JRE'; $wingetArch = 'x86'}
'JRE8x64' {$wingetID = 'Azul.Zulu.8.JRE'; $wingetArch = 'x64'}
'JRE11' {$wingetID = 'Azul.Zulu.11.JRE'; $wingetArch = 'x64'}
'JDK11' {$wingetID = 'Azul.Zulu.11.JDK'; $wingetArch = 'x64'}
'JRE17' {$wingetID = 'Azul.Zulu.17.JRE'; $wingetArch = 'x64'}
'JDK17' {$wingetID = 'Azul.Zulu.17.JDK'; $wingetArch = 'x64'}
'JRE21' {$wingetID = 'Azul.Zulu.21.JRE'; $wingetArch = 'x64'}
'JDK21' {$wingetID = 'Azul.Zulu.21.JDK'; $wingetArch = 'x64'}
'IcedTea' {$wingetID = 'Azul.IcedTea-Web'; $wingetArch = 'x64'}
default {
Write-ADTLogEntry -Message "Unknown Product $Product" -Severity Error
End-Script -Exitcode 1
}
}
$App = Find-ADTWinGetPackage -Query $wingetID | Select-Object Name, Version
$appName= $App.Name
$AppVersion = $App.Version
##================================================
## MARK: Variables
##================================================
# Zero-Config MSI support is provided when "AppName" is null or empty.
# By setting the "AppName" property, Zero-Config MSI will be disabled.
$adtSession = @{
# App variables.
AppVendor = 'Azul' # Who Makes the App
AppName = $appName # App Name
AppVersion = $appVersion # Version of the App
AppArch = ''
AppLang = 'EN'
AppRevision = '01'
AppSuccessExitCodes = @(0)
AppRebootExitCodes = @(1641, 3010)
AppProcessesToClose = @() # Example: @('excel', @{ Name = 'winword'; Description = 'Microsoft Word' })
AppScriptVersion = '1.0.0' # How many times you wrote this
AppScriptDate = '2025-11-06' # When are we
AppScriptAuthor = '<*********>' # Who is You
RequireAdmin = $true
# Install Titles (Only set here to override defaults set by the toolkit).
InstallName = '' # This becomes the name of the log file - Spaces are stripped out. (This text + PSAppDeployToolkit_Install or Uninstall)
InstallTitle = '' # Shows as title of InstallationWelcome Popup Window if set. Otherwise it is vendor + Name + Version from above.
# Script variables.
DeployAppScriptFriendlyName = $MyInvocation.MyCommand.Name
DeployAppScriptParameters = $PSBoundParameters
DeployAppScriptVersion = '4.1.7'
}
Is there a way around this, or am I just hosed on my plan? I prefer to leave this here instead of dropping it into the install routines as I can obtain the current version without moddifying the entire package every time.
The idea is that I could trigger an update on the systems in the environment for this application by simply modifying the detection registry key used for the update package.