-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…tey but uses chocolatey.dll
- Loading branch information
Showing
51 changed files
with
1,823 additions
and
707 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,23 @@ | ||
Resolve-Path $PSScriptRoot\*.ps1 | | ||
% { . $_.ProviderPath } | ||
|
||
Export-ModuleMember Write-BoxstarterMessage, Start-TimedSection, Stop-TimedSection, Enter-BoxstarterLogable, Out-BoxstarterLog, Log-BoxstarterMessage, Test-Admin, Invoke-FromTask, Get-IsRemote, Confirm-Choice, Create-BoxstarterTask, Remove-BoxstarterTask, Write-BoxstarterLogo, Get-CurrentUser, Get-IsMicrosoftUpdateEnabled, Invoke-RetriableScript, Remove-BoxstarterError | ||
|
||
Export-ModuleMember -Variable Boxstarter | ||
Export-ModuleMember Confirm-Choice,` | ||
Create-BoxstarterTask,` | ||
Enter-BoxstarterLogable,` | ||
Enter-DotNet4,` | ||
Get-CurrentUser,` | ||
Get-IsMicrosoftUpdateEnabled,` | ||
Get-IsRemote,` | ||
Invoke-FromTask,` | ||
Invoke-RetriableScript,` | ||
Out-BoxstarterLog,` | ||
Log-BoxstarterMessage,` | ||
Remove-BoxstarterError,` | ||
Remove-BoxstarterTask,` | ||
Start-TimedSection,` | ||
Stop-TimedSection,` | ||
Test-Admin,` | ||
Write-BoxstarterLogo,` | ||
Write-BoxstarterMessage | ||
|
||
Export-ModuleMember -Variable Boxstarter |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
function Enter-Dotnet4 { | ||
<# | ||
.SYNOPSIS | ||
Runs a script from a process hosting the .net 4 runtile | ||
.DESCRIPTION | ||
This function will ensure that the .net 4 runtime is installed on the | ||
machine. If it is not, it will be downloaded and installed. If running | ||
remotely, the .net 4 installation will run from a scheduled task. | ||
If the CLRVersion of the hosting powershell process is less than 4, | ||
such as is the case in powershell 2, the given script will be run | ||
from a new a new powershell process tht will be configured to host the | ||
CLRVersion 4.0.30319. | ||
.Parameter ScriptBlock | ||
The script to be executed in the .net 4 CLR | ||
.Parameter ArgumentList | ||
Arguments to be passed to the ScriptBlock | ||
.LINK | ||
http://boxstarter.org | ||
#> | ||
param( | ||
[ScriptBlock]$ScriptBlock, | ||
[object[]]$ArgumentList | ||
) | ||
Enable-Net40 | ||
if($PSVersionTable.CLRVersion.Major -lt 4) { | ||
Write-BoxstarterMessage "Relaunching powershell under .net fx v4" -verbose | ||
$env:COMPLUS_version="v4.0.30319" | ||
& powershell -OutputFormat Text -ExecutionPolicy bypass -command $ScriptBlock -args $ArgumentList | ||
} | ||
else { | ||
Write-BoxstarterMessage "Using current powershell..." -verbose | ||
Invoke-Command -ScriptBlock $ScriptBlock -argumentlist $ArgumentList | ||
} | ||
} | ||
|
||
function Is64Bit { [IntPtr]::Size -eq 8 } | ||
|
||
function Enable-Net40 { | ||
if(Is64Bit) {$fx="framework64"} else {$fx="framework"} | ||
if(!(test-path "$env:windir\Microsoft.Net\$fx\v4.0.30319")) { | ||
if((Test-PendingReboot) -and $Boxstarter.RebootOk) {return Invoke-Reboot} | ||
Write-BoxstarterMessage "Downloading .net 4.5..." | ||
Get-HttpToFile "http://download.microsoft.com/download/b/a/4/ba4a7e71-2906-4b2d-a0e1-80cf16844f5f/dotnetfx45_full_x86_x64.exe" "$env:temp\net45.exe" | ||
Write-BoxstarterMessage "Installing .net 4.5..." | ||
if(Get-IsRemote) { | ||
Invoke-FromTask @" | ||
Start-Process "$env:temp\net45.exe" -verb runas -wait -argumentList "/quiet /norestart /log $env:temp\net45.log" | ||
"@ | ||
} | ||
else { | ||
$proc = Start-Process "$env:temp\net45.exe" -verb runas -argumentList "/quiet /norestart /log $env:temp\net45.log" -PassThru | ||
while(!$proc.HasExited){ sleep -Seconds 1 } | ||
} | ||
} | ||
} | ||
|
||
function Get-HttpToFile ($url, $file){ | ||
Write-BoxstarterMessage "Downloading $url to $file" -Verbose | ||
Invoke-RetriableScript -RetryScript { | ||
if(Test-Path $args[1]){Remove-Item $args[1] -Force} | ||
$downloader=new-object net.webclient | ||
$wp=[system.net.WebProxy]::GetDefaultProxy() | ||
$wp.UseDefaultCredentials=$true | ||
$downloader.Proxy=$wp | ||
try { | ||
$downloader.DownloadFile($args[0], $args[1]) | ||
} | ||
catch{ | ||
if($VerbosePreference -eq "Continue"){ | ||
Write-Error $($_.Exception | fl * -Force | Out-String) | ||
} | ||
throw $_ | ||
} | ||
} $url $file | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
if(!$Global:Boxstarter) { $Global:Boxstarter = @{} } | ||
$Boxstarter.Log="$(Get-BoxstarterTempDir)\boxstarter.log" | ||
$Boxstarter.RebootOk=$false | ||
$Boxstarter.IsRebooting=$false | ||
if(!$Boxstarter.ContainsKey('Log')) { | ||
$Boxstarter.Log="$(Get-BoxstarterTempDir)\boxstarter.log" | ||
} | ||
if(!$Boxstarter.ContainsKey('RebootOk')) { $Boxstarter.RebootOk=$false } | ||
if(!$Boxstarter.ContainsKey('IsRebooting')) { $Boxstarter.IsRebooting=$false } |
This file contains 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
This file contains 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
Oops, something went wrong.