Powershell Archive

EnvInject plugin variables not getting injected from properties file in Jenkins build step

Today I had a bit of a struggle with the Jenkins EnvInject Plugin while trying to inject custom variables from a properties file into my MSBuild step. Everything that I added to the Properties Content field was successfully injected, and looking at the log, the EnvInject reported successfully injecting my file envVars.properties variables as well. I used PowerShell to retrieve the current Git branch and …

Foreign key constraint violation for tblPropertyDefintion causing SqlException while automatically restoring EPiServer database for UI tests

Previously I wrote an article about Keeping reliable test data in EPiServer content database for automated UI tests, but recently ran into some issues in regards to new EPiServer properties. A call to the IContentRepository method Save as below. Causes the following error. Cause of SqlException foreign key constraint tblWorkContentProperty tblPropertyDefinition in EPiServer database After adding new EPiServer properties to a page type class, the …

PowerShell script example for copying correct configs based on server machine name in multi server environment

As a complement to the previous article on Extending EPiServer MSBuild config transforms to provide server specific configuration for TCP EventReplication and Licenses I wrote a small Windows PowerShell script example on how you may copy the proper configuration files to the proper server automatically during deploy. This script is available at GitHub. Copying files with PowerShell based on environment computer name and regex The …

EPiServer 7 Installation Error – $accountName is not a valid user or group

I ran into some problems the other day trying to install an EPiServer 7 site onto an old Windows 7 developer machine using EPiServer‘s Deployment Center. Everything seemed to be going well until I was hit with an account related error. Opening up the installation PowerShell script file in question (\EPiServer\CMS\7.0.586.1\Install\System Scripts\Install Site (No database).ps1) soon revield what was going on. Apparently the EPiServer installation …

Making the EPiServer scheduler run your Windows PowerShell scripts

Some time ago I wrote a post about retrieving and updating the MaxMind GeoIP database using Windows PowerShell scripts, and suggested the possibility to have the Windows Task Scheduler automating the process. Mostly for my own amusement, I decided to have a go at making the EPiServer scheduler do the work as well; perhaps there would also be scenarios when web administrators would need to …

GeoIP database update in multiple webserver environment using Windows PowerShell scripting

The MaxMind GeoIP database (shipped with EPiServer Framework) is rather useful when wanting to show geographically specific information to visitors as they surf around the site. Since mapping the correct requests to the proper regions may be rather important generating value, the need of having a fresh database copy quickly comes into focus. Manually updating the database is of course not at all complicated; it …

Using Windows Task Scheduler to automatically run PowerShell scripts

Windows PowerShell scripting is a powerful way of automating otherwise tiresome and error prone manual tasks. I recently looked into how I could have Windows running my scripts for me. It is not difficult, but it still took some poking around to get done. New tasks are added using the Create Task option in the Actions area. The General tab will let you decide how …