AppFabric is a distributed caching service that you can use to accelerate application performance. You can read more about AppFabric here
Although AppFabric runs as a service, the only supported way to start an AppFabric cluster or a particular host within a cluster is via PowerShell. The purpose of this script is to start the AppFabrice caching service automatically after a reboot without any manual intervention. The script will call the "Start-CacheCluster" command if no other hosts are running in the cluster, otherwise it will use the "Start-CacheHost" command to add the server back into the cluster. The script will also send a notification email to let you know if the service started successfully and alert you if there was a problem starting the cache host.
The default security policy prevents PowerShell scripts from been run, so the first step (if required) is to configure the security policy to allow the script to be run. The following command can be used to change the execution policy.
Note: This needs to be run in an elevated (run as Administrator) powershell console.
Edit the config section of the script to specify your SMTP settings for email notification and save the script as C:\StartAppFabricCacheHost.ps1
Open task scheduler and create a new task. Change the task to run whether a user is logged on or not and run with highest priveleges.
On the triggers tab, add a new trigger to run at startup.
On the actions tab configure the scheduled task to run PowerShell.exe (e.g. C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe) with the argument "C:\StartAppFabricCacheHost.ps1"
You can now test that the task works by running the task manually or restarting the computer. The AppFabric service should be started and an email notification should be delivered to your inbox.