Prevent SFC and DISM Automatic Repairs


Sheikh

Software Developer
Power User
VIP
Local time
5:04 AM
Posts
739
Location
Tehran, IRAN.
OS
Windows 11 Pro 25H2
Hi everyone!

I'm working on another highly customized version of Windows, and I want to prevent both automatic SFC and DISM repair operations, as they would restore the original system files and overwrite my modifications.

I also want to block users from running SFC and DISM repair commands manually. What would be the best way to achieve this?
 
Windows Build/Version
26H1

My Computers My Computers

  • At a glance

    Windows 11 Pro 25H2Ryzen 5 3500U8GBVega 8
    OS
    Windows 11 Pro 25H2
    Computer type
    Laptop
    Manufacturer/Model
    Huawei MateBook D15
    CPU
    Ryzen 5 3500U
    Memory
    8GB
    Graphics Card(s)
    Vega 8
    Screen Resolution
    FHD
    Hard Drives
    256GB Samsung SSD + 1TB HDD
    Browser
    Microsoft Edge
    Antivirus
    ESET Smart Security Premium
  • At a glance

    Windows 10 Enterprise LTSC 21H2intel core i7 6700HQ16GBNvidia Geforce GTX1060 (6GB)
    Operating System
    Windows 10 Enterprise LTSC 21H2
    Computer type
    Laptop
    Manufacturer/Model
    MSI GS73 6RF Stealth Pro
    CPU
    intel core i7 6700HQ
    Memory
    16GB
    Graphics card(s)
    Nvidia Geforce GTX1060 (6GB)
    Screen Resolution
    FHD
    Hard Drives
    128GB SSD + 1TB HDD
    Browser
    Microsoft Edge
    Antivirus
    Windows Defender
Disconnect from the internet or use Linux.
 

My Computer My Computer

At a glance

win 10amd ryzen 5-2600ng skill sniper x 16gbnvidea gtx 1050
OS
win 10
Computer type
PC/Desktop
Manufacturer/Model
home built
CPU
amd ryzen 5-2600
Motherboard
gigabyte b450m-ds3h
Memory
ng skill sniper x 16gb
Graphics Card(s)
nvidea gtx 1050
Monitor(s) Displays
benq fp 92
Hard Drives
samsung 860 evo 500gb m2 ssd
PSU
antec ea550g
Case
nzxt noctis 450
Browser
edge

My Computers My Computers

  • At a glance

    Windows 11 Pro 25H2Ryzen 5 3500U8GBVega 8
    OS
    Windows 11 Pro 25H2
    Computer type
    Laptop
    Manufacturer/Model
    Huawei MateBook D15
    CPU
    Ryzen 5 3500U
    Memory
    8GB
    Graphics Card(s)
    Vega 8
    Screen Resolution
    FHD
    Hard Drives
    256GB Samsung SSD + 1TB HDD
    Browser
    Microsoft Edge
    Antivirus
    ESET Smart Security Premium
  • At a glance

    Windows 10 Enterprise LTSC 21H2intel core i7 6700HQ16GBNvidia Geforce GTX1060 (6GB)
    Operating System
    Windows 10 Enterprise LTSC 21H2
    Computer type
    Laptop
    Manufacturer/Model
    MSI GS73 6RF Stealth Pro
    CPU
    intel core i7 6700HQ
    Memory
    16GB
    Graphics card(s)
    Nvidia Geforce GTX1060 (6GB)
    Screen Resolution
    FHD
    Hard Drives
    128GB SSD + 1TB HDD
    Browser
    Microsoft Edge
    Antivirus
    Windows Defender
Presumably with the customisation choice you've made, you will have Windows update completely disabled.

As for blocking specific exe files, as you have Pro, consider using Group Policy:

1.webp

Note: all customisations I've made are done specifically so as not to have implications for repairs, updates or upgrades.
I use Vista icons, pastel backgrounds, translucent titlebars, Open Shell with a Win 7 Orb, and of course a taskbar arranged as per Win 10.
 
Last edited:

My Computer My Computer

At a glance

Windows 11 Proi7-8650U16GBIntel UHD 620
OS
Windows 11 Pro
Computer type
Laptop
Manufacturer/Model
Lenovo t480s
CPU
i7-8650U
Memory
16GB
Graphics Card(s)
Intel UHD 620
Screen Resolution
1920x1080
Hard Drives
C SN810 SDCPNRY-512G-1006
Browser
Edge, Firefox
Antivirus
Defender
The best way to prevent users from running DISM and SFC is to just not give them admin rights. Second best, I guess, would be to deny them access to the executables by adding a deny entry to the ACL for each.
 

My Computer My Computer

At a glance

Windows 11 Pro 25H2 (in a VM)12th Gen Core i7-1260P64 GB Micron PC4-25600Intel Iris Xe Graphics
OS
Windows 11 Pro 25H2 (in a VM)
Computer type
PC/Desktop
Manufacturer/Model
Intel NUC12WSHi7
CPU
12th Gen Core i7-1260P
Motherboard
NUC12WSBi7
Memory
64 GB Micron PC4-25600
Graphics Card(s)
Intel Iris Xe Graphics
Sound Card
on-board Realtek HD Audio
Monitor(s) Displays
Dell U3219Q
Screen Resolution
3840 x 2160
Hard Drives
Samsung SSD 990 PRO 1TB
Crucial MX500 2 TB
Keyboard
CODE 104-Key mechanical with Cherry MX Clears
Antivirus
Microsoft Defender
Remove WinSXS. Problem solved!

But seriously, if you're afraid that a component-based repair will clobber the DLL files you've replaced on the filesystem, then you must be afraid of getting Monthly Updates. Because those can introduce patched files, which may end up overwriting your custom files.

A better solution is to keep track of the handful of DLL files you're replacing, and have a script to copy those files back from a backup folder.
 

My Computer My Computer

At a glance

Windows 7
OS
Windows 7
Hi everyone!

I'm working on another highly customized version of Windows, and I want to prevent both automatic SFC and DISM repair operations, as they would restore the original system files and overwrite my modifications.

I also want to block users from running SFC and DISM repair commands manually. What would be the best way to achieve this?
Hi there :-)
When i modify files and i dont want the system to repair, i change the permission on that file so system/trusted installer dont have write access to them, i also set it as write protected(if it is a file that only are used for read/run) If i remove files and i dont want the system to restore/reinstall it, i create a ghost-file that is write protected and the system/trusted installer dont have any permission to it.
If you then run dism it will give errors as you just locked out the system.
 

My Computers My Computers

  • At a glance

    Linux: Debian, Kali-linux, Alma, Win:7,10IoT,...i3, i5 and i7 From 2gen to 9th gen... Server ...
    OS
    Linux: Debian, Kali-linux, Alma, Win:7,10IoT,2012R
    Manufacturer/Model
    HP Elitebook 840, AsusX53, Aspire E1-572. AsusUX32A, HP Pro3130mt+3010mt, HP Proliant ML150, 3xCustom-PC, i3, i5, i7
    CPU
    i3, i5 and i7 From 2gen to 9th gen... Server dual Xenon
    Hard Drives
    Sata, M.2, SAS
  • At a glance

    Retro: 2003server.XPpro, Win2000, Win98SE, Wi...Oldest intel 8088 up to P4 dual core
    Operating System
    Retro: 2003server.XPpro, Win2000, Win98SE, Win95, Win3.11, MS-DOS, IBM-DOS
    Manufacturer/Model
    Commodore, AST, Fujitsu, Compaq, etc etc. etc Around 15 desktops and 20 laptops in the collection
    CPU
    Oldest intel 8088 up to P4 dual core
    Hard Drives
    MFM, IDE, SCSI

My Computers My Computers

  • At a glance

    Linux: Debian, Kali-linux, Alma, Win:7,10IoT,...i3, i5 and i7 From 2gen to 9th gen... Server ...
    OS
    Linux: Debian, Kali-linux, Alma, Win:7,10IoT,2012R
    Manufacturer/Model
    HP Elitebook 840, AsusX53, Aspire E1-572. AsusUX32A, HP Pro3130mt+3010mt, HP Proliant ML150, 3xCustom-PC, i3, i5, i7
    CPU
    i3, i5 and i7 From 2gen to 9th gen... Server dual Xenon
    Hard Drives
    Sata, M.2, SAS
  • At a glance

    Retro: 2003server.XPpro, Win2000, Win98SE, Wi...Oldest intel 8088 up to P4 dual core
    Operating System
    Retro: 2003server.XPpro, Win2000, Win98SE, Win95, Win3.11, MS-DOS, IBM-DOS
    Manufacturer/Model
    Commodore, AST, Fujitsu, Compaq, etc etc. etc Around 15 desktops and 20 laptops in the collection
    CPU
    Oldest intel 8088 up to P4 dual core
    Hard Drives
    MFM, IDE, SCSI
Wonder if we can get the eye roll emoji added as a reaction.
 

My Computer My Computer

At a glance

Windows 11 Pro 25H2 (in a VM)12th Gen Core i7-1260P64 GB Micron PC4-25600Intel Iris Xe Graphics
OS
Windows 11 Pro 25H2 (in a VM)
Computer type
PC/Desktop
Manufacturer/Model
Intel NUC12WSHi7
CPU
12th Gen Core i7-1260P
Motherboard
NUC12WSBi7
Memory
64 GB Micron PC4-25600
Graphics Card(s)
Intel Iris Xe Graphics
Sound Card
on-board Realtek HD Audio
Monitor(s) Displays
Dell U3219Q
Screen Resolution
3840 x 2160
Hard Drives
Samsung SSD 990 PRO 1TB
Crucial MX500 2 TB
Keyboard
CODE 104-Key mechanical with Cherry MX Clears
Antivirus
Microsoft Defender
Wonder if we can get the eye roll emoji added as a reaction.
You can always use the wow and then reply with a smily rolling its eyes. 😁(y)

I have a feeling you saw i was sarcastic/ironic in my linux quote. :wink:
 

My Computers My Computers

  • At a glance

    Linux: Debian, Kali-linux, Alma, Win:7,10IoT,...i3, i5 and i7 From 2gen to 9th gen... Server ...
    OS
    Linux: Debian, Kali-linux, Alma, Win:7,10IoT,2012R
    Manufacturer/Model
    HP Elitebook 840, AsusX53, Aspire E1-572. AsusUX32A, HP Pro3130mt+3010mt, HP Proliant ML150, 3xCustom-PC, i3, i5, i7
    CPU
    i3, i5 and i7 From 2gen to 9th gen... Server dual Xenon
    Hard Drives
    Sata, M.2, SAS
  • At a glance

    Retro: 2003server.XPpro, Win2000, Win98SE, Wi...Oldest intel 8088 up to P4 dual core
    Operating System
    Retro: 2003server.XPpro, Win2000, Win98SE, Win95, Win3.11, MS-DOS, IBM-DOS
    Manufacturer/Model
    Commodore, AST, Fujitsu, Compaq, etc etc. etc Around 15 desktops and 20 laptops in the collection
    CPU
    Oldest intel 8088 up to P4 dual core
    Hard Drives
    MFM, IDE, SCSI
Reference post 3.
Neither dism nor sfc are automatic.,they are started via Terminal.
Disconnecting from the Internet is to provide a stable platform if you intend to mess around with registry modification.
Reference post 10.
Suggesting Linux was because tampering with the registry there is common practice.
Your attempt at sarcasm is misplaced.
 

My Computer My Computer

At a glance

win 10amd ryzen 5-2600ng skill sniper x 16gbnvidea gtx 1050
OS
win 10
Computer type
PC/Desktop
Manufacturer/Model
home built
CPU
amd ryzen 5-2600
Motherboard
gigabyte b450m-ds3h
Memory
ng skill sniper x 16gb
Graphics Card(s)
nvidea gtx 1050
Monitor(s) Displays
benq fp 92
Hard Drives
samsung 860 evo 500gb m2 ssd
PSU
antec ea550g
Case
nzxt noctis 450
Browser
edge
For additional context, I have completely disabled Windows Update, and I don't want to restrict file permissions because I want advanced users to retain full control over modifying system files.

My goal is simply to disable the SFC and DISM commands entirely. Replacing files with a script is not a viable solution, as some files need to be modified during future processes. Likewise, changing file permissions is not an option because I want users to have full access.

Based on the replies so far, it appears that Microsoft does not provide an official way to disable these commands. It seems I will have to come up with some unconventional workaround to achieve the same result.

At least, is there any way to prevent automatic repair? for example disabling a default scheduled task.
 

