Skip to content

Instantly share code, notes, and snippets.

@bielawb
Created December 30, 2016 07:27
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 bielawb/149d5e108802b6bcc0bb78a87b95e15e to your computer and use it in GitHub Desktop.
Save bielawb/149d5e108802b6bcc0bb78a87b95e15e to your computer and use it in GitHub Desktop.
Work-around for the fact that `using module` is not very flexible.
param (
[string]$Path,
[string]$ClassName
)
$scriptBody = @'
using module {0}
'@ -f $Path
$script = [scriptblock]::Create($scriptBody)
. $script
$class = $ClassName -as [type]
$class::new()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment