Skip to content

Instantly share code, notes, and snippets.

@DamianReeves
Last active August 29, 2015 14:07
Show Gist options
  • Save DamianReeves/02e5f70884a7d2d7ecf6 to your computer and use it in GitHub Desktop.
Save DamianReeves/02e5f70884a7d2d7ecf6 to your computer and use it in GitHub Desktop.
configuration ProGet_Install
{
param
(
# Target node to apply the configuration
[string] $NodeName = 'localhost',
[ValidateSet('Express','Trial','LicenseKey')]
[string] $Edition = "LicenseKey", #Choices are Trial, LicenseKey, and Express
[string] $LicenseKey="",
[string] $Email = "[email protected]",
[string] $FullName = "User Name",
[string] $DriveLetter = "D",
[string] $TargetPath = [System.String]::Format("{0}:\ProgramFiles\ProGet", $DriveLetter),
[string] $PackagesPath = [System.String]::Format("{0}:\AppData\ProGet\Packages", $DriveLetter),
[string] $ConnectionString = "DataSource=localhost;InitialCatalog=ProGet;Integrated Security=True;Application Name=ProGet;",
[string] $UserAccount = "nugetsvc",
[string] $Password="password",
[switch] $ConfigureIIS=$false,
[int]$Port=81,
[string]$InstallerPath="http://inedo.com/proget/download/nosql/3.2.0"
)
$ProGetArgs = "/S /TargetPath='$TargetPath' /PackagesPath=$PackagesPath /Edition=$Edition /Port=$Port /EmailAddress=$Email /FullName='$FullName' "
switch ($Edition) {
"Trial" {
$ProGetArgs += ""
}
"LicenseKey" {
$ProGetArgs += "/LicenseKey=$LicenseKey "
}
default {
$ProGetArgs += ""
}
}
if ($ConfigureIIS) {
$ProGetArgs += "/ConfigureIIS /UseIntegratedWebServer=false"
}
if ($UserAccount) {
$ProGetArgs += "/UserAccount=$UserAccount "
$lowertUserAccount = $UserAccount.ToLowerInvariant();
switch ($lowerUserAccount) {
"localsystem" {}
"networksystem" {}
default {
if ($Password) {
$ProGetArgs += "/Password=$Password "
}
}
}
}
if ($ConfigureIIS) {
Node $NodeName
{
WindowsFeature IISWebServer {
Ensure = "Present"
Name = "Web-Server"
}
Package ProGet {
Ensure = "Present"
Name = "ProGet"
ProductId = ""
Path = $InstallerPath
Arguments = $ProGetArgs
DependsOn = "[WindowsFeature]IISWebServer"
}
}
} else {
Node $NodeName
{
Package ProGet {
Ensure = "Present"
Name = "ProGet"
ProductId = ""
Path = $InstallerPath
Arguments = $ProGetArgs
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment