Forked from masterzen/Bootstrap-EC2-Windows-CloudInit.ps1
Last active
August 29, 2015 14:04
-
-
Save lorcanmcdonald/fe51470ad93805baeec7 to your computer and use it in GitHub Desktop.
Revisions
-
lorcanmcdonald revised this gist
Aug 15, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -161,7 +161,7 @@ else Add-Content $log -value "Installed Chocolatey" # install puppet & 'C:\ProgramData\chocolatey\bin\choco install puppet' &sc.exe config puppet start= demand Add-Content $log -value "Installed Puppet" -
lorcanmcdonald revised this gist
Aug 15, 2014 . 1 changed file with 2 additions and 34 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -134,39 +134,10 @@ Start-Process -FilePath 'C:\Users\Administrator\vcredist.exe' -ArgumentList '/no del vcredist.exe Add-Content $log -value "Installed VC++ 2008 Redistributable from $vcredist and updated path" #chocolatey - standard one line installer doesn't work on Core b/c Shell.Application can't unzip if (-not $IsCore) { Invoke-Expression ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) } else { @@ -190,10 +161,7 @@ else Add-Content $log -value "Installed Chocolatey" # install puppet & 'choco install puppet' &sc.exe config puppet start= demand Add-Content $log -value "Installed Puppet" -
Brice Figureau revised this gist
Jul 21, 2014 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -152,8 +152,8 @@ del curl.zip Add-Content $log -value "Installed Curl from $curlUri and updated path" #vim & 'C:\Program Files\Curl\curl.exe' -# -G -k -L ftp://ftp.vim.org/pub/vim/pc/vim73_46rt.zip -o vim73_46rt.zip 2>&1 > "$log" & 'C:\Program Files\Curl\curl.exe' -# -G -k -L ftp://ftp.vim.org/pub/vim/pc/vim73_46w32.zip -o vim73_46w32.zip 2>&1 > "$log" Get-ChildItem -Filter vim73*.zip | % { &7z x `"$($_.FullName)`"; del $_.FullName; } @@ -191,7 +191,7 @@ Add-Content $log -value "Installed Chocolatey" # install puppet #https://downloads.puppetlabs.com/windows/puppet-3.2.4.msi & 'C:\Program Files\Curl\curl.exe' -# -G -k -L https://downloads.puppetlabs.com/windows/puppet-3.2.4.msi -o puppet-3.2.4.msi 2>&1 > "$log" Start-Process -FilePath "msiexec.exe" -ArgumentList '/qn /passive /i puppet-3.2.4.msi /norestart' -Wait SetX Path "${Env:Path};C:\Program Files\Puppet Labs\Puppet\bin" /m &sc.exe config puppet start= demand -
masterzen revised this gist
Jan 6, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -192,7 +192,7 @@ Add-Content $log -value "Installed Chocolatey" # install puppet #https://downloads.puppetlabs.com/windows/puppet-3.2.4.msi curl -# -G -k -L https://downloads.puppetlabs.com/windows/puppet-3.2.4.msi -o puppet-3.2.4.msi 2>&1 > "$log" Start-Process -FilePath "msiexec.exe" -ArgumentList '/qn /passive /i puppet-3.2.4.msi /norestart' -Wait SetX Path "${Env:Path};C:\Program Files\Puppet Labs\Puppet\bin" /m &sc.exe config puppet start= demand Add-Content $log -value "Installed Puppet" -
masterzen revised this gist
Jan 6, 2014 . 1 changed file with 1 addition and 16 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -197,13 +197,6 @@ SetX Path "${Env:Path};C:\Program Files\Puppet Labs\Puppet\bin" /m &sc.exe config puppet start= demand Add-Content $log -value "Installed Puppet" &winrm quickconfig `-q &winrm set winrm/config/client/auth '@{Basic="true"}' &winrm set winrm/config/service/auth '@{Basic="true"}' @@ -224,15 +217,7 @@ if (Test-Path $remotingScript) } #wait a bit, it's windows after all Start-Sleep -m 10000 #Write-Host "Press any key to reboot and finish image configuration" #[void]$host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown') -
masterzen revised this gist
Jan 6, 2014 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -8,7 +8,7 @@ # # <powershell> # Set-ExecutionPolicy Unrestricted # icm $executioncontext.InvokeCommand.NewScriptBlock((New-Object Net.WebClient).DownloadString('https://gist.github.com/masterzen/6714787/raw')) -ArgumentList "adminPassword" # </powershell> # param( @@ -234,7 +234,7 @@ del 'c:\afterRebootScript.ps1' -ErrorAction SilentlyContinue Set-ItemProperty -path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run -name 'Restart-And-Resume' ` -value "$(Join-Path $env:windir 'system32\WindowsPowerShell\v1.0\powershell.exe') c:\afterRebootScript.ps1" #Write-Host "Press any key to reboot and finish image configuration" #[void]$host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown') Restart-Computer -
masterzen revised this gist
Jan 6, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -194,7 +194,7 @@ Add-Content $log -value "Installed Chocolatey" curl -# -G -k -L https://downloads.puppetlabs.com/windows/puppet-3.2.4.msi -o puppet-3.2.4.msi 2>&1 > "$log" Start-Process -FilePath "msiexec.exe" -ArgumentList '/qn /passive /i puppet-3.2.4.msi /norestart"' -Wait SetX Path "${Env:Path};C:\Program Files\Puppet Labs\Puppet\bin" /m &sc.exe config puppet start= demand Add-Content $log -value "Installed Puppet" #this script will be fired off after the reboot -
masterzen revised this gist
Jan 6, 2014 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -58,7 +58,7 @@ if ((Test-Path "${Env:windir}\Microsoft.NET\Framework\v4.0.30319") -eq $false) else { 'http://download.microsoft.com/download/9/5/A/95A9616B-7A37-4AF6-BC36-D6EA96C8DAAE/dotNetFx40_Full_x86_x64.exe' } $client.DownloadFile( $netUrl, 'dotNetFx40_Full.exe') Start-Process -FilePath 'C:\Users\Administrator\dotNetFx40_Full.exe' -ArgumentList '/norestart /q /ChainingPackage ADMINDEPLOYMENT' -Wait -NoNewWindow del dotNetFx40_Full.exe Add-Content $log -value "Found that .NET4 was not installed and downloaded / installed" } @@ -121,7 +121,7 @@ $vcredist = if ($Is32Bit) { 'http://download.microsoft.com/download/5/B/C/5BC5DB else { 'http://download.microsoft.com/download/3/2/2/3224B87F-CFA0-4E70-BDA3-3DE650EFEBA5/vcredist_x64.exe' } $client.DownloadFile( $vcredist, 'vcredist.exe') Start-Process -FilePath 'C:\Users\Administrator\vcredist.exe' -ArgumentList '/norestart /q' -Wait del vcredist.exe Add-Content $log -value "Installed VC++ 2010 Redistributable from $vcredist and updated path" @@ -130,7 +130,7 @@ $vcredist = if ($Is32Bit) { 'http://download.microsoft.com/download/d/d/9/dd9a82 else { 'http://download.microsoft.com/download/d/2/4/d242c3fb-da5a-4542-ad66-f9661d0a8d19/vcredist_x64.exe' } $client.DownloadFile( $vcredist, 'vcredist.exe') Start-Process -FilePath 'C:\Users\Administrator\vcredist.exe' -ArgumentList '/norestart /q' -Wait del vcredist.exe Add-Content $log -value "Installed VC++ 2008 Redistributable from $vcredist and updated path" @@ -194,7 +194,7 @@ Add-Content $log -value "Installed Chocolatey" curl -# -G -k -L https://downloads.puppetlabs.com/windows/puppet-3.2.4.msi -o puppet-3.2.4.msi 2>&1 > "$log" Start-Process -FilePath "msiexec.exe" -ArgumentList '/qn /passive /i puppet-3.2.4.msi /norestart"' -Wait SetX Path "${Env:Path};C:\Program Files\Puppet Labs\Puppet\bin" /m &sc config puppet start= demand Add-Content $log -value "Installed Puppet" #this script will be fired off after the reboot -
masterzen revised this gist
Jan 6, 2014 . 1 changed file with 3 additions and 4 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -28,7 +28,6 @@ while (($AdminPassword -eq $null) -or ($AdminPassword -eq '')) $AdminPassword = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR((Read-Host "Enter a non-null / non-empty Administrator password" -AsSecureString))) } $systemPath = [Environment]::GetFolderPath([Environment+SpecialFolder]::System) $sysNative = [IO.Path]::Combine($env:windir, "sysnative") @@ -235,7 +234,7 @@ del 'c:\afterRebootScript.ps1' -ErrorAction SilentlyContinue Set-ItemProperty -path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run -name 'Restart-And-Resume' ` -value "$(Join-Path $env:windir 'system32\WindowsPowerShell\v1.0\powershell.exe') c:\afterRebootScript.ps1" Write-Host "Press any key to reboot and finish image configuration" [void]$host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown') #Restart-Computer -
masterzen revised this gist
Jan 6, 2014 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -41,7 +41,10 @@ $coreEditions = @(0x0c,0x27,0x0e,0x29,0x2a,0x0d,0x28,0x1d) $IsCore = $coreEditions -contains (Get-WmiObject -Query "Select OperatingSystemSKU from Win32_OperatingSystem" | Select -ExpandProperty OperatingSystemSKU) Add-Content $log -value "Is Core [$IsCore]" # move to home, PS is incredibly complex :) cd $Env:USERPROFILE Set-Location -Path $Env:USERPROFILE [Environment]::CurrentDirectory=(Get-Location -PSProvider FileSystem).ProviderPath #change admin password net user Administrator $AdminPassword -
masterzen revised this gist
Jan 5, 2014 . 1 changed file with 13 additions and 10 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -47,13 +47,15 @@ cd $Env:USERPROFILE net user Administrator $AdminPassword Add-Content $log -value "Changed Administrator password" $client = new-object System.Net.WebClient #.net 4 if ((Test-Path "${Env:windir}\Microsoft.NET\Framework\v4.0.30319") -eq $false) { $netUrl = if ($IsCore) {'http://download.microsoft.com/download/3/6/1/361DAE4E-E5B9-4824-B47F-6421A6C59227/dotNetFx40_Full_x86_x64_SC.exe' } ` else { 'http://download.microsoft.com/download/9/5/A/95A9616B-7A37-4AF6-BC36-D6EA96C8DAAE/dotNetFx40_Full_x86_x64.exe' } $client.DownloadFile( $netUrl, 'dotNetFx40_Full.exe') Start-Process -FilePath 'dotNetFx40_Full.exe' -ArgumentList '/norestart /q /ChainingPackage ADMINDEPLOYMENT' -Wait -NoNewWindow del dotNetFx40_Full.exe Add-Content $log -value "Found that .NET4 was not installed and downloaded / installed" @@ -105,7 +107,7 @@ if ($IsCore) $7zUri = if ($Is32Bit) { 'http://sourceforge.net/projects/sevenzip/files/7-Zip/9.22/7z922.msi/download' } ` else { 'http://sourceforge.net/projects/sevenzip/files/7-Zip/9.22/7z922-x64.msi/download' } $client.DownloadFile( $7zUri, '7z922.msi') Start-Process -FilePath "msiexec.exe" -ArgumentList '/i 7z922.msi /norestart /q INSTALLDIR="c:\program files\7-zip"' -Wait SetX Path "${Env:Path};C:\Program Files\7-zip" /m $Env:Path += ';C:\Program Files\7-Zip' @@ -116,7 +118,7 @@ Add-Content $log -value "Installed 7-zip from $7zUri and updated path" $vcredist = if ($Is32Bit) { 'http://download.microsoft.com/download/5/B/C/5BC5DBB3-652D-4DCE-B14A-475AB85EEF6E/vcredist_x86.exe'} ` else { 'http://download.microsoft.com/download/3/2/2/3224B87F-CFA0-4E70-BDA3-3DE650EFEBA5/vcredist_x64.exe' } $client.DownloadFile( $vcredist, 'vcredist.exe') Start-Process -FilePath 'vcredist.exe' -ArgumentList '/norestart /q' -Wait del vcredist.exe Add-Content $log -value "Installed VC++ 2010 Redistributable from $vcredist and updated path" @@ -125,19 +127,20 @@ Add-Content $log -value "Installed VC++ 2010 Redistributable from $vcredist and $vcredist = if ($Is32Bit) { 'http://download.microsoft.com/download/d/d/9/dd9a82d0-52ef-40db-8dab-95376989c03/vcredist_x86.exe'} ` else { 'http://download.microsoft.com/download/d/2/4/d242c3fb-da5a-4542-ad66-f9661d0a8d19/vcredist_x64.exe' } $client.DownloadFile( $vcredist, 'vcredist.exe') Start-Process -FilePath 'vcredist.exe' -ArgumentList '/norestart /q' -Wait del vcredist.exe Add-Content $log -value "Installed VC++ 2008 Redistributable from $vcredist and updated path" #curl $curlUri = if ($Is32Bit) { 'http://www.paehl.com/open_source/?download=curl_724_0_ssl.zip' } ` else { 'http://curl.haxx.se/download/curl-7.23.1-win64-ssl-sspi.zip' } $client.DownloadFile( $curlUri, 'curl.zip') &7z e curl.zip `-o`"c:\program files\curl`" if ($Is32Bit) { $client.DownloadFile( 'http://www.paehl.com/open_source/?download=libssl.zip', 'libssl.zip') &7z e libssl.zip `-o`"c:\program files\curl`" del libssl.zip } @@ -171,7 +174,7 @@ else $tempDir = Join-Path $env:TEMP "chocInstall" if (![System.IO.Directory]::Exists($tempDir)) {[System.IO.Directory]::CreateDirectory($tempDir)} $file = Join-Path $tempDir "chocolatey.zip" $client.DownloadFile("http://chocolatey.org/api/v1/package/chocolatey", $file) &7z x $file `-o`"$tempDir`" Add-Content $log -value 'Extracted Chocolatey' @@ -229,7 +232,7 @@ del 'c:\afterRebootScript.ps1' -ErrorAction SilentlyContinue Set-ItemProperty -path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run -name 'Restart-And-Resume' ` -value "$(Join-Path $env:windir 'system32\WindowsPowerShell\v1.0\powershell.exe') c:\afterRebootScript.ps1" #Write-Host "Press any key to reboot and finish image configuration" #[void]$host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown') Restart-Computer -
masterzen revised this gist
Jan 5, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -8,7 +8,7 @@ # # <powershell> # Set-ExecutionPolicy Unrestricted # icm $executioncontext.InvokeCommand.NewScriptBlock((New-Object Net.WebClient).DownloadString('https://gist.github.com/masterzen/6714787/raw/5862d7b858bcaa7856d8ce063a80c7323a2d8276/Bootstrap-EC2-Windows-CloudInit.ps1')) -ArgumentList "adminPassword" # </powershell> # param( -
masterzen revised this gist
Jan 5, 2014 . 1 changed file with 15 additions and 68 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,24 +1,20 @@ # Windows AMIs don't have WinRM enabled by default -- this script will enable WinRM # AND install 7-zip, curl and .NET 4 if its missing. # Then use the EC2 tools to create a new AMI from the result, and you have a system # that will execute user-data as a PowerShell script after the instance fires up! # This has been tested on Windows 2008 SP2 64bits AMIs provided by Amazon # # Inject this as user-data of a Windows 2008 AMI, like this (edit the adminPassword to your needs): # # <powershell> # Set-ExecutionPolicy Unrestricted # icm $executioncontext.InvokeCommand.NewScriptBlock((New-Object Net.WebClient).DownloadString('https://raw.github.com/gist/6714787/Bootstrap-EC2-Windows-CloudInit.ps1')) -ArgumentList "adminPassword" # </powershell> # param( [Parameter(Mandatory=$true)] [string] $AdminPassword ) Start-Transcript -Path 'c:\bootstrap-transcript.txt' -Force @@ -32,11 +28,6 @@ while (($AdminPassword -eq $null) -or ($AdminPassword -eq '')) $AdminPassword = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR((Read-Host "Enter a non-null / non-empty Administrator password" -AsSecureString))) } Import-Module BitsTransfer $systemPath = [Environment]::GetFolderPath([Environment+SpecialFolder]::System) @@ -91,16 +82,6 @@ if (Test-Path "${Env:windir}\system32\WindowsPowerShell\v1.0\powershell.exe") Add-Content $log -value "Configured host OS specific Powershell at ${Env:windir}\system32\ to use .NET 4" } #check winrm id, if it's not valid and LocalAccountTokenFilterPolicy isn't established, do it $id = &winrm id if (($id -eq $null) -and (Get-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System -name LocalAccountTokenFilterPolicy -ErrorAction SilentlyContinue) -eq $null) @@ -148,6 +129,7 @@ Start-BitsTransfer $vcredist 'vcredist.exe' Start-Process -FilePath 'vcredist.exe' -ArgumentList '/norestart /q' -Wait del vcredist.exe Add-Content $log -value "Installed VC++ 2008 Redistributable from $vcredist and updated path" #curl $curlUri = if ($Is32Bit) { 'http://www.paehl.com/open_source/?download=curl_724_0_ssl.zip' } ` else { 'http://curl.haxx.se/download/curl-7.23.1-win64-ssl-sspi.zip' } @@ -176,19 +158,6 @@ $Env:Path += ';C:\Program Files\Vim' Move-Item .\vim\vim73 -Destination "${Env:ProgramFiles}\Vim" Add-Content $log -value "Installed Vim text editor and updated path" #chocolatey - standard one line installer doesn't work on Core b/c Shell.Application can't unzip if (-not $IsCore) { @@ -211,18 +180,6 @@ else & $chocInstallPS1 Add-Content $log -value 'Installed Chocolatey / Verifying Paths' } Add-Content $log -value "Installed Chocolatey" @@ -235,14 +192,6 @@ SetX Path "${Env:Path};C:\Program Files\Puppet Labs\Puppet\bin" /m sc config puppet start= demand Add-Content $log -value "Installed Puppet" #this script will be fired off after the reboot #http://www.codeproject.com/Articles/223002/Reboot-and-Resume-PowerShell-Script @' @@ -254,11 +203,10 @@ Remove-ItemProperty -path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run -n &winrm set winrm/config/client/auth '@{Basic="true"}' &winrm set winrm/config/service/auth '@{Basic="true"}' &winrm set winrm/config/service '@{AllowUnencrypted="true"}' Add-Content $log -value "Ran quickconfig for winrm" &netsh firewall set portopening tcp 445 smb enable Add-Content $log -value "Ran firewall config to allow incoming smb/tcp" #run SMRemoting script to enable event log management, etc - available only on R2 $remotingScript = [IO.Path]::Combine($systemPath, 'Configure-SMRemoting.ps1') @@ -270,12 +218,11 @@ if (Test-Path $remotingScript) Add-Content $log -value 'Ran Configure-SMRemoting.ps1' } #wait a bit, it's windows after all Start-Sleep -m 15000 #clear event log wevtutil el | % {Write-Host "Clearing $_"; wevtutil cl "$_"} del 'c:\afterRebootScript.ps1' -ErrorAction SilentlyContinue '@ | Set-Content 'c:\afterRebootScript.ps1' -
masterzen revised this gist
Oct 4, 2013 . 1 changed file with 7 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -238,6 +238,9 @@ Add-Content $log -value "Installed Puppet" # install freesshd &chocolatey install freesshd # install java &chocolatey install jdk7 # configure freeshd to generate keys? #this script will be fired off after the reboot @@ -248,9 +251,10 @@ $systemPath = [Environment]::GetFolderPath([Environment+SpecialFolder]::System) Remove-ItemProperty -path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run -name 'Restart-And-Resume' &winrm quickconfig `-q &winrm set winrm/config/client/auth '@{Basic="true"}' &winrm set winrm/config/service/auth '@{Basic="true"}' &winrm set winrm/config/service '@{AllowUnencrypted="true"}' &winrm set winrm/config/service/auth '@{Negotiation="false"}' Add-Content $log -value "Ran quickconfig for winrm" &netsh advfirewall firewall add rule dir=in protocol=TCP localport=22 action=allow name="SSH" -
masterzen revised this gist
Sep 30, 2013 . 1 changed file with 11 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -235,6 +235,11 @@ SetX Path "${Env:Path};C:\Program Files\Puppet Labs\Puppet\bin" /m sc config puppet start= demand Add-Content $log -value "Installed Puppet" # install freesshd &chocolatey install freesshd # configure freeshd to generate keys? #this script will be fired off after the reboot #http://www.codeproject.com/Articles/223002/Reboot-and-Resume-PowerShell-Script @' @@ -243,8 +248,14 @@ $systemPath = [Environment]::GetFolderPath([Environment+SpecialFolder]::System) Remove-ItemProperty -path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run -name 'Restart-And-Resume' &winrm quickconfig `-q &winrm set winrm/config/client/auth @{Basic="true"} &winrm set winrm/config/service/auth @{Basic="true"} &winrm set winrm/config/service @{AllowUnencrypted="true"} Add-Content $log -value "Ran quickconfig for winrm" &netsh advfirewall firewall add rule dir=in protocol=TCP localport=22 action=allow name="SSH" Add-Content $log -value "Ran firewall config to allow ssh" #run SMRemoting script to enable event log management, etc - available only on R2 $remotingScript = [IO.Path]::Combine($systemPath, 'Configure-SMRemoting.ps1') if (-not (Test-Path $remotingScript)) { $remotingScript = [IO.Path]::Combine($sysNative, 'Configure-SMRemoting.ps1') } -
masterzen revised this gist
Sep 30, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -232,7 +232,7 @@ Add-Content $log -value "Installed Chocolatey" curl -# -G -k -L https://downloads.puppetlabs.com/windows/puppet-3.2.4.msi -o puppet-3.2.4.msi 2>&1 > "$log" Start-Process -FilePath "msiexec.exe" -ArgumentList '/qn /passive /i puppet-3.2.4.msi /norestart"' -Wait SetX Path "${Env:Path};C:\Program Files\Puppet Labs\Puppet\bin" /m sc config puppet start= demand Add-Content $log -value "Installed Puppet" #this script will be fired off after the reboot -
masterzen revised this gist
Sep 30, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -230,7 +230,7 @@ Add-Content $log -value "Installed Chocolatey" # install puppet #https://downloads.puppetlabs.com/windows/puppet-3.2.4.msi curl -# -G -k -L https://downloads.puppetlabs.com/windows/puppet-3.2.4.msi -o puppet-3.2.4.msi 2>&1 > "$log" Start-Process -FilePath "msiexec.exe" -ArgumentList '/qn /passive /i puppet-3.2.4.msi /norestart"' -Wait SetX Path "${Env:Path};C:\Program Files\Puppet Labs\Puppet\bin" /m Add-Content $log -value "Installed Puppet" -
masterzen revised this gist
Sep 30, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -230,7 +230,7 @@ Add-Content $log -value "Installed Chocolatey" # install puppet #https://downloads.puppetlabs.com/windows/puppet-3.2.4.msi curl -# -G -k -L https://downloads.puppetlabs.com/windows/puppet-3.2.4.msi -o puppet-3.2.4.msi 2>&1 > "$log" Start-Process -FilePath "msiexec.exe" -ArgumentList '/i puppet-3.2.4.msi /norestart /qn "' -Wait SetX Path "${Env:Path};C:\Program Files\Puppet Labs\Puppet\bin" /m Add-Content $log -value "Installed Puppet" -
masterzen revised this gist
Sep 30, 2013 . 1 changed file with 17 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -131,7 +131,23 @@ $Env:Path += ';C:\Program Files\7-Zip' del 7z922.msi Add-Content $log -value "Installed 7-zip from $7zUri and updated path" #vc 2010 redstributable $vcredist = if ($Is32Bit) { 'http://download.microsoft.com/download/5/B/C/5BC5DBB3-652D-4DCE-B14A-475AB85EEF6E/vcredist_x86.exe'} ` else { 'http://download.microsoft.com/download/3/2/2/3224B87F-CFA0-4E70-BDA3-3DE650EFEBA5/vcredist_x64.exe' } Start-BitsTransfer $vcredist 'vcredist.exe' Start-Process -FilePath 'vcredist.exe' -ArgumentList '/norestart /q' -Wait del vcredist.exe Add-Content $log -value "Installed VC++ 2010 Redistributable from $vcredist and updated path" #vc 2008 redstributable $vcredist = if ($Is32Bit) { 'http://download.microsoft.com/download/d/d/9/dd9a82d0-52ef-40db-8dab-95376989c03/vcredist_x86.exe'} ` else { 'http://download.microsoft.com/download/d/2/4/d242c3fb-da5a-4542-ad66-f9661d0a8d19/vcredist_x64.exe' } Start-BitsTransfer $vcredist 'vcredist.exe' Start-Process -FilePath 'vcredist.exe' -ArgumentList '/norestart /q' -Wait del vcredist.exe Add-Content $log -value "Installed VC++ 2008 Redistributable from $vcredist and updated path" #curl $curlUri = if ($Is32Bit) { 'http://www.paehl.com/open_source/?download=curl_724_0_ssl.zip' } ` else { 'http://curl.haxx.se/download/curl-7.23.1-win64-ssl-sspi.zip' } -
masterzen revised this gist
Sep 30, 2013 . 1 changed file with 8 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -211,6 +211,14 @@ else Add-Content $log -value "Installed Chocolatey" # install puppet #https://downloads.puppetlabs.com/windows/puppet-3.2.4.msi curl -# -G -k -L https://downloads.puppetlabs.com/windows/puppet-3.2.4.msi -o puppet-3.2.4.msi 2>&1 > "$log" Start-Process -FilePath "msiexec.exe" -ArgumentList '/i puppet-3.2.4.msi /norestart /q "' -Wait SetX Path "${Env:Path};C:\Program Files\Puppet Labs\Puppet\bin" /m Add-Content $log -value "Installed Puppet" #this script will be fired off after the reboot #http://www.codeproject.com/Articles/223002/Reboot-and-Resume-PowerShell-Script @' -
masterzen revised this gist
Sep 26, 2013 . 1 changed file with 10 additions and 10 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -180,8 +180,8 @@ if (-not $IsCore) } else { #[Environment]::SetEnvironmentVariable('ChocolateyInstall', 'c:\nuget', [System.EnvironmentVariableTarget]::User) #if (![System.IO.Directory]::Exists('c:\nuget')) {[System.IO.Directory]::CreateDirectory('c:\nuget')} $tempDir = Join-Path $env:TEMP "chocInstall" if (![System.IO.Directory]::Exists($tempDir)) {[System.IO.Directory]::CreateDirectory($tempDir)} @@ -196,17 +196,17 @@ else Add-Content $log -value 'Installed Chocolatey / Verifying Paths' #if ($($env:Path).ToLower().Contains('c:\nuget\bin') -eq $false) { # $env:Path = [Environment]::GetEnvironmentVariable('Path', [System.EnvironmentVariableTarget]::Machine); #} #Import-Module -Name 'c:\nuget\chocolateyInstall\helpers\chocolateyinstaller.psm1' #& C:\NuGet\chocolateyInstall\chocolatey.ps1 update #Add-Content $log -value 'Updated chocolatey to the latest version' #[Environment]::SetEnvironmentVariable('Chocolatey_Bin_Root', '\tools', 'Machine') #$Env:Chocolatey_bin_root = '\tools' } Add-Content $log -value "Installed Chocolatey" -
masterzen revised this gist
Sep 26, 2013 . 1 changed file with 18 additions and 16 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -161,17 +161,17 @@ Move-Item .\vim\vim73 -Destination "${Env:ProgramFiles}\Vim" Add-Content $log -value "Installed Vim text editor and updated path" #cloudinit.net #curl http://cloudinitnet.codeplex.com/releases/83697/download/351123 `-L `-d `'`' `-o cloudinit.zip #&7z e cloudinit.zip `-o`"c:\program files\CloudInit.NET`" #del cloudinit.zip #Add-Content $log -value 'Downloaded / extracted CloudInit.NET' #$configFile = 'c:\program files\cloudinit.net\install-service.ps1' #(Get-Content $configFile) | % { $_ -replace "3e3e2d3848336b7d3b547b2b55",$CloudInitEncryptionPassword } | Set-Content #$configFile #cd 'c:\program files\cloudinit.net' #. .\install.ps1 #Start-Service CloudInit #Add-Content $log -value "Updated config file with CloudInit encryption password and ran installation scrpit" #chocolatey - standard one line installer doesn't work on Core b/c Shell.Application can't unzip if (-not $IsCore) @@ -180,6 +180,9 @@ if (-not $IsCore) } else { [Environment]::SetEnvironmentVariable('ChocolateyInstall', 'c:\nuget', [System.EnvironmentVariableTarget]::User) if (![System.IO.Directory]::Exists('c:\nuget')) {[System.IO.Directory]::CreateDirectory('c:\nuget')} $tempDir = Join-Path $env:TEMP "chocInstall" if (![System.IO.Directory]::Exists($tempDir)) {[System.IO.Directory]::CreateDirectory($tempDir)} $file = Join-Path $tempDir "chocolatey.zip" @@ -192,16 +195,15 @@ else & $chocInstallPS1 Add-Content $log -value 'Installed Chocolatey / Verifying Paths' if ($($env:Path).ToLower().Contains('c:\nuget\bin') -eq $false) { $env:Path = [Environment]::GetEnvironmentVariable('Path', [System.EnvironmentVariableTarget]::Machine); } Import-Module -Name 'c:\nuget\chocolateyInstall\helpers\chocolateyinstaller.psm1' & C:\NuGet\chocolateyInstall\chocolatey.ps1 update Add-Content $log -value 'Updated chocolatey to the latest version' [Environment]::SetEnvironmentVariable('Chocolatey_Bin_Root', '\tools', 'Machine') $Env:Chocolatey_bin_root = '\tools' @@ -244,4 +246,4 @@ Set-ItemProperty -path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run -name Write-Host "Press any key to reboot and finish image configuration" [void]$host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown') #Restart-Computer -
masterzen revised this gist
Sep 26, 2013 . 1 changed file with 0 additions and 17 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -131,23 +131,6 @@ $Env:Path += ';C:\Program Files\7-Zip' del 7z922.msi Add-Content $log -value "Installed 7-zip from $7zUri and updated path" #curl $curlUri = if ($Is32Bit) { 'http://www.paehl.com/open_source/?download=curl_724_0_ssl.zip' } ` -
Iristyle revised this gist
Sep 26, 2012 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -219,6 +219,9 @@ else Import-Module -Name 'c:\nuget\chocolateyInstall\helpers\chocolateyinstaller.psm1' & C:\NuGet\chocolateyInstall\chocolatey.ps1 update Add-Content $log -value 'Updated chocolatey to the latest version' [Environment]::SetEnvironmentVariable('Chocolatey_Bin_Root', '\tools', 'Machine') $Env:Chocolatey_bin_root = '\tools' } Add-Content $log -value "Installed Chocolatey" -
Iristyle revised this gist
Apr 16, 2012 . 1 changed file with 2 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -166,9 +166,8 @@ del curl.zip Add-Content $log -value "Installed Curl from $curlUri and updated path" #vim curl -# -G -k -L ftp://ftp.vim.org/pub/vim/pc/vim73_46rt.zip -o vim73_46rt.zip 2>&1 > "$log" curl -# -G -k -L ftp://ftp.vim.org/pub/vim/pc/vim73_46w32.zip -o vim73_46w32.zip 2>&1 > "$log" Get-ChildItem -Filter vim73*.zip | % { &7z x `"$($_.FullName)`"; del $_.FullName; } -
Iristyle revised this gist
Apr 16, 2012 . 1 changed file with 14 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -165,8 +165,21 @@ $Env:Path += ';C:\Program Files\Curl' del curl.zip Add-Content $log -value "Installed Curl from $curlUri and updated path" #vim &'curl.exe' -# -G -k -L ftp://ftp.vim.org/pub/vim/pc/vim73_46rt.zip -o "${env:Temp}\vim73_46rt.zip" 2>&1 > "$log" &'curl.exe' -# -G -k -L ftp://ftp.vim.org/pub/vim/pc/vim73_46w32.zip -o "${env:Temp}\vim73_46w32.zip" 2>&1 > "$log" cd $env:temp Get-ChildItem -Filter vim73*.zip | % { &7z x `"$($_.FullName)`"; del $_.FullName; } SetX Path "${Env:Path};C:\Program Files\Vim" /m $Env:Path += ';C:\Program Files\Vim' Move-Item .\vim\vim73 -Destination "${Env:ProgramFiles}\Vim" Add-Content $log -value "Installed Vim text editor and updated path" #cloudinit.net curl http://cloudinitnet.codeplex.com/releases/83697/download/351123 `-L `-d `'`' `-o cloudinit.zip &7z e cloudinit.zip `-o`"c:\program files\CloudInit.NET`" del cloudinit.zip Add-Content $log -value 'Downloaded / extracted CloudInit.NET' -
Iristyle revised this gist
Feb 21, 2012 . 1 changed file with 11 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -131,14 +131,23 @@ $Env:Path += ';C:\Program Files\7-Zip' del 7z922.msi Add-Content $log -value "Installed 7-zip from $7zUri and updated path" #vc 2010 redstributable $vcredist = if ($Is32Bit) { 'http://download.microsoft.com/download/5/B/C/5BC5DBB3-652D-4DCE-B14A-475AB85EEF6E/vcredist_x86.exe'} ` else { 'http://download.microsoft.com/download/3/2/2/3224B87F-CFA0-4E70-BDA3-3DE650EFEBA5/vcredist_x64.exe' } Start-BitsTransfer $vcredist 'vcredist.exe' Start-Process -FilePath 'vcredist.exe' -ArgumentList '/norestart /q' -Wait del vcredist.exe Add-Content $log -value "Installed VC++ 2010 Redistributable from $vcredist and updated path" #vc 2008 redstributable $vcredist = if ($Is32Bit) { 'http://download.microsoft.com/download/d/d/9/dd9a82d0-52ef-40db-8dab-795376989c03/vcredist_x86.exe'} ` else { 'http://download.microsoft.com/download/d/2/4/d242c3fb-da5a-4542-ad66-f9661d0a8d19/vcredist_x64.exe' } Start-BitsTransfer $vcredist 'vcredist.exe' Start-Process -FilePath 'vcredist.exe' -ArgumentList '/norestart /q' -Wait del vcredist.exe Add-Content $log -value "Installed VC++ 2008 Redistributable from $vcredist and updated path" #curl $curlUri = if ($Is32Bit) { 'http://www.paehl.com/open_source/?download=curl_724_0_ssl.zip' } ` -
Iristyle revised this gist
Feb 20, 2012 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -149,6 +149,7 @@ if ($Is32Bit) { Start-BitsTransfer 'http://www.paehl.com/open_source/?download=libssl.zip' libssl.zip &7z e libssl.zip `-o`"c:\program files\curl`" del libssl.zip } SetX Path "${Env:Path};C:\Program Files\Curl" /m $Env:Path += ';C:\Program Files\Curl' -
Iristyle revised this gist
Feb 20, 2012 . 1 changed file with 6 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -141,10 +141,15 @@ del vcredist.exe Add-Content $log -value "Installed VC++ Redistributable from $vcredist and updated path" #curl $curlUri = if ($Is32Bit) { 'http://www.paehl.com/open_source/?download=curl_724_0_ssl.zip' } ` else { 'http://curl.haxx.se/download/curl-7.23.1-win64-ssl-sspi.zip' } Start-BitsTransfer $curlUri curl.zip &7z e curl.zip `-o`"c:\program files\curl`" if ($Is32Bit) { Start-BitsTransfer 'http://www.paehl.com/open_source/?download=libssl.zip' libssl.zip &7z e libssl.zip `-o`"c:\program files\curl`" } SetX Path "${Env:Path};C:\Program Files\Curl" /m $Env:Path += ';C:\Program Files\Curl' del curl.zip -
Iristyle revised this gist
Feb 10, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -60,7 +60,7 @@ Add-Content $log -value "Changed Administrator password" if ((Test-Path "${Env:windir}\Microsoft.NET\Framework\v4.0.30319") -eq $false) { $netUrl = if ($IsCore) {'http://download.microsoft.com/download/3/6/1/361DAE4E-E5B9-4824-B47F-6421A6C59227/dotNetFx40_Full_x86_x64_SC.exe' } ` else { 'http://download.microsoft.com/download/9/5/A/95A9616B-7A37-4AF6-BC36-D6EA96C8DAAE/dotNetFx40_Full_x86_x64.exe' } Start-BitsTransfer $netUrl dotNetFx40_Full.exe Start-Process -FilePath 'dotNetFx40_Full.exe' -ArgumentList '/norestart /q /ChainingPackage ADMINDEPLOYMENT' -Wait -NoNewWindow
NewerOlder