Powershell failed adding Windows Defender Features

Duchemin, Dominique 2,006 Reputation points
2022-08-17T06:18:21.983+00:00

Hello,

I am deploying Windows_Defender_Feature_Restart.cmd

===========================================================

@Echo off
pushd "%~dp0"
PowerShell.exe -nologo -noprofile -ExecutionPolicy bypass -file "Installation Windows Defender Feature-Restart.ps1"

===========================================================

containing this "Installation Windows Defender Feature-Restart.ps1"

===========================================================

Get-WindowsOptionalFeature -Online -FeatureName "Windows-Defender*" | Format-Table
Enable-WindowsOptionalFeature -Online -FeatureName "Windows-Defender-Features"
Enable-WindowsOptionalFeature -Online -FeatureName "Windows-Defender"
Get-WindowsOptionalFeature -Online -FeatureName "Windows-Defender*" | Format-Table

===========================================================

through

231760-2022-08-16-23-16-27-deployment-w2016-features.png

I am getting an error:

231850-2022-08-16-23-09-27-deployment-w2016-features.png

If I run the command file by itself locally it works.
If I run the powershell file by itself locally it work.

Thanks,
Dom

Microsoft Configuration Manager
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Simon Ren-MSFT 29,956 Reputation points Microsoft Vendor
    2022-08-18T09:43:27.607+00:00

    Hi,

    As you have tested that the command works fine outside of ConfigMgr, the detections may have issue.

    If the application has reboot requires to complete the installation, the application will ask reboot prompt and user has privilege to defer the reboot, this error may also occur, we could view execmgr.log to see if there is any related information.

    Similar threads for your reference:
    ERROR 0X87D01106 - DEPLOYING MS PROJECT 2013 PRO
    Error code - 0x87d01106. Program will not retry

    Thanks for your time. Have a nice day.

    Best regards,
    Simon


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

  2. Frank Dong 31 Reputation points
    2022-09-07T01:23:20.96+00:00

    0x87d01106 - Failed to verify the executable file is valid or to construct the associated command line.

    It's saying that Configmgr did not recognize the '***.cmd', can be a syntax error. What about if you rename the .cmd to a .bat as I always using a bat.

    Another recommended way is using 'Running script function' which is straightforward an simple.
    https://learn.microsoft.com/en-us/mem/configmgr/apps/deploy-use/create-deploy-scripts

    1 person found this answer helpful.
    0 comments No comments