From 5de6344e2c536ddbeece614c5f56c9f2c9aae376 Mon Sep 17 00:00:00 2001 From: Lord Hepipud Date: Sat, 2 Nov 2019 12:12:26 +0100 Subject: [PATCH] Add function to fetch module root path --- icinga-powershell-framework.psd1 | 2 +- icinga-powershell-framework.psm1 | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/icinga-powershell-framework.psd1 b/icinga-powershell-framework.psd1 index 236f170..86f8eed 100644 --- a/icinga-powershell-framework.psd1 +++ b/icinga-powershell-framework.psd1 @@ -25,7 +25,7 @@ Description = 'Icinga 2 Windows Agent Module, which allows to entirely monitor t PowerShellVersion = '3.0' # Aus diesem Modul zu exportierende Funktionen. Um optimale Leistung zu erzielen, verwenden Sie keine Platzhalter und löschen den Eintrag nicht. Verwenden Sie ein leeres Array, wenn keine zu exportierenden Funktionen vorhanden sind. -FunctionsToExport = @( 'Use-Icinga', 'Import-IcingaLib', 'Publish-IcingaModuleManifests', 'Get-IcingaPluginDir', 'Get-IcingaCustomPluginDir', 'Get-IcingaCacheDir', 'Get-IcingaPowerShellConfigDir', 'Get-IcingaPowerShellModuleFile' ) +FunctionsToExport = @( 'Use-Icinga', 'Import-IcingaLib', 'Publish-IcingaModuleManifests', 'Get-IcingaPluginDir', 'Get-IcingaCustomPluginDir', 'Get-IcingaCacheDir', 'Get-IcingaPowerShellConfigDir', 'Get-IcingaFrameworkRootPath', 'Get-IcingaPowerShellModuleFile' ) # Aus diesem Modul zu exportierende Cmdlets. Um optimale Leistung zu erzielen, verwenden Sie keine Plat'zhalter und löschen den Eintrag nicht. Verwenden Sie ein leeres Array, wenn keine zu exportierenden Cmdlets vorhanden sind. CmdletsToExport = @() diff --git a/icinga-powershell-framework.psm1 b/icinga-powershell-framework.psm1 index 9cfdf0f..cb5181f 100644 --- a/icinga-powershell-framework.psm1 +++ b/icinga-powershell-framework.psm1 @@ -173,6 +173,14 @@ function Get-IcingaPowerShellConfigDir() return (Join-Path -Path $PSScriptRoot -ChildPath 'config'); } +function Get-IcingaFrameworkRootPath() +{ + [string]$Path = $PSScriptRoot; + [int]$Index = $Path.LastIndexOf('\') + 1; + $Path = $Path.Substring(0, $Index); + return $Path; +} + function Get-IcingaPowerShellModuleFile() { return (Join-Path -Path $PSScriptRoot -ChildPath 'icinga-powershell-framework.psm1');