Forums on Intune, SCCM, and Windows 11

Welcome to the forums. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your topics and posts, as well as connect with other members through your own private inbox!

PENDING Error on compliance remediation

  • Thread starter Thread starter Mortim3r
  • Start date Start date
  • Replies Replies 1
  • Views Views 1K

Mortim3r

Member
Messages
8
Reaction score
1
Points
3
Hello,
I would like to set up a compliance parameter to kill a process if it is started on a computer.

Here is my discovery script:
Code:
get-process mspaint -errorAction SilentlyContinue {
echo "working"
}else{
echo "notworking"
}

And my remediation script:
Code:
get-process mspaint -errorAction SilentlyContinue | stop-process

I set the returned value to be notworking, with the option to run the remediation script, but the rule gets an error when evaluated on the client machine.

If I set the contains option, the detection works fine, but I don't have a correction option

Do you have an idea ?
Thank you very much
 
try this script and you dont need to run a remidation script

if((get-process "mspaint" -ea SilentlyContinue) -eq $Null){
echo "Not Working"
}
else{
echo "Working"
Stop-Process -processname "mspaint"
}
 

Forum statistics

Threads
7,144
Messages
27,894
Members
18,190
Latest member
escdarck

Trending content

Back
Top