Michael Niehaus' Windows and Office deployment ramblings
In MDT 2012 RTW, we supported PowerShell 2.0 in a task sequence, which worked well for what was released at the time. But with Windows 8, Windows Server 2012, and Windows PE 4.0 (the version in the Windows 8 ADK), PowerShell 3.0 is now used. MDT 2012 RTW didn’t support that.
With MDT 2012 Update 1, we’ve added support for PowerShell 3.0, so now you can use the “Run PowerShell Script” in Windows 8 and Windows Server 2012, as well as within Windows PE 4.0. And once Windows Management Framework 3.0 is released, we’ll also support PowerShell 3.0 on Windows 7 and Windows Server 2008 R2.
From a functionality perspective, you won’t see any difference in MDT 2012 Update 1 between PowerShell 2.0 and 3.0. Of course there are features in PowerShell 3.0 that aren’t present in 2.0, but MDT’s support is identical for both releases.
If you haven’t yet tried out the MDT 2012 “Run PowerShell Script” task sequence action, try it with this single-line script:
dir tsenv: | out-host
Save that into a file, e.g. DumpVar.ps1, in the scripts folder on your deployment share (or if using ConfigMgr, in the scripts folder of the MDT toolkit files package) and specify in the “Run PowerShell Script” to execute the script name, e.g. DumpVar.ps1. What you’ll find in the BDD.LOG after this script runs is a listing of all the task sequence variables defined at that point in the task sequence.
MDT is awesome, thanks! Do I need to specify an ExecutionPolicy before including one of these steps in a task sequence? Or can MDT handle changing the PS ExecutionPolicy to allow a script to run with no intervention?
MDT automatically sets the execution policy before running the script (only for that process, so it doesn't alter the computer or machine policy).
oh this i didn't know. that is kinda awesome now i won't have to set myself in the state restore phase