Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adrianvellamlt/71524c10eb5ad5f4ecb4fc3d870af179 to your computer and use it in GitHub Desktop.
Save adrianvellamlt/71524c10eb5ad5f4ecb4fc3d870af179 to your computer and use it in GitHub Desktop.
Automated .NET Web developer PC setup through chocolatey

This batch file installs chocolatey and then installs the following:

Dev programs:

  • vscode
  • linqpad5
  • sql-server management studio
  • microsoft azure storage explorer
  • postman
  • node js
  • git
  • docker desktop
  • redis desktop manager
  • curl (used in script)
  • cmder
  • soapui
  • ngrok (downloads it to C:/ngrok and creates a link in desktop)

Utility programs:

Browsers:

  • google chrome
  • firefox
  • brave

Other programs:

  • spotify
@echo off
:: https://stackoverflow.com/a/10052222/4305074 to prompt
:: BatchGotAdmin
::---------------------------------------------------------------------------
:: --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
:: --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
set params = %*:"=""
echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
del "%temp%\getadmin.vbs"
exit /B
:gotAdmin
pushd "%CD%"
CD /D "%~dp0"
::----------------------------------------------------------------------------
@echo off
::----------------------------------------------------------------------------
ECHO Downloading and installing chocolatey
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
::----------------------------------------------------------------------------
cls
::----------------------------------------------------------------------------
ECHO Installing core dev tools
choco install vscode -y
choco install linqpad5 -y
choco install sql-server-management-studio -y
choco install microsoftazurestorageexplorer -y
choco install postman -y
choco install nodejs -y
choco install git -y
choco install docker-desktop -y
choco install redis-desktop-manager -y
choco install curl -y
choco install cmder -y
choco install soapui -y
::----------------------------------------------------------------------------
cls
::----------------------------------------------------------------------------
ECHO Downloading ngrok.
choco install ngrok.portable -y
MKDIR "C:\ngrok"
ECHO ^ngrok http [port] -host-header="localhost:[port]"^ > "c:\ngrok\howto.txt"
MOVE c:\ProgramData\chocolatey\lib\ngrok.portable\tools\ngrok.exe c:\ngrok\ngrok.exe
:: Get path to desktop, just in case user changed default path to desktop
for /f "usebackq tokens=1,2,*" %%B IN (`reg query "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v Desktop`) do set DESKTOP=%%D
MKLINK /D "%DESKTOP%\ngrok" "c:\ngrok"
::----------------------------------------------------------------------------
cls
::----------------------------------------------------------------------------
ECHO Installing utility tools.
choco install adobereader -y
choco install 7zip -y
choco install microsoft-teams -y
choco install lightshot -y
::----------------------------------------------------------------------------
cls
::----------------------------------------------------------------------------
ECHO Intalling autohotkey and adding https://github.com/adrianvellamlt/portrait-monitor-window-snapper
choco install autohotkey.portable -y
curl -o "C:\Users\%username%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\portraitMonitorWindowSnapper.ahk" "https://raw.githubusercontent.com/adrianvellamlt/portrait-monitor-window-snapper/master/portrait-monitor-window-snapper.ahk"
::----------------------------------------------------------------------------
cls
::----------------------------------------------------------------------------
ECHO Installing browsers. (Chrome, Mozilla, Brave)
choco install googlechrome -y
choco install firefox -y
choco install brave -y
::----------------------------------------------------------------------------
cls
::----------------------------------------------------------------------------
ECHO Installing other programs.
choco install spotify -y
::----------------------------------------------------------------------------
cls
::----------------------------------------------------------------------------
ECHO Do not forget to install Visual Studio from the VS installer and https://github.com/shanalikhan/code-settings-sync in VS Code
set /p DUMMY=Hit ENTER to restart...
shutdown.exe /r /t 0
::----------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment