February 2019
Intermediate to advanced
626 pages
15h 51m
English
It is possible to access module scope from the global scope by passing a module information object to the call operator.
The following snippet is used to demonstrate accessing module scope. The module consists of one public function, one private function, and a module-scoped variable:
function GetModuleServiceConnection { [CmdletBinding()] param ( ) $Script:connection }function Connect-ModuleService { [CmdletBinding()] param ( [String]$Name ) $Script:connection = $Name}$Script:connection = 'DefaultConnection'Export-ModuleMember -Function Connect-ModuleService
The following snippet should be saved to a file named ModuleService.psm1, then the module should be imported using Import-Module .\ModuleService.psm1.
By default, ...
Read now
Unlock full access