From 9beab5e3509caf26e53819fca1f74d2a9cbcfc96 Mon Sep 17 00:00:00 2001 From: Christian Maintz <christianmaintz@t-online.de> Date: Thu, 16 Jul 2020 13:46:10 +0200 Subject: [PATCH] Add new file: Load-Modules.ps1 --- Beispielprojekt/Load-Modules.ps1 | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Beispielprojekt/Load-Modules.ps1 diff --git a/Beispielprojekt/Load-Modules.ps1 b/Beispielprojekt/Load-Modules.ps1 new file mode 100644 index 0000000..c9f3520 --- /dev/null +++ b/Beispielprojekt/Load-Modules.ps1 @@ -0,0 +1,23 @@ +function Load-Modules +{ + [CmdletBinding()] + param() + + #Excel-Modul + write-verbose "Es werden die benötigten Module geladen und ggf. Installiert.." + $GetModule = Get-Module ImportExcel -ListAvailable -ErrorAction SilentlyContinue + if($GetModule -eq $null) + { + write-verbose "Modul existiert noch nicht und wird nun installiert" + Install-Module ImportExcel -Confirm:$false + write-verbose "Modul wurde installiert und wird nun importiert" + Import-Module ImportExcel + + } + else + { + write-verbose "Modul existiert schon und wird nun importiert" + Import-Module ImportExcel + } + write-verbose "Module geladen!" +} \ No newline at end of file -- GitLab