Thank you for your kind assistance.
I can run DSIM and SFC commands manually. I can create tasks in Task Scheduler. I cannot create a .ps1 or .bat file to run DSIM and SFC commands. Can you guide me?
Thank you for your kind assistance.
I can run DSIM and SFC commands manually. I can create tasks in Task Scheduler. I cannot create a .ps1 or .bat file to run DSIM and SFC commands. Can you guide me?
Please review my reply in this post.
Just use notepad and create a .bat file in some directory that runs whatever program you want to run. Echoing the date time in the bat file can be useful for troubleshooting. In the scheduled task, set it to launch cmd.exe. In the arguments field, point it to the .bat file and whatever log file and folder names you wish to use.
Set the task to run as the SYSTEM account and check the "Run with highest privileges" box. Run the task and then review the log file to see what it did.
Hello
Thank you for your question and reaching out.
I can understand you are having some issues \ queries related to running DISM and SFC command using .bat file
You can use below .bat file code block to achieve this.
@ECHO OFF
DISM /Online /Cleanup-Image /RestoreHealth
Sfc /scannow
Then save as C:\Temp\MyComp.bat to your desktop
Then you can configure in your Task Scheduler with path of this .bat file and make sure you also set proper privilege User account to run this .bat file within Task scheduler.
--If the reply is helpful, please Upvote and Accept as answer--
Thank you.
Why does the bat file have a name that includes the full path to somewhere, which, coincidentally is not where the file is? You use the path to where it is located on the desktop, not the path in this name you gave it, right?
which, coincidentally is not where the file is? You use the path to where it is located on the desktop, not the path in this name you gave it, right?
We have no way of knowing where you saved any file on your PC. So anything that a forum user would post is essentially an example of how to call a .bat file. The actual folder that you put a file in is up to you.
Since the scheduled task that executes the batch file is to run as SYSTEM I suggest that the batch file is placed in a secure location in the file system that requires administrator privileges for write access.
17 people are following this question.