Execution Policy

There are a few ways to set the PowerShell Execution Policy in WinSE. I'll start with the easiest

AutoUnattend.xml Method

By far the easiest way to set the PowerShell Execution Policy to Bypass is to use an AutoUnattend.xml with a RunSynchronous Command

    <settings pass="windowsPE">
        <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <UserData>
                <AcceptEula>true</AcceptEula>
                <ProductKey>
                    <Key>NPPR9-FWDCX-D2C8J-H872K-2YT43</Key>
                    <WillShowUI>Never</WillShowUI>
                </ProductKey>
            </UserData>
            <RunSynchronous>
                <RunSynchronousCommand wcm:action="add">
                    <Order>1</Order>
                    <Description>OSD ExecutionPolicy</Description>
                    <Path>PowerShell -WindowStyle Hidden -Command "Set-ExecutionPolicy Bypass"</Path>
                </RunSynchronousCommand>
            </RunSynchronous>
        </component>
    </settings>

That does the trick

Driver Method (OSDBuilder)

You can easily create your own Driver INF and add that to WinSE (WinPE and WinRE too) to set the Execution Policy. OSDBuilder easily lets you add this Driver

Last updated

Was this helpful?