IIS reset Job schedule path

  • 8 months ago
Comment

ChatGPT
1 / 1

To schedule an IIS reset using Task Scheduler in Windows, follow these steps:

  1. Open Task Scheduler:

    • Press Win + R to open the Run dialog.
    • Type taskschd.msc and press Enter.
  2. Create a Basic Task:

    • In the Task Scheduler window, right-click on "Task Scheduler Library" and choose "Create Basic Task..."
  3. Name and Description:

    • Enter a name and description for your task, then click Next.
  4. Task Trigger:

    • Choose a trigger that suits your needs (e.g., Daily, Weekly, etc.). Click Next.
  5. Task Action:

    • Select "Start a Program" and click Next.
  6. Program/script:

    • Browse and select the path to the appcmd.exe executable. The default path should be:
      shell
      %windir%\system32\inetsrv\appcmd.exe
  7. Add arguments (optional):

    • In the "Add arguments (optional)" field, enter the following command to perform an IIS reset:
      bash
      stop apppool /apppool.name:YourAppPoolName
      start apppool /apppool.name:YourAppPoolName
    • Replace YourAppPoolName with the name of your application pool.
  8. Start in (optional):

    • Set this to %windir%\system32\inetsrv to ensure that the command runs in the correct directory.
  9. Finish:

    • Review your settings and click Finish.
  10. Test:

  • After creating the task, you can test it by right-clicking on it in the Task Scheduler Library and selecting "Run". This will manually trigger the IIS reset.

Please note that using scheduled IIS resets might not be the best practice in a production environment. Frequent IIS restarts can disrupt services and negatively impact user experience. Instead, consider addressing the root causes of why you need frequent IIS resets, such as memory leaks or performance issues. If you still need to automate certain maintenance tasks, ensure they're performed during maintenance windows or non-peak hours to minimize impact.