Functions/Get-BT_RunbookEnvironment.ps1
<#
.SYNOPSIS This function retrieves the current BitTitan Runbook environment. #> function Get-BT_RunbookEnvironment { # Create an object to store the settings $environment = [PSCustomObject]@{ PSTypeName = "BitTitan.RunbookEnvironment" } # Retrieve the environment settings if ($Global:PSDefaultParameterValues.ContainsKey("*-BT_*:Environment")) { $environment | Add-Member -NotePropertyName "Environment" -NotePropertyValue $Global:PSDefaultParameterValues["*-BT_*:Environment"] } else { $environment | Add-Member -NotePropertyName "Environment" -NotePropertyValue "Beta" } if ($Global:PSDefaultParameterValues.ContainsKey("*-BT_*:IsRunningOnLocalMachine")) { $environment | Add-Member -NotePropertyName "IsRunningOnLocalMachine" -NotePropertyValue $Global:PSDefaultParameterValues["*-BT_*:IsRunningOnLocalMachine"] } else { $environment | Add-Member -NotePropertyName "IsRunningOnLocalMachine" -NotePropertyValue $false } # Set the environment to ensure that defaults are set Set-BT_RunbookEnvironment -Environment $environment.Environment -IsRunningOnLocalMachine $environment.IsRunningOnLocalMachine # Return the object containing the settings return $environment } |