Custom variable not working from appdeploytoolkitextensions

i have a custom variable that for some reason works beautifully when i put in the deploy-application.ps1 but if i have it baked into my appdeploytoolkitextensions.ps1 above my other functions the variable doesn’t return anything?

this variable:

[string]$envUserProfilePath = Get-UserProfiles -ExcludeSystemProfiles:$true -ExcludeDefaultUser:$true | Where { $.NTAccount -inotlike “NT SERVICE*” } | ForEach { If ($.NTAccount.Split(’’)[1] -ieq ($env:COMPUTERNAME).Split(’-’)[1]) { $_.ProfilePath }}

just pulls the end users username from the computername so that we can target a specific user on a specific machine. as stated when it’s in the deploy-application it works perfectly but in the extensions it doesn’t do anything.

Try using a scope in the variable name? Like $global:envUserProfilePath instead of just $envUserProfilePath.

gave that a shot and it still doesn’t return anything when the variable isn’t in the main deploy-application.ps1 file.

I just tested using a simple variable assignment and it worked fine for me…

i put my variable on line 34 of the extensions.ps1 and to test i throw a show-installationprompt with the message displaying my variable and it’s not coming through.

I’m not sure what I could be missing here.