Restore database with Availability Groups I have high availability enabled with two servers and when trying to restore a database I realised I had to un-synchronize the database and then remove it from the availability group. 

I use Ola Hallagrens maintenance solution. Is there something I can amend with Ola's script to automatically remove DB from availability group when I run the restore job or is there a script already available, or simply not do-able? 

Thanks
I think you need to revise your question with clarity:

Olas scripts meant for following, not for restoring database.


Backup
DBCC - Integrity Check
Maintenance - Index and Statistics  


Aside from this, you cannot DROP or RESTORE a database while it's part of Availability Group. You can remove a database from availability group with following commands:  

PRIMARY Replica:

ALTER AVAILABILITY GROUP AGName remove database DatabaseName;


SECONDARY Replica:

ALTER database DatabaseName set HADR OFF;