Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] All custom variables are stripped from app Variables v3 to v4 #8

Open
3 tasks done
digiman57 opened this issue Jan 12, 2025 · 2 comments
Open
3 tasks done
Assignees
Labels
bug Something isn't working

Comments

@digiman57
Copy link

Prerequisites

PSAppDeployToolkit.Tools version

0.2.2

PSAppDeployToolkit version

4.04

Describe the bug

Win10 VMware VM. I converted a couple v3 scripts that had string variables similar to built in variables (all listed under AppScriptAuthor) , such as [string]$MSIName1 = 'MSI_Name', etc.
The built in variables are the only variables to show up in the converted v4 script. 2nd problem, is none of these extra or custom variables in the head of the old v3 script are set to the new switch, down in the sections of the script. Ex: #MSIName1 should be converted to $adtSession.MSIName1, but the variable shows up like this, $MSIName1. My scripts can contain up to 18 custom variables (as I really only had to file data in the variables and rarely touch the script. I had if statements thoughout the different sections that used the custom variables at the head, and would even use them in the fuctions, such as $InstallTime in the line for Show-InstallationProgress. That variable is there in the line, without the new formatting, but it is also missing in the head of the script as the custom variables were stripped out.

Steps to reproduce

  1. I installed the latest ADT toolkit in a powershell console and also installed the Tools modules as of 1-11-25
  2. I ran Convert-ADTDeployment and converted a template v.3.10.2 script and later a full blown app script
  3. The invoke-AppDeployToolkit.ps1 in each case were missing all the custom variables at the head and inside the pre, install, post, etc. sections, the custom variables were lacking the new format form.

Environment data

OsName               : Microsoft Windows 10 Enterprise
OsOperatingSystemSKU : EnterpriseEdition
OsArchitecture       : 64-bit
WindowsVersion       : 2009
WindowsProductName   : Windows 10 Enterprise
WindowsBuildLabEx    : 19041.1.amd64fre.vb_release.191206-1406
OsLanguage           : en-US
OsMuiLanguages       : {en-US}
KeyboardLayout       : en-US
TimeZone             : (UTC-06:00) Central Time (US & Canada)
HyperVisorPresent    : True
CsPartOfDomain       : False
CsPCSystemType       : Desktop


Host:
  Version:      8.0.2
  Architecture: x64
  Commit:       1381d5ebd2
  RID:          win-x64

.NET SDKs installed:
  No SDKs were found.

.NET runtimes installed:
  Microsoft.NETCore.App 5.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 5.0.8 [C:\Program Files\dotnet\shared\Microsoft.Windows
Desktop.App]
  Microsoft.WindowsDesktop.App 6.0.6 [C:\Program Files\dotnet\shared\Microsoft.Windows
Desktop.App]
  Microsoft.WindowsDesktop.App 7.0.0 [C:\Program Files\dotnet\shared\Microsoft.Windows
Desktop.App]
  Microsoft.WindowsDesktop.App 8.0.2 [C:\Program Files\dotnet\shared\Microsoft.Windows
Desktop.App]

Other architectures found:
  None

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download
@digiman57 digiman57 added the bug Something isn't working label Jan 12, 2025
@DanGough
Copy link
Collaborator

Currently it only converts known variables plus the code blocks within the main If statement. But I will look into adding any unknown variables outside of here also.

@DanGough DanGough self-assigned this Jan 24, 2025
@digiman57
Copy link
Author

Thanks DanGough, I work with other techs who also use added variables in the V3 Variables Declaration section at the head of the script, or V3, the APp Variables section.
These are just a bit of the added variables I have added to our templates.
[String]$appScriptAuthor = ''
[string]$MSIName1 = 'MSI_Name'
[string]$MSTName1 = 'MST_Name'
[string]$EXEName = 'Name_of_EXE-Here'
etc.
All of these variables means I can put Install time (for the dialog), Parameters for MSI, Exe, uninstall details, etc.
This lets us fill out a package doc and copy and paste into the variable section and not touch the body of the script.
Just giving you an idea how we use the variables.
If the install is an engineering install script, we may also use ADT functions to grab app installed details and create functions per the app we are dealing with, possible in all the sections of the script. All of the added or custom variables missing from the head appear unaltered in the script and converted over OK, so for now, I will make sure and add our custom variables back into the head of the converted script.
I appreciate your help or thinking about letting us see the added custom variables carried over with the conversion from V3 to v4 process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants