TMConsole.Provider.TransitionManager.psm1
## Setup an apropriate quiet environment $global:ConfirmPreference = 'None' ## Allows functions that would typically require confirmation to be overridden $RequiredModules = @( 'TransitionManager' ) ## Install if Missing, then import the required modules foreach ($RequiredModule in $RequiredModules) { ## Test if each module is available $Module = Get-Module -ListAvailable -Name $RequiredModule -ErrorAction SilentlyContinue ## If the Module is not installed if (-not $Module) { ## Attempt the Installation of the module $InstalledModule = Install-Module $Module -ErrorAction SilentlyContinue ## If the Module Installation was unsuccessful if (-Not $InstalledModule) { throw ('Required Module: ' + $RequiredModule + ' is not installed, and installation failed.') } } Import-Module $Module } ## Load the Remaining Library Modlue files Get-ChildItem -Path (Join-Path $PSScriptRoot 'lib') | ForEach-Object { . $_.FullName } |