***UPDATE 13-Oct-2014 – My post here may be relevant to you ***
This information came from here, and I am duplicating it in part on the off-chance that the originating site is down as well as being a handy reference for myself. I recommend that you visit the site for full details as you may encounter a couple of “Gotcha’s” that I have not duplicated here.
The Task sequence environment variables are easily accessible through the Microsoft.SMS.TSEnvironment ComObject .
To use this com object simply use the following line in your powershell script.
You can then easily access any existing variable using the following syntax :
Using this line will retrieve the current logging path.