NCache.Professional.psm1
# # Script module for module 'NCache' # # Summary: PackageManagement is supported on Windows PowerShell 3.0 or later, Nano Server and PowerShellCore $isCore = ($PSVersionTable.Keys -contains "PSEdition") -and ($PSVersionTable.PSEdition -ne 'Desktop') $binarySubPath = '' if ($isCore) { $binarySubPath = 'core' } else { $binarySubPath = 'framework' } # Set up some helper variables to make it easier to work with the module $script:PSModule = $ExecutionContext.SessionState.Module $script:PSModuleRoot = $script:PSModule.ModuleBase $script:PSPkgMgmt = 'ncacheps.dll' $binaryModuleRoot = Join-Path -Path $script:PSModuleRoot -ChildPath $binarySubPath $PSOneGetModulePath = Join-Path -Path $binaryModuleRoot -ChildPath $script:PSPkgMgmt $PSOneGetModule = Import-Module -Name $PSOneGetModulePath -PassThru -FORCE # When the module is unloaded, remove the nested binary module that was loaded with it if($OneGetModule) { $script:PSModule.OnRemove = { Remove-Module -ModuleInfo $OneGetModule } } if($PSOneGetModule) { $script:PSModule.OnRemove = { Remove-Module -ModuleInfo $PSOneGetModule } } |