NCache.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 if ($isCore) { $script:PSPkgMgmt = 'ncacheps.dll' } else { $script:PSPkgMgmt = 'NCache.psd1' } $binaryModuleRoot = Join-Path -Path $script:PSModuleRoot -ChildPath $binarySubPath $PSOneGetModulePath = Join-Path -Path $binaryModuleRoot -ChildPath $script:PSPkgMgmt $PSOneGetModule = Import-Module -Name $PSOneGetModulePath -PassThru -FORCE if($PSOneGetModule) { $script:PSModule.OnRemove = { Remove-Module -ModuleInfo $PSOneGetModule } } |