clearing IISExpress cache

In PowerShell, you need to use the call operator (&) to pass parameters/arguments to an executable.

$appCmd = "C:\Program Files (x86)\IIS Express\appcmd.exe"

$result = Invoke-Command -Command { & $appCmd 'list' 'sites' '/text:SITE.NAME' }

for ($i = 0; $i -lt $result.length; $i++) {
    Invoke-Command -Command { & $appCmd 'delete' 'site'  $result[$i] }
}

Variation from a comment on this page :

Set-Alias appcmd "$env:ProgramFiles\IIS Express\appcmd.exe"

appcmd list site /text:SITE.NAME | % { appcmd delete site $_ }

Easy: Just open CMD prompt & Navigate to IIS express - by typing the following

cd "C:\Program Files (x86)\IIS Express\"
//paste & run this 
appcmd.exe list site /xml | appcmd delete site /in

This will delete all the sites, enjoy!

Update for PowerShell Version Thanks to @sibbij

cd "C:\Program Files (x86)\IIS Express\"

run this ./appcmd.exe list site /xml | ./appcmd delete site /in


  1. Check the Assembly.GetExecutingAssembly().Location property(watch, immediatewindow) when you are debugging and you are stopped at some Breakpoint
  2. you will see a location like below path

%temp%\Temporary ASP.NET Files\vs...\assembly....\YOUR.dll

  1. Check out and delete all folders inside thepath (probably possible after closing IIS express and VS)

%temp%\Temporary ASP.NET Files\