Skip to main content

Hello,

I am using an Automox worklet to deploy an internal application to a group of devices.

If the program is installed while the previous version is running it could cause unexpected behavior so I need to check if the program is currently running and if running then do not install but wait until the next opportunity.

Can I achieve this using the Evaluation Code section?

Right now my evaluation code looks something like this:

# Check if program is running.
$in_use = (Get-Process $program_name -ErrorAction SilentlyContinue) -ne $Null
if($in_use) {
# If running then abort and wait until next patch window.
Write-Output "Program is currently running."
exit 1
}

if($installed_version -ne $version){
Write-Output "Version $version will be installed."
exit 1
}
else {
Write-Output "Version $version is already installed"
exit 0
}

I’m not sure if my assumption is correct so I would appreciate some clarity on how the evaluation code section works

  • Will this cause the Remediation Code to wait until the next patch window?
  • When is the Evaluation Code executed?
  • Is the Evaluation Code executed every time the policy is scheduled to run?
  • Should I use “exit 0” in the case that the program is currently running in order to prevent the install from proceeding until the next patch window?

Thank you!

 

Paul

Be the first to reply!

Reply