Skip to content

Instantly share code, notes, and snippets.

@Ridermansb
Last active May 5, 2021 22:26
Show Gist options
  • Save Ridermansb/284d4b628785ec5c00d1 to your computer and use it in GitHub Desktop.
Save Ridermansb/284d4b628785ec5c00d1 to your computer and use it in GitHub Desktop.
Boxstarter script

To generate nupkg

New-PackageFromScript <script powershell>.ps1 "<Package Name>"

This will create a .nupkg package in your $Boxstarter.LocalRepo.

To testing

Put the nuget .nupkg to your machine in $Boxstarter.LocalRepo folder, then:

$cred=Get-Credential
Install-BoxstarterPackage -PackageName "<Package Name>","<Other package name>" -Credential $cred

To deploy

After testing your package in a clean environment, you can deploy your package

I'll assume that you already have your nuget.config configured with the APIs/Token sources

nuget push <Package Name>.nupkg -Source https://www.myget.org/F/boxstarter/

or push to Chocolatey

 choco push <Package Name>.nupkg

Problems and solutions

WARNING: UNPROTECTED PRIVATE KEY FILE!

The folder and/or file has write permission.
Remove the ssh folder and paste or generate ssh keys again.

Source: http://stackoverflow.com/questions/1556119/ssh-private-key-permissions-using-git-gui-or-ssh-keygen-are-too-open

