SFC /Scannow Not Working

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Locked
jordandombrowski
Posts: 4
Last visit: Wed Jun 08, 2022 10:03 pm

SFC /Scannow Not Working

Post by jordandombrowski »

Product: PowerShell Studio 2022 (64 Bit)
Build: v5.8.206
OS: Windows 10 Pro (64 Bit)
Build: v10.0.19044.0


If I create a Powershell script with SFC /Scannow and run the script it works fine, but if I build the script into an .exe then it fails with the error: "Windows Resource Protection could not start the repair service."

For my building settings script engine I am using a target of Microsoft Windows 32bit, Windows PowerShell, and SAPIEN Powershell V5 Host (Command Line)

Any advice would be great, thanks!
jvierra
Posts: 15221
Last visit: Wed Jun 29, 2022 5:42 pm
Answers: 23
Has voted: 4 times
Been upvoted: 21 times

Re: SFC /Scannow Not Working

Post by jvierra »

Tools like that need to be run elevated and they will not work if run under some restricted conditions.

Be sure you are signing the EXE. Other than that there is not enough information to know what is going wrong. Start by investigating the logs.
jvierra
Posts: 15221
Last visit: Wed Jun 29, 2022 5:42 pm
Answers: 23
Has voted: 4 times
Been upvoted: 21 times

Re: SFC /Scannow Not Working

Post by jvierra »

Also, you can't run a 64-bit app in a 32-bit host. On 64-bit Windows the utilities are 64 bits. You should get the 32-bit version if running a 32-bit app, so it is more likely that running SFC as a child process requires elevation or there are other issues with your script or system.

Since your issue is about the Sapien product, you should post this issue in the Sapien support forum for PSS.
jordandombrowski
Posts: 4
Last visit: Wed Jun 08, 2022 10:03 pm

Re: SFC /Scannow Not Working

Post by jordandombrowski »

I am running the exe with elevated permissions. I am not running the exe from within PowerShell Studio. I created a 32-bit exe and I am running it on my 64-bit Windows 10.
jvierra
Posts: 15221
Last visit: Wed Jun 29, 2022 5:42 pm
Answers: 23
Has voted: 4 times
Been upvoted: 21 times

Re: SFC /Scannow Not Working

Post by jvierra »

jordandombrowski wrote: Tue May 24, 2022 1:42 am I am running the exe with elevated permissions. I am not running the exe from within PowerShell Studio. I created a 32-bit exe and I am running it on my 64-bit Windows 10.
Still not enough information to even venture a guess beyond what I posted above. Read the earlier posts and try the rest of the instructions.
User avatar
Alexander Riedel
Posts: 7999
Last visit: Tue Jun 28, 2022 5:15 pm
Answers: 12
Been upvoted: 24 times

Re: SFC /Scannow Not Working

Post by Alexander Riedel »

There is a 32 bit and 64 bit sfc.exe. Since you packaged with a 32 Bit engine the 32 bit SFC.exe will be executed unless you use a specific non-mapped path. What you run in the console on a 64 bit system is (I bet) the 64 bit version. You are mixing platforms for some reason and that never works reliably.
Alexander Riedel
SAPIEN Technologies, Inc.
Locked