I am trying to get MDT up and running, it is kinda getting there but I am having some issues with getting it to join the domain. I get an error along the. Software updates, drivers, downloads and hardware from Microsoft. SMS. TSEnvironment tsenv. ValueMy. Var My ValueMaybe you want to do something a little more involved, like create an transcript log of the execution of your script. You can use the SMSTSLog. Path variable to determine where to place the file Determine where to do the logging tsenv New Object COMObject Microsoft. SMS. TSEnvironment log. Path tsenv. ValueSMSTSLog. Microsoft Deployment Toolkit Lite Touch Power' title='Microsoft Deployment Toolkit Lite Touch Power' />Path log. File log. Pathmy. Invocation. My. Command. Start the logging Start Transcript log. File Insert your real logic here Write Host We are logging to log. File Stop logging Stop Transcript. Another useful example is a script that logs the values of all task sequence variables Determine where to do the logging tsenv New Object COMObject Microsoft. SMS. TSEnvironment log. Path tsenv. ValueSMSTSLog. Path log. File log. Pathmy. Invocation. My. Command. log Start the logging Start Transcript log. File Write all the variables and their values tsenv. Get. Variables Write Host tsenv. Value Stop logging Stop Transcript. Or you could use the same technique to turn all the task sequence variables into Power. Shell variables Determine where to do the logging tsenv New Object COMObject Microsoft. SMS. TSEnvironment log. Path tsenv. ValueSMSTSLog. Path log. File log. Pathmy. Invocation. My. Command. log Start the logging Start Transcript log. Windows Loader V2 1 Zip System more. File Convert the task sequence variables into Power. Shell variables tsenv. Get. Variables Set Variable Name Value tsenv. Value Write out a specific variable value Write Host SMSTSMData. Path Get all the variables Dir Variable Stop logging Stop TranscriptTake out all the extra stuff and this could be reduced to two lines, the one that creates the COM object and the one that calls Get. Variables. A few other notes worth mentioning You need to make sure scripts are enabled before trying to run these via a task sequence. In the case of MDT Lite Touch, the scripts will typically be run from a network UNC path. For Config. Mgr, a local path for download on demand or download and execute or a network path for run from DP will be used. You can include a step in the task sequence to set the needed execution policy, e. Command Set Execution. Policy Unrestricted, or configure the same via Group Policy. You may want to add the noprofile parameter to the Power. Shell. exe command line as the profile commands may cause issues with your script. The Microsoft. SMS. TSEnvironment COM object is only available while the task sequence is running, so you need to test your script inside of a task sequence. This can be a case where the convert task sequence environment to Power. Shell variables could come in handy do you testing with hard coded variables, remove the values before deploying the script. The task sequencer only registers the matching platform of Microsoft. SMS. TSEnvironment. For example, when the x. Microsoft. SMS. TSEnvironment will be available but the x. For an x. 64 task sequence, only the x. Microsoft. SMS. TSEnvironment will be available. Config. Mgr will run the x. Power. Shell will normally be run in this case. For MDT Lite Touch, the x. OSes and the x. 64 version is used on x. OSes. Make sure you are aware of which platform is running, as that might affect your Power. Shell script execution. Note that x. Config. Mgr task sequence, done by disabling file system redirection for the task sequence step or by specifying sysnative in the path, wont be able to create the Microsoft. SMS. TSEnvironment object because of the previous note. If you want to return an error, you should insert an exit statement in your Power. Shell script, e. g. This will cause Power. Shell. exe to return that return code to the task sequencer.