Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save PlagueHO/fee4d9de655781ea30f4f70442127560 to your computer and use it in GitHub Desktop.
Save PlagueHO/fee4d9de655781ea30f4f70442127560 to your computer and use it in GitHub Desktop.
Create a Jenkins Slave on a Windows Server 2012 R2 Core install
# Configure the settings to use to setup this Jenkins Slave
$IPAddress = '192.168.1.96'
$SubnetPrefixLength = 24
$DNSServers = @('192.168.1.1')
$DefaultGateway = '192.168.1.1'
$JenkinsSlaveFolder = 'c:\jenkins'
# Install .NET Framework 3.5
Install-WindowsFeature -Name NET-Framework-Core
# Install Chocolatey
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
# Install JDK 8
choco install jdk8 -y
# Set a static IP Address - optional
New-NetIPAddress `
-IPAddress $IPAddress `
-InterfaceAlias Ethernet `
-DefaultGateway $DefaultGateway `
-AddressFamily IPv4 `
-PrefixLength $SubnetPrefixLength
Set-DnsClientServerAddress `
-InterfaceAlias Ethernet `
-Addresses $DNSServers
# Create the Jenkins Slave folder
New-Item `
-Path $JenkinsSlaveFolder `
-ItemType Directory
@zionyx
Copy link

zionyx commented Oct 7, 2016

Chocolatey can't install on 2012 R2 Core with this download string: https://chocolatey.org/install.ps1 due to missing unzip in Core.
See chocolatey-archive/chocolatey#302

Use this instead:
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/installabsolutelatest.ps1'))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment