Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save aldrichtr/41690fb4fa4956dd75489d8d2c8262ca to your computer and use it in GitHub Desktop.
Save aldrichtr/41690fb4fa4956dd75489d8d2c8262ca to your computer and use it in GitHub Desktop.
#Classes do not always play well in the nested modules section of a manifest. I've had trouble with importing classes in multiple files.
#My current approach is: Create a .ps1 file WITHOUT the standard clauses of BEGIN{} PROCESS{} END{} that uses invoke-expressions:
$invocables = @()
$invocables += $( get-content "$PSScriptRoot\MyFolder\MyClass.psm1" ) -join "`r`n"
$invocables += $( get-content "$PSScriptRoot\MyOtherClassThatDepenedsOnTheFirstOne.psm1" ) -join "`r`n"
foreach ($i in $invocables) { Invoke-Expression -Command $i }
#Then put that file in the ScriptsToProcess node.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment