From 0d59fc9a15f14681db1eccd36c9f6dad95dede96 Mon Sep 17 00:00:00 2001 From: Lord Hepipud Date: Tue, 22 Oct 2019 19:19:57 +0200 Subject: [PATCH] Add support to test for available functions --- lib/core/tools/Test-IcingaFunction.psm1 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 lib/core/tools/Test-IcingaFunction.psm1 diff --git a/lib/core/tools/Test-IcingaFunction.psm1 b/lib/core/tools/Test-IcingaFunction.psm1 new file mode 100644 index 0000000..9de4777 --- /dev/null +++ b/lib/core/tools/Test-IcingaFunction.psm1 @@ -0,0 +1,16 @@ +function Test-IcingaFunction() +{ + param( + [string]$Name + ); + + if ([string]::IsNullOrEmpty($Name)) { + return $FALSE; + } + + if (Get-Command $Name -ErrorAction SilentlyContinue) { + return $TRUE; + } + + return $FALSE; +}