CmdLets/Install-PreReq.ps1
|
Function Install-PreReq { [CmdletBinding()] Param( [Parameter(Mandatory=$true)][String]$PreReq, [Parameter(Mandatory=$true)][Boolean]$Package ) Write-Host "Installing $PreReq" if (!$Package) { Install-Module $PreReq -Scope AllUsers -Force | Import-Module $PreReq } else { $pkg = (Install-Package $PreReq -ProviderName NuGet -Scope AllUsers -Force -SkipDependencies).Payload.Directories[0] Add-Type -Path (Get-ChildItem (Split-Path ($Pkg.location) -Parent) -Filter "$PreReq.dll" -Recurse -File)[0].FullName } } |