Set-WimExecutionPolicy

PS C:\> Get-Help Set-WimExecutionPolicy -Full
NAME
Set-WimExecutionPolicy
SYNOPSIS
Sets the PowerShell Execution Policy of a Windows Image .wim file (Mount | Set | Dismount -Save)
SYNTAX
Set-WimExecutionPolicy [-ExecutionPolicy] <String> -ImagePath <String[]> [-Index <UInt32>] [<CommonParameters>]
DESCRIPTION
Sets the PowerShell Execution Policy of a Windows Image .wim file (Mount | Set | Dismount -Save)
PARAMETERS
-ExecutionPolicy <String>
Specifies the new execution policy. The acceptable values for this parameter are:
- Restricted. Does not load configuration files or run scripts. Restricted is the default execution policy.
- AllSigned. Requires that all scripts and configuration files be signed by a trusted publisher, including scripts that you write on the local computer.
- RemoteSigned. Requires that all scripts and configuration files downloaded from the Internet be signed by a trusted publisher.
- Unrestricted. Loads all configuration files and runs all scripts. If you run an unsigned script that was downloaded from the Internet, you are prompted for permission before it runs.
- Bypass. Nothing is blocked and there are no warnings or prompts.
- Undefined. Removes the currently assigned execution policy from the current scope. This parameter will not remove an execution policy that is set in a Group Policy scope.
Required? true
Position? 1
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-ImagePath <String[]>
Specifies the location of the WIM or VHD file containing the Windows image you want to mount.
Required? true
Position? named
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-Index <UInt32>
Index of the WIM to Mount
Default is 1
Required? false
Position? named
Default value 1
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
NOTES
21.2.1 Initial Release
RELATED LINKS
https://osd.osdeploy.com/module/functions/dism/set-wimexecutionpolicy

You can't do much in PowerShell without setting the ExecutionPolicy

Example

This function will perform the following actions in one step

Set-WIMExecutionPolicy -ImagePath "D:\WinPE\sources\boot.wim" -ExecutionPolicy Bypass