$dirSupportFiles in PSADT 4

Hi
I can’t seem to get PSADT 4 to use the $dirSupportFiles-variable. Has it changed?

Thanks

/Michael

This, along with several other variables, are now tied to the $adtSession object. To access this variable, you’d use $adtSession.DirSupportFiles now.

To see all the variables are are now part of the active session, please check out ADTSession Object · PSAppDeployToolkit.

Aaah, ok. Thank you.

1 Like

If I use: Copy-ADTFile -Path “$adtSession.DirSupportFiles\test.txt” -Destination “C:\Test”, I get:

Copy-ADTFile : Cannot find path “.DirSupportFiles”

When accessing member properties of variables in strings, you need to subexpress them. So for your example, that would be: "$($adtSession.DirSupportFiles)\test.txt".

Thanks again - that worked when running the full script.
I can’t seem to tab through the PSADT-variables. In version 3, I would run AppDeployToolkitMain.ps1 to get access to the variables.
In version 4, I apparently need to do an Open-ADTSession with some parameters? Is there a generic command, that can be run to enable the variables or is it soecific to each new template?

You can instantiate an empty session with something basic like $adtSession = Open-ADTSession -SessionState $ExecutionContext.SessionState -PassThru. Once that’s ran in your terminal, all variables will be accessible. The variables that are tied to your deployment session will be member properties of $adtSession.

Great - thank you very much.

1 Like