Reg2CI icon indicating copy to clipboard operation
Reg2CI copied to clipboard

Exit codes as per MS requirements?

Open l4m3us3r opened this issue 1 year ago • 2 comments

Currently https://reg2ps.azurewebsites.net/ seems to output check scripts with: return $false or $true

Whereas MS states that "A remediation script only runs if the detection script uses exit code: exit 1, meaning the issue was detected."(https://learn.microsoft.com/en-us/mem/analytics/remediations)

Forgive my ignorance if return $false is the same as exit 1, but given that I have run across a couple websites that recommend editing the reg2ps output to use exit 1 and some colleagues that claim reg2ps output doesn't work, I thought I would take a second to log it as an issue for your clarification.

cheers,

l4m3us3r avatar Jun 22 '23 21:06 l4m3us3r

return $false is not the same as exit 1... Reg2PS returns $true or $false.... if other solutions require different result types, you may have to convert the output...

rzander avatar Jun 23 '23 08:06 rzander

HI @rzander, I've just encountered this issue too - I used https://reg2ps.azurewebsites.net to create a PowerShell script to use with Microsoft's Intune remediation feature, only to find that it didn't work, and I've now realised that it's because it returns $true instead of "exit 1".

I'm not skilled enough with PowerShell to be able to confidently modify the script as needed.

Would you be willing to update your tool at https://reg2ps.azurewebsites.net to offer this as an option?

For example, there could be a checkbox there like "Use exit codes instead of $true or $false" - or something like that. What do you think?

GermanKiwi avatar Feb 23 '24 16:02 GermanKiwi