Posted on 2012-09-13
Last Modified: 2013-07-22
I am trying to run a powershell script in WinPE. I have followed the steps given in the below link, created winPE.wim file and ISO.

After booting the PC using the created ISO file, I am not able to execute the powershell scripts in WinPE and powershell.exe itself is not available in WinPE. X:\windows\System32>Powershell

Anyone tried this? Can somebody suggest on this?
Question by:KC2TC
    LVL 39

    Expert Comment

    by:Krzysztof Pytko
    Have you done successfully all mentioned steps with commit to apply changes into WIM file?

    LVL 77

    Accepted Solution

    dism requires run as administrator

    @echo off
    xcopy "c:\Program Files (x86)\Windows Kits\8.0\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\en-us\winpe.wim"
    Imagex /mountrw C:\WinPE_x64\winpe.wim 1 C:\Mount
    cd /d "C:\Program Files (x86)\Windows Kits\8.0\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs"
    dism /image:C:\Mount /add-package /packagepath:""
    dism /image:C:\Mount /add-package /packagepath:"en-us\"
    dism /image:C:\Mount /add-package /packagepath:""
    dism /image:C:\Mount /add-package /packagepath:"en-us\"
    dism /image:C:\Mount /add-package /packagepath:""
    dism /image:C:\Mount /add-package /packagepath:"en-us\"
    dism /image:C:\Mount /add-package /packagepath:""
    dism /image:C:\Mount /add-package /packagepath:"en-us\"
    dism /image:C:\Mount /add-package /packagepath:""
    dism /image:C:\Mount /add-package /packagepath:"en-us\"
    dism /image:C:\Mount /add-package /packagepath:""
    dism /image:C:\Mount /add-package /packagepath:"en-us\"
    dism /image:C:\Mount /add-package /packagepath:""
    dism /image:C:\Mount /add-package /packagepath:"en-us\"
    Imagex /unmount /commit C:\Mount
    md c:\WinPE_x64\iso
    xcopy "C:\Program Files (x86)\Windows Kits\8.0\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\Media\*" C:\WinPE_x64\ISO /a
    md C:\WinPE_x64\ISO\Sources folder 
    xcopy C:\WinPE_x64\winpe.wim C:\WinPE_x64\ISO\Sources\boot.wim /y
    xcopy "C:\Program Files (x86)\Windows Kits\8.0\Assessment and Deployment Kit\Deployment and Imaging Tools\amd64\Oscdimg\" C:\WinPE_x64 /y
    oscdimg -b"c:\WinPE_X64\" -n C:\WinPE_X64\ISO C:\WinPE_X64\WinPE_X64.iso
    Echo Done, you now have a 330 MB or so ISO.

    Open in new window

    Virtual Machine it works

    Author Comment

    Thank you! I will try now!

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    The default behavior of the User Account Control (UAC) dialog is to disable (gray-out) the rest of the desktop when prompting for elevation. This is known as secure desktop. There are reasons that you may want to disable this secure desktop behavior…
    Sometimes drives fill up and we don't know why.  If you don't understand the best way to use the tools available, you may end up being stumped as to why your drive says it's not full when you have no space left!  Here's how you can find out...
    The goal of this Micro Tutorial is to help navigate beginning users with the app store on Windows 8. It will explain exciting features how to maximize your PC through these apps. This will be demonstrated using Windows 8 operating system.
    With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now