NCache.OpenSource.psm1

#
# Script module for NCache.OpenSource
#

# Get current module info
$script:PSModule     = $ExecutionContext.SessionState.Module
$script:PSModuleRoot = $script:PSModule.ModuleBase

# Name of DLL
$script:PSPkgMgmt = 'ncacheps.dll'

# DLL is in the same folder as PSM1
$PSBinaryModulePath = Join-Path -Path $script:PSModuleRoot -ChildPath $script:PSPkgMgmt

# Import the DLL
$PSBinaryModule = Import-Module -Name $PSBinaryModulePath -PassThru -Force

# Auto-remove binary when module is unloaded
if ($PSBinaryModule) {
    $script:PSModule.OnRemove = {
        Remove-Module -ModuleInfo $PSBinaryModule
    }
}