64 lines
2.2 KiB
PowerShell
64 lines
2.2 KiB
PowerShell
|
Function New-SDKMachineSetup() {
|
||
|
<#
|
||
|
.SYNOPSIS
|
||
|
A function that encapsulates the setup of a new machine and completes the operations found on https://confluence.alkami.com/display/SDKC/Hardware+and+Software+Requirements
|
||
|
|
||
|
.DESCRIPTION
|
||
|
Validates installation of required software, add feeds for nuget and chocolatey, exclude port ranges and setup the Alkami listeners.
|
||
|
|
||
|
.EXAMPLE
|
||
|
Clients: New-SDKMachineSetup
|
||
|
Alkamists: New-SDKMachineSetup -Alkamist
|
||
|
Alkamists (Daily Builds): New-SDKMachineSetup -Alkamist -Daily
|
||
|
|
||
|
.NOTES
|
||
|
General notes
|
||
|
#>
|
||
|
[CmdletBinding()]
|
||
|
param
|
||
|
(
|
||
|
[Parameter(Mandatory=$true)]
|
||
|
[string]$Username,
|
||
|
[Parameter(Mandatory=$true)]
|
||
|
[string]$Password,
|
||
|
[Parameter(Mandatory=$false)]
|
||
|
[switch]$Alkamist,
|
||
|
[Parameter(Mandatory=$false)]
|
||
|
[switch]$Daily
|
||
|
)
|
||
|
|
||
|
# Confirm the required software is installed
|
||
|
Confirm-Software
|
||
|
|
||
|
$feed = "feeds"
|
||
|
|
||
|
if ($Alkamist) {
|
||
|
$feed = "packagerepo"
|
||
|
}
|
||
|
|
||
|
# Add Alkami's NuGet sources
|
||
|
Write-Host "Adding Alkami Dev NuGet source"
|
||
|
nuget sources add -name "Alkami Dev" -source "https://$feed.alkamitech.com/nuget/nuget.dev" -user $Username -password $Password
|
||
|
Write-Host "Adding Alkami Third-Party NuGet source"
|
||
|
nuget sources add -name "Alkami Third-Party" -source "https://$feed.alkamitech.com/nuget/ThirdParty" -user $Username -password $Password
|
||
|
|
||
|
# Then add our Chocolatey Dev feed as a choco source, passwords with special characters will need to be surrounded in "'mypassword'" double and single quotes
|
||
|
Write-Host "Adding Alkami Choco.Dev Chocolatey source"
|
||
|
choco source add -n=AlkamiChocoDev -s "'https://$feed.alkamitech.com/nuget/choco.dev'" -u="'$Username'" -p="'$Password'"
|
||
|
|
||
|
if ($Alkamist) {
|
||
|
Write-Host "Adding Alkami Choco.SDK Chocolatey source"
|
||
|
choco source add -n=AlkamiChocoSdk -s "'https://$feed.alkamitech.com/nuget/choco.sdk'" -u="'$Username'" -p="'$Password'"
|
||
|
if (-not $Daily) {
|
||
|
choco source disable -n "AlkamiChocoSdk"
|
||
|
}
|
||
|
}
|
||
|
|
||
|
$output = $false
|
||
|
# Note: Run below 2 commands to reserve specific ports.
|
||
|
$output = Add-NetshExcludedPortRange -StartPort 12345 -Range 2
|
||
|
$output = Add-NetshExcludedPortRange -StartPort 50000 -Range 30
|
||
|
|
||
|
# Ensure the specifically requested Alkami listeners are added to the Windows netsh repository
|
||
|
$output = Set-DefaultNetshIPListens
|
||
|
}
|