Advertisement
About80Ninjas

WindowsSetup

Jun 8th, 2017
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. if(Test-IsAdmin -eq $false){
  3.     throw "Please run this script with admin priviliges"
  4. }
  5.  
  6.  
  7. #Set proxy credentials
  8. [System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials;
  9.  
  10. #Test if chocolatey is installed
  11. try{
  12.     $null = choco
  13. } catch {
  14.     #install chocolatey
  15.     iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
  16.  
  17.  
  18.     # Find Chocolatey install and set working directory
  19.     # so we dont need to restart the host console
  20.     $Path = [Environment]::GetEnvironmentVariable('ChocolateyInstall')
  21.  
  22.     if($Path = $null){
  23.         throw 'Unable to find chocolatey'  
  24.     }
  25.  
  26.     Set-Location -Path $Path
  27. }
  28.  
  29.  
  30.  
  31. $Programs = {
  32.  
  33.     #Remove the # to install    
  34.     #IDEs
  35.  
  36.     'intellijidea-community',
  37.     'SpringToolSuite',
  38.     #'intellijidea-ultimate',
  39.     #'eclipse', # Current version
  40.     #'eclipse-java-neon', # 4.5.1
  41.     #'eclipse-java-luna', # 4.4
  42.     #'VisualStudioCode',
  43.  
  44.     #Tools
  45.  
  46.     'git',
  47.     'python',
  48.     'maven',
  49.     'Tomcat',
  50.     #'python',
  51.     #'gradle',
  52.     #'yo', # http://yeoman.io/
  53.     'jre8',
  54.     'jdk8'
  55.  
  56. }
  57.  
  58.  
  59. #Install programs
  60. foreach($Program in $Programs){
  61.     choco install -y $Program
  62. }
  63.  
  64.  
  65. #Helper
  66. function Test-IsAdmin {
  67.  
  68. ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
  69.  
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement