ps/Modules/Alkami.PowerShell.IIS/Public/Test-InstallerUseSymlinkStrategy.ps1

30 lines
1.0 KiB
PowerShell
Raw Permalink Normal View History

2023-05-30 22:51:22 -07:00
Function Test-InstallerUseSymlinkStrategy {
<#
.SYNOPSIS
Does the new installer use the symlink strategy? Set the value with [System.Environment]::SetEnvironmentVariable("Alkami.Installer.UseSymlink","true", "Machine")
.DESCRIPTION
This tests an environment variable and returns a boolean if the variable is set.
.OUTPUTS
[bool] if the machine is using Symlink strategy.
#>
[CmdletBinding()]
[OutputType([System.Boolean])]
Param()
process {
$loglead = Get-LogLeadName
$useSymlinkValue = Get-EnvironmentVariable -Name "Alkami.Installer.UseSymlink"
$useSymlink = $false
if( -not ([string]::IsNullOrWhiteSpace($useSymlinkValue)) -and -not ([bool]::TryParse($useSymlinkValue, [ref]$useSymlink))) {
Write-Warning "$logLead : Could not properly parse the value of the env variable [Alkami.Installer.UseSymlink] got [$useSymlinkValue]"
}
Write-Host "$logLead : Do we use the new installer pattern? [$useSymlink]"
return $useSymlink
}
}