Skip to content

Instantly share code, notes, and snippets.

@bgelens
Created May 28, 2018 20:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bgelens/00ccebd350e0e8e94a25f0ce75e1bd83 to your computer and use it in GitHub Desktop.
Save bgelens/00ccebd350e0e8e94a25f0ce75e1bd83 to your computer and use it in GitHub Desktop.
$enums = Get-ChildItem -Path $PSScriptRoot\enums\*.ps1 -ErrorAction SilentlyContinue | ForEach-Object -Process {
Get-Content $_.FullName
}
if (Test-Path "$PSScriptRoot\Classes\classes.psd1") {
$ClassLoadOrder = Import-PowerShellDataFile -Path "$PSScriptRoot\classes\classes.psd1" -ErrorAction SilentlyContinue
}
$classes = foreach ($class in $ClassLoadOrder.order) {
$path = '{0}\classes\{1}.ps1' -f $PSScriptRoot, $class
if (Test-Path $path) {
Get-Content $path
}
}
$public = Get-ChildItem -Path $PSScriptRoot\Public\*.ps1 -Exclude WIP* -ErrorAction SilentlyContinue | ForEach-Object -Process {
Get-Content $_
"Export-ModuleMember -Function $($_.Basename)"
}
$private = Get-ChildItem -Path $PSScriptRoot\Private\*.ps1 -Exclude WIP* -ErrorAction SilentlyContinue | ForEach-Object -Process {
Get-Content $_
}
$moduleContent = @'
Add-Type -Path 'C:\Windows\Microsoft.NET\assembly\GAC_MSIL\microsoft.isam.esent.interop\*\Microsoft.Isam.Esent.Interop.dll'
$DSCPullServerConnections = [System.Collections.ArrayList]::new()
{0}
{1}
{2}
{3}
'@ -f ($enums -join "`n"), ($classes -join "`n"), ($private -join "`n"), ($public -join "`n")
$scriptBlock = [scriptblock]::Create($moduleContent)
New-Module -Name DSCPullServerAdmin -ScriptBlock $scriptBlock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment