Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
I need to block apps like gpedit.msc, resmon.exe, msconfig.exe using batch or vbs file, I tried these commands in administrator mode, but it isn`t work

What I have tried:

BAT
REG ADD HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System /v DisableResmon /t REG_DWORD /d 1 /f
REG ADD HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System /v DisableMSCONFIG /t REG_DWORD /d 1 /f
REG ADD HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System /v DisableGpedit /t REG_DWORD /d 1 /f​
Posted
Comments
Dave Kreskowiak 19-Mar-24 18:18pm    
Your question over on StackOverflow for the exact same thing was closed because it has nothing to do with writing code.

The same is true here, even though you tried to disguise it as a VBScript question.

You're looking for Windows support, over at https://support.microsoft.com/en-us/contactus.

1 solution

You can make background app, and do something like this on the background app

Close another app

using (Process process = Process.Start("resmon.exe")) {

       // Wait for 5 seconds and terminate the process.
       Console.WriteLine("Waiting 1 seconds before terminating" +
           " .exe.");
       Thread.Sleep(1000);

       // Terminate process.
       Console.WriteLine("Terminating with CloseMainWindow.");


  if(process != null)
       // Try to send a close message to the main window.
       if (!process.CloseMainWindow()) {

           // Close message did not get sent - Kill.
           Console.WriteLine("CloseMainWindow returned false - " +
               " terminating with Kill.");
           process.Kill();

       } else {

           // Close message sent successfully; wait for 2 seconds
           // for termination confirmation before resorting to Kill.
           if (!process.WaitForExit(2000)) {

               Console.WriteLine("CloseMainWindow failed to" +
                   " terminate - terminating with Kill.");
               process.Kill();
           }
       }
   }
 
Share this answer
 
Comments
Richard Deeming 20-Mar-24 5:14am    
The OP wants to block those applications from being run, not run them from code and then terminate them.

As Dave said, the question is off-topic here. It has nothing to do with writing code.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900