Software⏱️ 3 min read📅 2026-06-11

How to Fix: Trying to start app pool via Powershell Script - getting error intermittently

Understanding intermittent errors in PowerShell scripts and resolving them.

Quick Answer: The issue was resolved by ensuring the application pool was completely stopped before starting it again. This involved checking the AppPool state and waiting for it to be in a 'Stopped' state before proceeding with the script.

The 'Start-WebAppPool' cmdlet is failing intermittently, causing issues with deploying files and starting the website. This error affects developers who rely on this script to automate deployment tasks.

This issue can be frustrating for teams who have come to rely on this script, and resolving it will require some additional troubleshooting steps.

🔍 Why This Happens

  • The primary cause of this issue is the 'Start-WebAppPool' cmdlet failing due to a service not accepting control messages. This can be caused by the application pool not being fully stopped before attempting to start it.
  • Another possible reason for this failure could be issues with the IIS module or the .NET Framework.

🔧 Proven Troubleshooting Steps

Ensuring Application Pool is Fully Stopped Before Starting

  1. Step 1: Use the 'Get-WebAppPoolState' cmdlet to check if the application pool is stopped before attempting to start it.
  2. Step 2: If the application pool is not fully stopped, use the 'Stop-WebAppPool' cmdlet to stop it and then wait for a short period of time (e.g., 10 seconds) to ensure it has fully stopped.
  3. Step 3: Once the application pool is confirmed to be stopped, attempt to start it using the 'Start-WebAppPool' cmdlet.

Verifying IIS Module and .NET Framework are Up-to-Date

  1. Step 1: Ensure that all IIS modules, including the WebAdministration module, are up-to-date by running 'Get-WindowsFeature -Name WebServer' and checking for any updates.
  2. Step 2: Verify that the .NET Framework is also up-to-date by running 'Get-ItemProperty -Path 'C:\Windows\System32/drivers/etc onts rusted_fonts.dll' -Name Version'.

✨ Wrapping Up

By following these steps, you should be able to resolve the intermittent issue with starting the application pool. If the problem persists, further troubleshooting may be necessary.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions