How to clear and reinitialize Windows Server AppFabric Persistence and Monitoring databases

If you are using Windows Server AppFabric in a development or testing environment you will find the need to quickly clear and reinitialize both the persistence and monitoring databases.

Fortunately this is easy with the supplied PowerShell cmdlets.  To make it really simple I’ve got a script that I use to reset my environment using the default database names as created by the WebPlatformInstaller with AppFabric. 

This is my script AppFabricDBReset.ps1

import-module applicationserver

$ConfirmPreference = "None"

Remove-ASPersistenceSqlDatabase -Force -Server ".\SQLExpress" -Database "AppFabricPersistenceDB"

Initialize-ASPersistenceSqlDatabase -Admins $env:computername\AS_Administrators -Readers $env:computername\AS_Observers -Users "BUILTIN\IIS_IUSRS" -Database "AppFabricPersistenceDB" -Server ".\SQLExpress"

Clear-ASMonitoringSqlDatabase -Database "AppFabricMonitoringDB" -Server ".\SQLExpress"

To run this script I created a batch file called AppFabricDBReset.cmd that does the trick

powershell -file AppFabricDBReset.ps1

Now just run this and watch it clear the AppFabric databases for you


Comments (0)

Skip to main content