Prerequisites
PSAppDeployToolkit version
4.1.7
Describe the bug
I am Opening the ADTSession in a custom extension with "Open-ADTSession". For the most part this works as desired and I can access all of the variables. However, Today I noticed that when I use the custom extension with a Zero-Config MSI File it errors out due to an empty AppName. Further testing with Zero-Config file installs shows that the Manufacturer is being pulled from the MSI Correctly, however it is not being written back to the Session variable.
I also tested this without the custom extension and saw the same behavior trying to write the AppVendor to the log.
After some investigation of the DeploymentSession.cs file, I believe I have found the issue. As shown below, the section that is responsible for writing the Manufacturer back to the AppVendor is missing.
|
// Update our app variables with new values. |
|
var msiProps = (IReadOnlyDictionary<string, object>)ModuleDatabase.InvokeScript(ScriptBlock.Create("$gmtpParams = @{ Path = $args[0] }; if ($args[1]) { $gmtpParams.Add('TransformPath', $args[1]) }; & $Script:CommandTable.'Get-ADTMsiTableProperty' @gmtpParams -Table Property"), DefaultMsiFile!, DefaultMstFile!).First().BaseObject; |
|
if (string.IsNullOrWhiteSpace(_appName)) |
|
{ |
|
_appName = (string)msiProps["ProductName"]; |
|
} |
|
if (string.IsNullOrWhiteSpace(_appVersion)) |
|
{ |
|
_appVersion = (string)msiProps["ProductVersion"]; |
|
} |
|
WriteLogEntry($"App Vendor [{(string)msiProps["Manufacturer"]}]."); |
|
WriteLogEntry($"App Name [{(string)msiProps["ProductName"]}]."); |
|
WriteLogEntry($"App Version [{(string)msiProps["ProductVersion"]}]."); |
|
Settings |= DeploymentSettings.UseDefaultMsi; |
Before I put in a Pull Request to fix this however, I wanted to verify if this is actually the problem and if this is by design for some reason.
Steps to reproduce
1.Add any MSI to Files Directory.
2.Add A Write to Log Command to any Script section, I used Post-Install.
Ex: Write-ADTLogEntry -Message "AppVendor is: [$($ADTSession.AppVendor)]
3.Confirm in the Log that the Log Entry is empty.
Environment data
OsName : Microsoft Windows 11 Enterprise
OsOperatingSystemSKU : EnterpriseEdition
OsArchitecture : 64-bit
WindowsVersion : 2009
WindowsProductName : Windows 10 Enterprise
WindowsBuildLabEx : 22621.1.amd64fre.ni_release.220506-1250
OsLanguage : en-US
OsMuiLanguages : {en-US}
KeyboardLayout : en-US
TimeZone : (UTC-05:00) Eastern Time (US & Canada)
HyperVisorPresent : True
CsPartOfDomain : True
CsPCSystemType : Desktop
Prerequisites
PSAppDeployToolkit version
4.1.7
Describe the bug
I am Opening the ADTSession in a custom extension with "Open-ADTSession". For the most part this works as desired and I can access all of the variables. However, Today I noticed that when I use the custom extension with a Zero-Config MSI File it errors out due to an empty AppName. Further testing with Zero-Config file installs shows that the Manufacturer is being pulled from the MSI Correctly, however it is not being written back to the Session variable.
I also tested this without the custom extension and saw the same behavior trying to write the AppVendor to the log.
After some investigation of the DeploymentSession.cs file, I believe I have found the issue. As shown below, the section that is responsible for writing the Manufacturer back to the AppVendor is missing.
PSAppDeployToolkit/src/PSADT/PSADT/Module/DeploymentSession.cs
Lines 371 to 384 in f586fa3
Before I put in a Pull Request to fix this however, I wanted to verify if this is actually the problem and if this is by design for some reason.
Steps to reproduce
1.Add any MSI to Files Directory.
2.Add A Write to Log Command to any Script section, I used Post-Install.
Ex: Write-ADTLogEntry -Message "AppVendor is: [$($ADTSession.AppVendor)]
3.Confirm in the Log that the Log Entry is empty.
Environment data