If you need to rerun provisioning on the Win10 box, and Defender has been disabled in a prior run, the calls to Set-MpPreference and Add-MpPreference will fail with a NativeCommandError and prevent the script from succeeding. This commit adds some idempotency via a check to see if the service is already disabled before running these commands.
If you need to rerun provisioning on the Win10 box, and Defender has been disabled in a prior run, the calls to Set-MpPreference and Add-MpPreference will fail with a NativeCommandError and prevent the script from succeeding. This commit adds some idempotency via a check to see if the service is already disabled before running these commands.