My Computers My Computers

  • At a glance

    Windows 11 Pro 25H2Ryzen 5 3500U8GBVega 8
    OS
    Windows 11 Pro 25H2
    Computer type
    Laptop
    Manufacturer/Model
    Huawei MateBook D15
    CPU
    Ryzen 5 3500U
    Memory
    8GB
    Graphics Card(s)
    Vega 8
    Screen Resolution
    FHD
    Hard Drives
    256GB Samsung SSD + 1TB HDD
    Browser
    Microsoft Edge
    Antivirus
    ESET Smart Security Premium
  • At a glance

    Windows 10 Enterprise LTSC 21H2intel core i7 6700HQ16GBNvidia Geforce GTX1060 (6GB)
    Operating System
    Windows 10 Enterprise LTSC 21H2
    Computer type
    Laptop
    Manufacturer/Model
    MSI GS73 6RF Stealth Pro
    CPU
    intel core i7 6700HQ
    Memory
    16GB
    Graphics card(s)
    Nvidia Geforce GTX1060 (6GB)
    Screen Resolution
    FHD
    Hard Drives
    128GB SSD + 1TB HDD
    Browser
    Microsoft Edge
    Antivirus
    Windows Defender
Have you not considered the group policy option in my post #4? That seems pretty 'official' to me..!

Oh, and given your emphasis on a fixed, non-updated build that would be wrecked by standard repair methods, you are of course routinely using 3rd party disk imaging so as to restore it when things go wrong or should your disk fail e.g.
 

My Computer My Computer

At a glance

Windows 11 Proi7-8650U16GBIntel UHD 620
OS
Windows 11 Pro
Computer type
Laptop
Manufacturer/Model
Lenovo t480s
CPU
i7-8650U
Memory
16GB
Graphics Card(s)
Intel UHD 620
Screen Resolution
1920x1080
Hard Drives
C SN810 SDCPNRY-512G-1006
Browser
Edge, Firefox
Antivirus
Defender
Have you not considered the group policy option in my post #4? That seems pretty 'official' to me..!

Oh, and given your emphasis on a fixed, non-updated build that would be wrecked by standard repair methods, you are of course routinely using 3rd party disk imaging so as to restore it when things go wrong or should your disk fail e.g.
I know from 10Forums you are pretty deep in to windows if i remember right. :-) :-)

from post 14: ((( My goal is simply to disable the SFC and DISM commands entirely. )))
I dont have a windows computer in front of me and i trashed my test-VM.. sfc and dism is those two tied to exe files, or is it just system commands?
 

My Computers My Computers

  • At a glance

    Linux: Debian, Kali-linux, Alma, Win:7,10IoT,...i3, i5 and i7 From 2gen to 9th gen... Server ...
    OS
    Linux: Debian, Kali-linux, Alma, Win:7,10IoT,2012R
    Manufacturer/Model
    HP Elitebook 840, AsusX53, Aspire E1-572. AsusUX32A, HP Pro3130mt+3010mt, HP Proliant ML150, 3xCustom-PC, i3, i5, i7
    CPU
    i3, i5 and i7 From 2gen to 9th gen... Server dual Xenon
    Hard Drives
    Sata, M.2, SAS
  • At a glance

    Retro: 2003server.XPpro, Win2000, Win98SE, Wi...Oldest intel 8088 up to P4 dual core
    Operating System
    Retro: 2003server.XPpro, Win2000, Win98SE, Win95, Win3.11, MS-DOS, IBM-DOS
    Manufacturer/Model
    Commodore, AST, Fujitsu, Compaq, etc etc. etc Around 15 desktops and 20 laptops in the collection
    CPU
    Oldest intel 8088 up to P4 dual core
    Hard Drives
    MFM, IDE, SCSI
Yes, they are .exe files

Here's a different approach which might work for those (note the caveat in the video).

Not a 'nice' method, but possible in Home too.

And of course there's Applocker

E.g. 1 of the related Applocker tutorials:
 
Last edited:

My Computer My Computer

At a glance

Windows 11 Proi7-8650U16GBIntel UHD 620
OS
Windows 11 Pro
Computer type
Laptop
Manufacturer/Model
Lenovo t480s
CPU
i7-8650U
Memory
16GB
Graphics Card(s)
Intel UHD 620
Screen Resolution
1920x1080
Hard Drives
C SN810 SDCPNRY-512G-1006
Browser
Edge, Firefox
Antivirus
Defender

Latest Support Threads

Back
Top Bottom