Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save joerodgers/763b5d7f8d6212d293f6f9bd35581f76 to your computer and use it in GitHub Desktop.
Save joerodgers/763b5d7f8d6212d293f6f9bd35581f76 to your computer and use it in GitHub Desktop.
Loads all of the CSOM assemblies into the current PowerShell process
function Import-ClientSideObjectModelAssemblies
{
[cmdletbinding()]
param
(
[Parameter(Mandatory=$true)][string]$AssemblyPath
)
begin
{
}
process
{
Get-ChildItem -Path $AssemblyPath -ErrorAction Stop | ? { $_.Name -match "Microsoft.*.dll" -and $_.Name -notmatch ".Runtime.Windows.dll" } | % {
[System.Reflection.Assembly]::LoadFrom( $_.FullName ) | Out-Null
}
}
end
{
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment