PENDING Error on compliance remediation

Mortim3r

Member
6
0
1
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
 

AhmedLS

Well-Known Member
82
7
8
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
5,430
Messages
21,143
Members
11,616
Latest member
sccmgeek