Created
September 18, 2017 18:11
-
-
Save 1RedOne/e48598f9faa328f97d99bb9fca2e98ac to your computer and use it in GitHub Desktop.
LazyModule.psm1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Use your module PSM1 to import functions, then run one or two if needed | |
| # Based on Warren Frame's Plaster module format | |
| # | |
| #Get public and private function definition files. | |
| $PublicFunction = @( Get-ChildItem -Path $PSScriptRoot\Public\*.ps1 -Exclude *tests* -ErrorAction SilentlyContinue ) | |
| $PrivateFunction = @( Get-ChildItem -Path $PSScriptRoot\Private\*.ps1 -Exclude *tests* -ErrorAction SilentlyContinue ) | |
| #Dot source the files | |
| Foreach($import in @($PublicFunction + $PrivateFunction)) | |
| { | |
| "importing $import" | |
| Try | |
| { | |
| . $import.fullname | |
| } | |
| Catch | |
| { | |
| Write-Error -Message "Failed to import function $($import.fullname): $_" | |
| } | |
| } | |
| #region AW Device Type | |
| Update-TypeData -PrependPath $PSScriptRoot\Types.ps1xml -Verbose | |
| Update-FormatData -PrependPath $PSScriptRoot\Format.PSAirwatch.ps1xml -Verbose | |
| #endregion | |
| Export-ModuleMember -Function $PublicFunction.Basename | |
| Connect-AWAccount -Verbose |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment