Automating Internet Explorer using PowerShell and resetting Alternate CSS URL

08 April, 2016

I was using remote provisioning to set the alternate CSS URL for a SharePoint site but found that, when doing so, the subsites were not applied. When you set the alternate CSS URL property using the server-side API, it does apply to subsites. Instead, I wrote a small script that automates all this using the Internet Explorer browser hook in PowerShell. Helper Methods First, I need a global window to work with as I do not want to reopen IE for everything I do.


Enable and Flush Site Output Cache using PowerShell

18 March, 2016

I had a requirement to enable the site output cache across all sites in our web application. I found an excellent script by Travis Smith called Set-SPSiteOutputCache. I downloaded that and simply put a loop wrapper around it. In my settings, I set the cache as Disabled for anonymous users and as Extranet for authenticated users. Enable-SPSiteOutputCache.ps1 I also prepared a small script to flush the object cache in all sites as: Flush-SPSiteOutputCache.ps1


Overloading functions inside SharePoint standard script libraries

15 March, 2016

We had the requirement to hook into events that occur within SharePoint script objects, specifically when a new calendar item is created. One way of doing this is to simply override the action with your code, but that will make the existing function break. Alternatively, you can edit the standard script file or copy the contents of the method and change it into a new signature. Neither of these are good methods as the code may change in an upcoming release or service pack.


Manually extending MVC Entity Framework migrations

26 January, 2016

I recently applied an entity framework migration that failed as the data in the source table would get truncated. In this case, we need to include some migration scripts to change the existing data. To do that, you need to manually extend the migration. Background on Migrations Migrations allow you to upgrade and downgrade the schema of a database automatically during execution of an application.


Automating Azure VM with Runbooks and Webhooks

04 December, 2015

Today, I run all of my Windows-based production and development systems in Azure or Office 365. For development environments, you want to have these running on-demand to optimize costs and, for those who can, make the mot of the credits included in your MSDN subscription. I did spend a lot of money this year when I forgot to turn off my dev farm over a weekend, so I wrote a PowerShell script to automate the process.