try {
$Boxstarter.RebootOk=$true
$Boxstarter.AutoLogin=$true
$Boxstarter.NoPassword=$false # Is this a machine with no login password?
Install-WindowsUpdate -acceptEula -getUpdatesFromMS
# Allow running PowerShell scripts
Update-ExecutionPolicy Unrestricted
if (Test-PendingReboot) { Invoke-Reboot }
# Android Develop
choco install android-sdk
choco install java.jdk
if (Test-PendingReboot) { Invoke-Reboot }
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";$env:ProgramFiles\Java\jdk1.7.0_60\bin", "User")
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";$env:LOCALAPPDATA\Android\android-sdk\tools", "User")
[Environment]::SetEnvironmentVariable("ANDROID_HOME", "$env:LOCALAPPDATA\Android\android-sdk\", "User")
## API 19
android update sdk -u -a -t "10,64,80,14,22,65,105,111,112,116,117,118,125"
## API 21
android update sdk -u -a -t "1,2,20,56,57,59,60,101"
if (Test-PendingReboot) { Invoke-Reboot }
android create avd --name Default --target android-19 --abi armeabi-v7a
Write-ChocolateySuccess 'Dev-Boxstarter'
} catch {
Write-ChocolateyFailure 'Dev-Boxstarter' $($_.Exception.Message)
throw
}
try {
$Boxstarter.RebootOk=$true
$Boxstarter.AutoLogin=$true
$Boxstarter.NoPassword=$false # Is this a machine with no login password?
Install-WindowsUpdate -acceptEula -getUpdatesFromMS
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar
Set-TaskbarOptions -Size Small -Dock Bottom -Lock
# Allow running PowerShell scripts
Update-ExecutionPolicy Unrestricted
# Disable System Restore
disable-computerrestore -drive "C:\"
# Disable hibernate
powershell -Command "Start-Process 'powercfg.exe' -Verb runAs -ArgumentList '/h off'"
if (Test-PendingReboot) { Invoke-Reboot }
## Install chocolatey packages
choco install pushbullet
choco install spotify
choco install chocolatey
choco install dotnet3.5
choco install imdisk
choco install jing
choco install virtualbox
choco install rufus
if (Test-PendingReboot) { Invoke-Reboot }
choco install google-chrome-x64
choco install malwarebytes
choco install skype
choco install cdburnerxp
choco install chocolatey
choco install uTorrent
choco install adobereader
choco install winrar
choco install vlc
choco install sysinternals
choco install teamviewer
choco install btsync
choco install f.lux
choco install 7zip.commandline
choco install dropbox
choco install googledrive
choco install spacesniffer
choco install anki
choco install devbox-rapidee
if (Test-PendingReboot) { Invoke-Reboot }
## Download extras
Get-ChocolateyWebFile -url http://www.herdprotect.com/installers/herdProtectScan_Setup.exe -fileFullPath "$env:USERPROFILE\Downloads\herdProtectScan_Setup.exe"
Get-ChocolateyWebFile -url http://www.phraseexpress.com/PhraseExpressSetup.msi -fileFullPath "$env:USERPROFILE\Downloads\PhraseExpressSetup.msi"
Get-ChocolateyWebFile -url "http://www.giffingtool.com/download/GiffingTool-3.9-Buy-Later.zip" -fileFullPath "$env:USERPROFILE\Downloads\GiffingTool-3.9-Buy-Later.zip"
# Finalize Downloads
# Veracrypt https://veracrypt.codeplex.com/Wikipage?ProjectName=veracrypt
Get-ChocolateyWebFile -url "http://download-codeplex.sec.s-msft.com/Download/Release?ProjectName=veracrypt&DownloadId=1372345&FileTime=130649793696470000&Build=20959" -fileFullPath "$env:USERPROFILE\Downloads\VeraCrypt Setup 1.0f-1.exe"
Install-WindowsUpdate -acceptEula
if (Test-PendingReboot) { Invoke-Reboot }
Write-ChocolateySuccess 'Dev-Boxstarter'
} catch {
Write-ChocolateyFailure 'Dev-Boxstarter' $($_.Exception.Message)
throw
}
try {
$Boxstarter.RebootOk=$true
$Boxstarter.AutoLogin=$true
$Boxstarter.NoPassword=$false # Is this a machine with no login password?
Install-WindowsUpdate -acceptEula -getUpdatesFromMS
# Allow running PowerShell scripts
Update-ExecutionPolicy Unrestricted
New-Item -Force -ItemType directory -Path "C:\Python34on27"
New-Item -Force -ItemType directory -Path "C:\Python34"
if (Test-PendingReboot) { Invoke-Reboot }
## Install chocolatey packages
choco install boxstarter
choco install boxstarter.chocolatey
choco install boxstarter.azure
if (Test-PendingReboot) { Invoke-Reboot }
choco install cmder
choco install git-credential-winstore
choco install git
choco install nodejs.install
choco install python2 -version 2.7.8
choco install python
choco install easy.install
choco install pip
choco install ruby -version 1.8.7.37402 -my
choco install ruby -version 1.9.3.55100 -my
choco install ruby -version 2.1.3.0 -my
choco install paint.net
if (Test-PendingReboot) { Invoke-Reboot }
choco install ruby.devkit
choco install atom
choco install filezilla
choco install filezilla.commandline
choco install winmerge
choco install webpicommandline
choco install zoomit
choco install OptiPNG
choco install vim
choco install pngout
choco install Cygwin
if (Test-PendingReboot) { Invoke-Reboot }
choco install cyg-get
choco install putty
choco install Wget
choco install sqlite
choco install sqlite.shell
pip install --upgrade setuptools
easy_install -U setuptools
if (Test-PendingReboot) { Invoke-Reboot }
## Install Cygwin packages
cyg-get curl,openssh,util-linux,wget
Set-Variable -Name DropboxFolder -Value "E:\Cloud\Dropbox\"
# Others
easy_install glue
pip install pywin
[Environment]::SetEnvironmentVariable("HOME", $Env:UserProfile, "User")
[Environment]::SetEnvironmentVariable("CMDER_ROOT", "C:\tools\cmder", "User")
# Create Symbolic Links
Remove-Item -Path "$env:USERPROFILE\_vimrc" -Force
New-Symlink -LiteralPath "$env:USERPROFILE\_vimrc" -TargetPath "$DropboxFolder\Arquivos de Instala��o\_vimrc"
Remove-Item -Path "$env:USERPROFILE\.gitconfig" -Force
New-Symlink -LiteralPath "$env:USERPROFILE\.gitconfig" -TargetPath "$DropboxFolder\Arquivos de Instala��o\.gitconfig"
## PowerShell
Remove-Item -Path "$env:USERPROFILE\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1" -Force
New-Symlink -LiteralPath "$env:USERPROFILE\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1" -TargetPath "$DropboxFolder\Arquivos de Instala��o\WindowsPowerShell\Microsoft.PowerShell_profile.ps1"
Remove-Item -Path "$env:USERPROFILE\Documents\WindowsPowerShell\Modules" -Force -Recurse
New-Symlink -LiteralPath "$env:USERPROFILE\Documents\WindowsPowerShell\Modules" -TargetPath "$DropboxFolder\Arquivos de Instala��o\WindowsPowerShell\Modules"
## Cmder
Remove-Item -Path "$env:CMDER_ROOT\config" -Force -Recurse
New-Symlink -LiteralPath "$env:CMDER_ROOT\config" -TargetPath "$DropboxFolder\Arquivos de Instala��o\Cmder\config"
Remove-Item -Path "$env:CMDER_ROOT\vendor" -Force -Recurse
New-Symlink -LiteralPath "$env:CMDER_ROOT\vendor" -TargetPath "$DropboxFolder\Arquivos de Instala��o\Cmder\vendor"
## Cygwin
Remove-Item -Path "$env:USERPROFILE\.bash_profile" -Force
New-Symlink -LiteralPath "$env:USERPROFILE\.bash_profile" -TargetPath "$DropboxFolder\Arquivos de Instala��o\.bash_profile"
Install-ChocolateyPinnedTaskBarItem "$env:CMDER_ROOT\Cmder.exe"
if (Test-PendingReboot) { Invoke-Reboot }
# Powershell Modules
(new-object Net.WebClient).DownloadString("http://psget.net/GetPsGet.ps1") | iex #PS get
iex (wget "https://raw.githubusercontent.com/raeffs/git-extras-windows/master/install.ps1").Content #Git Extras for Windows
Install-Module PSReadLine
Install-Module go
Install-Module posh-git
Install-Module posh-npm
Install-Module PsConfig
# Ruby gems
gem install pik
gem install sass
# Packages config
pik_install C:\bin
pik add "$env:ChocolateyInstall\lib\ruby.portable.1.8.7.37401\tools\ruby\ruby-1.8.7-p374-i386-mingw32\bin"
# Node packages
npm install -g coffee-script
npm install -g grunt-cli
npm install -g bower
npm install -g gulp
npm install -g gh
## Linter
npm install -g jshint
npm install -g coffeelint
npm install -g csslint
### TODO: see docs for install xml linter
#### http://flowingmotion.jojordan.org/2011/10/08/3-steps-to-download-xmllint/
npm install -g cordova
npm install -g ionic
## TODO: Install
Get-ChocolateyWebFile -url "http://github.com/nunit/nunitv2/releases/download/2.6.4/NUnit-2.6.4.msi" -fileFullPath "$env:USERPROFILE\Downloads\NUnit-2.6.4.msi"
Get-ChocolateyWebFile -url "https://s3.amazonaws.com/github-cloud/releases/1396895/42e798a8-8a2e-11e4-9b1a-5e046b584edf.msi?response-content-disposition=attachment%3B%20filename%3Dopencover.4.5.3522.msi&response-content-type=application/octet-stream&AWSAccessKeyId=AKIAISTNZFOVBIJMK3TQ&Expires=1428188678&Signature=DK9O71BI5NRgpGqMUyP8mY6%2BWBk%3D" -fileFullPath "$env:USERPROFILE\Downloads\opencover.4.5.3522.msi"
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\tools\cygwin\bin;C:\bin;$env:LOCALAPPDATA\Apps\OpenCover;$DropboxFolder\Arquivos de Instala��o\AppPath\libxml;", "User")
Write-ChocolateySuccess 'Dev-Boxstarter'
} catch {
Write-ChocolateyFailure 'Dev-Boxstarter' $($_.Exception.Message)
throw
}
try {
$Boxstarter.RebootOk=$true
$Boxstarter.AutoLogin=$true
$Boxstarter.NoPassword=$false # Is this a machine with no login password?
Install-WindowsUpdate -acceptEula -getUpdatesFromMS
# Allow running PowerShell scripts
Update-ExecutionPolicy Unrestricted
if (Test-PendingReboot) { Invoke-Reboot }
choco install NuGet.CommandLine
choco install papercut
if (Test-PendingReboot) { Invoke-Reboot }
Set-Variable -Name DropboxFolder -Value "E:\Cloud\Dropbox\"
# Create Symbolic Links
Remove-Item -Path "$env:APPDATA\NuGet\NuGet.Config" -Force
New-Symlink -LiteralPath "$env:APPDATA\NuGet\NuGet.Config" -TargetPath "$DropboxFolder\Arquivos de Instalação\NuGet.Config"
## Install Dev
Install-ChocolateyVsixPackage EditorConfig https://visualstudiogallery.msdn.microsoft.com/c8bccfe2-650c-4b42-bc5c-845e21f96328/file/75539/12/EditorConfigPlugin.vsix
Install-ChocolateyVsixPackage "Web Essentials 2015.0 CTP 5" https://visualstudiogallery.msdn.microsoft.com/ee6e6d8c-c837-41fb-886a-6b50ae2d06a2/file/146119/12/WebEssentials2015.vsix
Install-ChocolateyVsixPackage SpecFlow https://visualstudiogallery.msdn.microsoft.com/9915524d-7fb0-43c3-bb3c-a8a14fbd40ee/file/79327/7/TechTalk.SpecFlow.Vs2010Integration.vsix
Install-ChocolateyVsixPackage "LINQ Insight Express" https://visualstudiogallery.msdn.microsoft.com/269e6da9-7f4d-4650-a327-c70b359dcfe0/referral/89399
Install-ChocolateyVsixPackage "File Nesting" https://visualstudiogallery.msdn.microsoft.com/3ebde8fb-26d8-4374-a0eb-1e4e2665070c/file/123284/14/FileNesting.vsix
Install-ChocolateyVsixPackage "Productivity Power Tools 2013" https://visualstudiogallery.msdn.microsoft.com/dbcb8670-889e-4a54-a226-a48a15e4cace/file/117115/4/ProPowerTools.vsix
Install-ChocolateyVsixPackage "VSCommands for Visual Studio 2013" https://visualstudiogallery.msdn.microsoft.com/c6d1c265-7007-405c-a68b-5606af238ece/file/106247/20/SquaredInfinity.VSCommands.VS12.vsix
## Download extras
Get-ChocolateyWebFile -url "http://github.com/nunit/nunitv2/releases/download/2.6.4/NUnit-2.6.4.msi" -fileFullPath "$env:USERPROFILE\Downloads\NUnit-2.6.4.msi"
### SQL Manager Studio
Get-ChocolateyWebFile -url "http://download.microsoft.com/download/E/A/E/EAE6F7FC-767A-4038-A954-49B8B05D04EB/MgmtStudio%2064BIT/SQLManagementStudio_x64_ENU.exe" -fileFullPath "$env:USERPROFILE\Downloads\SQLManagementStudio_x64_ENU.exe"
### LocalDB
Get-ChocolateyWebFile -url "http://download.microsoft.com/download/E/A/E/EAE6F7FC-767A-4038-A954-49B8B05D04EB/LocalDB%2064BIT/SqlLocalDB.msi" -fileFullPath "$env:USERPROFILE\Downloads\SqlLocalDB.msi"
### Express Profile
Get-ChocolateyWebFile -url "http://download-codeplex.sec.s-msft.com/Download/Release?ProjectName=expressprofiler&DownloadId=849229&FileTime=130679606525100000&Build=20959" -fileFullPath "$env:USERPROFILE\Downloads\ExpressProfiler20wAddinSigned.zip"
## Sql Configs
SqlLocalDb c Projects
SqlLocalDb s Projects
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server 2014 Redist\SqlLocalDB\CurrentVersion" -Name DefaultData -PropertyType String -Value "W:\Working"
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server 2014 Redist\SqlLocalDB\CurrentVersion" -Name DefaultLog -PropertyType String -Value "W:\Working"
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server 2014 Redist\SqlLocalDB\CurrentVersion" -Name BackupDirectory -PropertyType String -Value "W:\Working"
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL12E.LOCALDB\MSSQLServer\CurrentVersion" -Name DefaultData -PropertyType String -Value "W:\Working"
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL12E.LOCALDB\MSSQLServer\CurrentVersion" -Name DefaultLog -PropertyType String -Value "W:\Working"
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL12E.LOCALDB\MSSQLServer\CurrentVersion" -Name BackupDirectory -PropertyType String -Value "W:\Working"
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL11E.LOCALDB\MSSQLServer\CurrentVersion" -Name DefaultData -PropertyType String -Value "W:\Working"
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL11E.LOCALDB\MSSQLServer\CurrentVersion" -Name DefaultLog -PropertyType String -Value "W:\Working"
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL11E.LOCALDB\MSSQLServer\CurrentVersion" -Name BackupDirectory -PropertyType String -Value "W:\Working"
if (Test-PendingReboot) { Invoke-Reboot }
# Finalize
# Mount iso https://github.com/chocolatey/choco/wiki/How-To-Mount-An-Iso-In-Chocolatey-Package (Mount iso VS)
# http://download-codeplex.sec.s-msft.com/Download/Release?ProjectName=nodejstools&DownloadId=1440949&FileTime=130717787870630000&Build=20959
Write-ChocolateySuccess 'Dev-Boxstarter'
} catch {
Write-ChocolateyFailure 'Dev-Boxstarter' $($_.Exception.Message)
throw
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment