locked
Replace system files during MDT OS Deployment Task Sequence RRS feed

  • Question

  • I have PowerShell added to my WinPE.

    I want to run a PS script to drop files onto the target drive, before the OS boots the first time.

    Where is the best point in the task sequence to do this?

    Do I need to use a CMD or PowerShell task?

    Do I need to Set-ExecutionPolicy if executed from WinPE?

    Thanks,

    -Matt


    There's no place like 127.0.0.1

    Wednesday, October 21, 2015 7:48 AM

Answers

  • Hi Matt,

    I have a similar situation to you, where I have a need to copy files over to the installed OS before first boot. Generally I insert a task in the Post Install phase between the configure task and inject drivers task. I like powershell but have found it to be a bit flaky. Therefore I normally just use a command line task and use good old xcopy to do the lifting.

    The main reason for copying files at this stage for me anyway is that the locations I am copying to are generally system folder locations, and I get fewer complaints\errors as the OS is not yet loaded but the folder content and structure is in place.

    As long as the files\folders are available eg copy from location and to location it works pretty well. Someone else may give you a better explanation re Powershell and the execution policy requirements. However if you have time, test and see. Try the commands without setting the policy and if it works great, if not try it again with the policy setting.

    Ewen.

    • Marked as answer by Matt5150 Thursday, October 22, 2015 10:11 PM
    Wednesday, October 21, 2015 8:49 AM
  • You can add powershell to WinPE but, there is a bug in the ADK so also select DISM cmdlets.

    Logs are very important. If you are unsure how to post logs or where to find them then reference https://keithga.wordpress.com/2014/10/24/video-mdt-2013-log-files-basics-bdd-log-and-smsts-log/ Also if you have made customizations please mention them when asking for help.

    • Marked as answer by Matt5150 Thursday, October 22, 2015 10:11 PM
    Wednesday, October 21, 2015 8:10 PM

All replies

  • Hi Matt,

    I have a similar situation to you, where I have a need to copy files over to the installed OS before first boot. Generally I insert a task in the Post Install phase between the configure task and inject drivers task. I like powershell but have found it to be a bit flaky. Therefore I normally just use a command line task and use good old xcopy to do the lifting.

    The main reason for copying files at this stage for me anyway is that the locations I am copying to are generally system folder locations, and I get fewer complaints\errors as the OS is not yet loaded but the folder content and structure is in place.

    As long as the files\folders are available eg copy from location and to location it works pretty well. Someone else may give you a better explanation re Powershell and the execution policy requirements. However if you have time, test and see. Try the commands without setting the policy and if it works great, if not try it again with the policy setting.

    Ewen.

    • Marked as answer by Matt5150 Thursday, October 22, 2015 10:11 PM
    Wednesday, October 21, 2015 8:49 AM
  • Do these files need to be in the image or only applied to specific task sequences? If you need it in the image, I'd say use DISM to mount the WIM and add the files.

    Simply copying files for specific TS? I agree jewen, use the copy command instead. After the drive is formatted the OSDisk will be assigned C:

    You can add your copy command to the Preinstall group in your task sequence, before "Inject Drivers" should work.


    If this post is helpful please vote it as Helpful or click Mark for answer.

    Wednesday, October 21, 2015 1:55 PM
  • I'll give that a try.  Every time I try to use PowerShell for something I get forced back into using old CMD files!

    Thanks!


    There's no place like 127.0.0.1

    Wednesday, October 21, 2015 2:56 PM
  • It will be a per OS thing, but I'd rather store multiple Task Sequences, then multiple WIM files for these custom builds.

    I'll give the CMD / Batch method a try.


    Thanks,

    -Matt


    There's no place like 127.0.0.1

    Wednesday, October 21, 2015 2:58 PM
  • You can add powershell to WinPE but, there is a bug in the ADK so also select DISM cmdlets.

    Logs are very important. If you are unsure how to post logs or where to find them then reference https://keithga.wordpress.com/2014/10/24/video-mdt-2013-log-files-basics-bdd-log-and-smsts-log/ Also if you have made customizations please mention them when asking for help.

    • Marked as answer by Matt5150 Thursday, October 22, 2015 10:11 PM
    Wednesday, October 21, 2015 8:10 PM
  • You can add powershell to WinPE but, there is a bug in the ADK so also select DISM cmdlets.

    Logs are very important. If you are unsure how to post logs or where to find them then reference https://keithga.wordpress.com/2014/10/24/video-mdt-2013-log-files-basics-bdd-log-and-smsts-log/ Also if you have made customizations please mention them when asking for help.

    Ha!  Funny you should mention that.  I noticed an odd error in WinPE "WARNING: PowerShell was not detected."

    I checked my WinPE settings in MDT, and PowerShell was enabled.

    On a whim I decided to enable DISM cmdlets and completely regenerate the boot images.

    I'm still waiting on that process to complete before testing.

    Thanks!


    There's no place like 127.0.0.1

    Wednesday, October 21, 2015 8:27 PM
  • OK, rebuilding the Boot Images with DISM cmdlets seems to have done the trick.  I ran into another problem but since this answered my original question, I'll start another thread.

    Thanks!


    There's no place like 127.0.0.1

    Thursday, October 22, 2015 10:10 PM