Using Windows Powershell and Chocolatey to quickly setup a new dev desktop environment

I’ve become a huge fan of Chocolatey. I historically have a Linux developer background and I got spoilt by apt so it always had me upset that there was no unified way in Windows of installing and keeping track of various utilities a developer would find useful in day to day life.

I had some experience in Linux shell scripting in my past, but really got into it while building data cleansing scripts using tools like curl, grep and sed for an e-commerce startup I used work for. While I did recognize immediately how powerful mastery of Powershell would offer a Windows developer like myself, it was only in the last year or so I have had the opportunity for field work to hone this (and I am still, by no means, a master of this). I hope soon to have some deeper articles on Powershell, especially now that Powershell Core is maturing and makes it a contender for cross-platform scripting in a manner that may take on the likes of traditional shell scripting shells like bash.

For now though, let’s start at the beginning of any developer’s journey: Getting your dev workstation setup. If you’re anywhere close to my use case, where I use a Mac but spin up new Windows VMs frequently to either isolate different clients’ VPN requirements or keep their streams of work separate, this can be a task in repetition.

Thankfully there’s a simple script I wrote, that eases this into one Powershell script. The initial code I sanitised for release is simple enough to paste in this article, but I plan to update it for more complex developer environment requirements, so you should clone my EasyDevWorkstation Github repository to get these updated scripts later on.

The following lines of script, taken from this repo, when run from an administror-mode Powershell prompt, will do the following:

  1. Set the Execution Policy of the system to RemoteSigned to allow the installation of Chocolatey, and in turn allow Chocolatey scripts to install software
  2. Download and Install Chocolatey
  3. Install via Chocolatey the following
    1. Git, because you need version control from the beginning
    2. Google Chrome browser, because we’re not all Edge and IE fans
    3. The latest available version of Powershell (in case you are running an older OS like Windows Server 2008 R2, Chocolatey I think requires at least one version higher than the base install version)
    4. Visual Studio code, which has been growing in popularity (and extensions) to allow really simple to really powerful scenarios for coding solutions, and has good Git integration
    5. SQL Server Management Studio, because most common developer scenarios require connecting to SQL Server databases at some point.

Here’s the script:

Set-ExecutionPolicy RemoteSigned
iwr -UseBasicParsing | iex
choco install -y --allow-empty-checksums git GoogleChrome powershell visualstudiocode sql-server-management-studio

Basics of getting connected to Office 365 Powershell

I’m setting up a new laptop for Office 365 administration and development work, and in doing so I realised sometimes I forgot the basics to getting Office 365 Powershell commands available once again. As a reminder they are:

  1. Install the Microsoft Online Services Sign-in Assistant for IT Professionals
  2. Install the Azure Administration MSI from the Azure Active Directory Connection page
  3. Run the “Azure Active Directory Module for Microsoft Powershell” and test that it all works with a Get-MsolUser command after logging in to your Office 365 tenant with the Connect-MsolService command

I purposely didn’t put any links here to the downloads, since its much more detailed and well written on the Microsoft TechNet article on Office 365 Powershell setup so I’d highly recommend reading that as your guide if you’re doing this for the first time.

What should a developer know before building a public web site? – Stack Overflow

What should a developer know before building a public web site? – Stack Overflow.

In testing the new GigJunkie site before launching it (soon), I found my team debating to the point of near argument some of the finer points of our website which this topic thread would have helped us greatly, had we read before.

As I approach this weekend’s CAMDUG meetup which is an Open Space Coding Day with Alan Hemmings and other .Net Cambridge developers I’m very excited about working with folks on the topic of a public website for CAMDUG.

I’m hoping that my contributions to the day can be helped having read this article now. continues to impress me with its wealth of developer knowledge.

Tip of the day: Double question mark – Mikael Söderström

This tip on using the double-quotation marks in C# helped me a bit today when it came to integrating new code for an ASP.Net web application with legacy data access code that I was unsure about the quality of. The data access code that I was referencing  may or may not have null value checking, and there was no time because of an impending deadline to do code-review or quality control revision on it, but by using the ‘??’ check on values returned by it and some constant parameter values hydrated by web.config appSetting values II was able to implement default behaviour in my code for objects which did not get what was expected from the data access layer.

Of course this is just a band aid. The solution really lies in cleaning up that misbehaving code and defining standard contracts for behaviour between tiers that all the software team agrees to and which consistent code reviewing will reveal deviations from at earlier stages before integration, and perhaps the whole team becomes better developers because of it since we’re discipling ourselves on good practices for writing quality code.

Google Street View available for the UK

It’s a little cool, and slightly uncomfortable, to see London is now mapped out and available for Google Street View.

I am a newcomer to London,  and often find myself walking a bit to find unknown streets and places, a task I’d much rather prefer to do virtually from the warm confines of my home or office than on the cold breezy streets.

When you see photo layouts of directly up to your front door it does become a little unsettling for some reason, despite the usefulness of it all.

SQL Server 2005 – Troubleshooting Orphaned Users

I always seem to keep forgetting when I backup from one server and restore to a new server that SQL Server 2005 will recreate the users from the original server, and they become ‘orphaned’ as they don’t match to the similarly named user on my system automatically, and thus cause an error when an ASP.Net application tries to use its web.config settings to access the database.

This Microsoft Support article gives the steps needed to fix this orphaned user issue as well as create it in the first place, so this is a cool resource to have when training others on the issues they may face and how to mitigate them when wearing their database administrator hat.

What is a “Predicate delegate” – bytes

Thinking in terms of Delegates was always a bit of a challenge to me. So when I hit the Predicate parameter when trying to using a List<X>.FindAll(XType y).

The example given in discussion on this article went a long way to clearing this up. If I get more answers like this from Bytes I might start using this as my secondary source of programming answers after StackOverflow.