Skip to content

Instantly share code, notes, and snippets.

@TimMurphy
Last active August 29, 2015 14:10
Show Gist options
  • Save TimMurphy/d9f95a17aad9177a5273 to your computer and use it in GitHub Desktop.
Save TimMurphy/d9f95a17aad9177a5273 to your computer and use it in GitHub Desktop.
# Boxstarter script for Azure Virtual Machine -admin.
$ErrorActionPreference = "Stop"
# Packages
choco install notepad2
choco install win-no-annoy
# Window Update
Enable-MicrosoftUpdate
Install-WindowsUpdate -AcceptEula
The following scripts are used by [Boxstarter](http://boxstarter.org/) to configure my Azure virtual machines.
# Boxstarter script to enable and run Windows Update.
Enable-MicrosoftUpdate
Install-WindowsUpdate -AcceptEula
# Boxstarter script for Azure Virtual Machine timmurphy-build.
Enable-MicrosoftUpdate
Install-WindowsUpdate -AcceptEula
choco install notepad2
choco install git
choco install DotNet4.5.2
choco install microsoft-build-tools
choco install jenkins
choco install webdeploy
Write-Host
Write-Host "Must manually install RavenDB because 'choco install RavenDB' requires manual intervention." -ForegroundColor Yellow
Write-Host "Install on port 8081 so it does not conflict with Jenkins-CI." -ForegroundColor Yellow
Write-Host
# choco install RavenDB
Install-WindowsUpdate -AcceptEula
# Boxstarter script for Azure Virtual Machine timmurphy-iisXX.
$ErrorActionPreference = "Stop"
Enable-MicrosoftUpdate
Install-WindowsUpdate -AcceptEula
# Packages
choco install notepad2
choco install DotNet4.5.2
# Enable Web Services
choco install IIS-WebServerRole -source WindowsFeatures
choco install IIS-ISAPIFilter -source WindowsFeatures
choco install IIS-ISAPIExtensions -source WindowsFeatures
# Enable ASP.NET
choco install IIS-NetFxExtensibility45 -source WindowsFeatures
choco install NetFx4Extended-ASPNET45 -source WindowsFeatures
choco install IIS-ASPNet45 -source WindowsFeatures
# Setup IIS
Import-Module WebAdministration
Remove-WebSite -Name "Default Web Site" -ErrorAction SilentlyContinue
# Boxstarter script to configure the Azure Virtual Machine that is used to create the image all other virtual machines are created from.
#
# References:
#
# - http://www.hurryupandwait.io/blog/deannoyafying-a-default-windows-server-install
# - https://github.com/mwrock/Chocolatey-Packages/blob/master/win-no-annoy/tools/ChocolateyInstall.ps1
function Get-CurrentUser {
$identity = [System.Security.Principal.WindowsIdentity]::GetCurrent()
$parts = $identity.Name -split "\\"
return @{Domain=$parts[0];Name=$parts[1]}
}
function Restart-Explorer {
Write-Host "Restarting the Windows Explorer process..."
$user = Get-CurrentUser
$explorer = Get-Process -Name explorer -IncludeUserName -ErrorAction SilentlyContinue
if($explorer -ne $null) {
$explorer | ? { $_.UserName -eq "$($user.Domain)\$($user.Name)"} | Stop-Process -Force
}
Start-Sleep 1
if(!(Get-Process -Name explorer -ErrorAction SilentlyContinue)) {
Start-Process -FilePath explorer
}
}
Enable-MicrosoftUpdate
Install-WindowsUpdate -AcceptEula
choco install notepad2
Write-Host "Disabling IE Enhanced Security Configuration (ESC)."
$AdminKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}"
$UserKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A8-37EF-4b3f-8CFC-4F3A74704073}"
if(Test-Path $AdminKey){
Set-ItemProperty -Path $AdminKey -Name "IsInstalled" -Value 0
}
if(Test-Path $UserKey) {
Set-ItemProperty -Path $UserKey -Name "IsInstalled" -Value 0
}
Write-Host "Disabling Server Manager opening at logon."
$Key = "HKLM:\SOFTWARE\Microsoft\ServerManager"
if(Test-Path $Key){
Set-ItemProperty -Path $Key -Name "DoNotOpenServerManagerAtLogon" -Value 1
}
Write-Host "Adjusting win explorer options to display hiden files, folders and extensions."
$key = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced'
if(Test-Path -Path $Key) {
Set-ItemProperty $Key Hidden 1
Set-ItemProperty $Key HideFileExt 0
}
Restart-Explorer
Write-Host "Successfully completed timmurphy-image-boxstarter.ps1" -ForegroundColor Green
# Boxstarter script for Azure Virtual Machine wph-db01.
$ErrorActionPreference = "Stop"
Enable-MicrosoftUpdate
Install-WindowsUpdate -AcceptEula
# Packages
choco install notepad2
# Boxstarter script for Azure Virtual Machine wph-iisXX.
$ErrorActionPreference = "Stop"
Enable-MicrosoftUpdate
Install-WindowsUpdate -AcceptEula
# Packages
choco install notepad2
choco install vcredist2013
choco install dotnet3.5
# Enable Web Services
choco install IIS-WebServerRole -source WindowsFeatures
choco install IIS-ISAPIFilter -source WindowsFeatures
choco install IIS-ISAPIExtensions -source WindowsFeatures
# Enable ASP.NET
choco install IIS-NetFxExtensibility45 -source WindowsFeatures
choco install NetFx4Extended-ASPNET45 -source WindowsFeatures
choco install IIS-ASPNet45 -source WindowsFeatures
# Setup IIS
Import-Module WebAdministration
Remove-WebSite -Name "Default Web Site" -ErrorAction SilentlyContinue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment