Contents
The morning workday routine - sit at desk with freshly brewed coffee and then click-click-clickety-click to start Visual Studio, Docker, SQL Server, Outlook…. That early in the morning, it’s very easy to forget a click.
One of the more annoying clicks to forget was to fire-up the database server (hosted in a local Docker container in this case).
A few minutes waiting for a localhost website to start up, looking at a spinner, and then eventually a yellow screen of death complaining that the database cannot be connected to.
Let’s automate!
The following are the contents of my powershell file, LetTheWorkBegin.ps1:
Start-Process -FilePath "C:\Program Files\Docker\Docker\Docker Desktop.exe"
Start-Process -FilePath "C:\Program Files (x86)\WatchGuard\WatchGuard Mobile VPN with SSL\wgsslvpnc.exe"
Start-Process -FilePath "C:\Program Files\Microsoft Office\root\Office16\OUTLOOK.EXE"
Start-Process -FilePath "C:\Paul\Work\CurrentProject\CurrentProject.sln"
git -C C:\Paul\Work\CurrentProject\ fetch
Start-Sleep -s 30
docker start SQL1
Start-Sleep -s 5
Start-Process -FilePath "Ssms.exe" -WorkingDirectory "C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\" -ArgumentList "-S 127.0.0.1 -d ProjectDatabase -U sa -nosplash"
I fire up Windows Terminal, drag the desktop link to LetTheWorkBegin.ps1 onto the terminal window, and I’m ready to go.
- I start with the slowest kid on the block, Docker Desktop
- VPN app for tunnelling into the corporate network and Outlook are next
- The VS solution project I am currently working on is started and a call to fetch the latest updates from the Git repo
- The two delays are based on my experience on the time needed for the preceeding action to complete
- Start the SQL Docker container.
- Start SQL Studio and connect to the project’s database