Last active
          October 7, 2016 22:04 
        
      - 
      
 - 
        
Save PlagueHO/fee4d9de655781ea30f4f70442127560 to your computer and use it in GitHub Desktop.  
    Create a Jenkins Slave on a Windows Server 2012 R2 Core install 
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # 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 | |
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
Chocolatey can't install on 2012 R2 Core with this download string:
https://chocolatey.org/install.ps1due to missing unzip in Core.See chocolatey-archive/chocolatey#302
Use this instead:
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/installabsolutelatest.ps1'))