PSScriptMenuGui.psm1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
if ($PSEdition -eq 'Core') {
    if (-not $IsWindows) {
        throw 'This module only runs on Windows'
    }
    if ($PSVersionTable.PSVersion.Major -eq 6) {
        throw 'This module is not compatible with PowerShell Core 6'
    }
}

# Get public and private function definition files
# Based on: https://github.com/RamblingCookieMonster/PSStackExchange/blob/db1277453374cb16684b35cf93a8f5c97288c41f/PSStackExchange/PSStackExchange.psm1
$scripts = @()
$scripts += Get-ChildItem -Path $PSScriptRoot\public\*.ps1 -ErrorAction SilentlyContinue
$scripts += Get-ChildItem -Path $PSScriptRoot\private\*.ps1 -ErrorAction SilentlyContinue

# Dot source the files
ForEach ($script in $scripts) {
    try {
        . $script.FullName
    }
    catch {
        throw
    }
}

# Used to get files from xaml and examples subfolders
$moduleRoot = $PSScriptRoot