How do I use Conditional Enforcement to keep policy from being enforced on Win11.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How do I use Conditional Enforcement to keep policy from being enforced on Win11.

L1 Bithead

I'm new to EPM and I have an Elevate policy for installing some programs; however, I don't want these programs to install on Windows 11. I was thinking that Conditional Enforcement could help. Since it says, "Enforce when script returns 0", I made a simple PowerShell script that exits 0 when win10 is detected and exits 1 when win10 isn't detected.

 

Since these programs are only allowed by this policy, I would think that adding this script would break it for Windows 11 machines. Which is what I want.

 

However, the policy still allows me to install these programs on my Win11 machine. Am I doing something wrong or missing something obvious?

 

My script:

[string]$osname = (Get-WmiObject Win32_OperatingSystem).Caption if ($osname -like "*Windows 10*") { exit 0 } else { exit 1 }

 

2 REPLIES 2

L4 Transporter

Seems like your idea should work. please make sure the policy arrived the endpoint. You can add few log file debug output to see that the script was indeed executed and return the correct result.

L1 Bithead

How do I get the extra debug output?

  • 377 Views
  • 2 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!