Automation

Everything can be added to an AutoUnattend.xml in three separate Commands

The Execution Policy must be run first as the OSD Module will not be imported without having this done first. We know this works properly, so -WindowStyle Hidden will be used to hide the console

The second Command will update the OSD Module and add additional Modules. This must be kept separate so additional Run Commands that are in additional steps will use the updated Modules. This window will be kept visible and a Pause will be added. Verbose output is recommended

Finally, all the other settings can be put together in the third command. Again, Verbose and a Pause will help for the test
<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>ExecutionPolicy Bypass</Description>
<Path>PowerShell -WindowStyle Hidden -Command "Set-ExecutionPolicy Bypass"</Path>
</RunSynchronousCommand>
<RunSynchronousCommand wcm:action="add">
<Order>2</Order>
<Description>Add PowerShell Modules</Description>
<Path>PowerShell -Command "& {OSDWinPE -Modules -Verbose; Pause}"</Path>
</RunSynchronousCommand>
<RunSynchronousCommand wcm:action="add">
<Order>3</Order>
<Description>OSD Settings</Description>
<Path>PowerShell -Command "& {OSDPower High -Verbose; OSDWinPE -InitializeNetwork -DisableFirewall -UpdateBootInfo -RemoteRecovery -Verbose; Pause}"</Path>
</RunSynchronousCommand>
</RunSynchronous>
</component>
</settings>

<RunSynchronous>
<RunSynchronousCommand wcm:action="add">
<Order>1</Order>
<Description>ExecutionPolicy Bypass</Description>
<Path>PowerShell -WindowStyle Hidden -Command "Set-ExecutionPolicy Bypass"</Path>
</RunSynchronousCommand>
<RunSynchronousCommand wcm:action="add">
<Order>2</Order>
<Description>Add PowerShell Modules</Description>
<Path>PowerShell -WindowStyle Hidden -Command "& {Start-Transcript;OSDWinPE -Modules -Verbose;Stop-Transcript}"</Path>
</RunSynchronousCommand>
<RunSynchronousCommand wcm:action="add">
<Order>3</Order>
<Description>OSD Settings</Description>
<Path>PowerShell -WindowStyle Hidden -Command "& {Start-Transcript;OSDPower High -Verbose;OSDWinPE -InitializeNetwork -DisableFirewall -UpdateBootInfo -RemoteRecovery -Verbose;Stop-Transcript}"</Path>
</RunSynchronousCommand>
</RunSynchronous>

Copy link
On this page
AutoUnattend.xml
Execution Policy
Add Modules
Commands
Execution
Full Automation