Import-Library.ps1
function Import-Library { param( [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Alias('FullName')] [String] $File ) begin { Add-Type -Name "LoadLib" -Namespace "" -MemberDefinition ' [DllImport("kernel32")] public static extern int LoadLibrary(string FileName); ' -IgnoreWarnings } process { $null = [LoadLib]::LoadLibrary($File) } } |