I would like to see a complete sfc procedure that checks for the integrity of the OS and then depending on the results will perform an auto fix procedure to result any kind of corruption.
I looked in to this and got the procedure completely written, with checks for all the possible results, but discovered that it didn't work when I tested it.
It appears that the sfc.exe tool will only run when a user is logged in to the console. This is actually a function of the sfc.exe tool, it actively checks to ensure that it is not being automated, or even run from an RDP session. I suspect that this is due to the nature of the tool. During the repair process you may lose your remote connection, or the automation tool may stop execution and that could leave the machine in an unstable state.
I read post after post on various forums, with people trying to automate this through powershell or using psexec, but they all encountered the same issue - unless they were manually running this at the console, sfc.exe would fail.
When run remotely, or through automation, sfc.exe will report "You must be running a console session in order to use the sfc utility.", so this validation was positively coded in to the application - it is not just a silent failure.
It may be possible to use a different tool which performs the same or similar task, but sfc.exe looks to be a non-starter, but I am happy to be proven wrong.