Is there anyway in PowerShell to Add-Type
when importing a module?
I have a custom VB DLL that I'm importing as a module. The DLL has 2 imports in it:
Imports Microsoft.ConfigurationManagement.ManagementProvider
Imports Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine
The function that relies on the WqlQueryEngine
doesn't work until I do:
Add-Type "C:\Program Files (x86)\Configuration Manager\Console\bin\AdminUI.WqlQueryEngine.dll"
Is there anyway to do this during the import? Or change where PowerShell is looking for an assembly?
Also why do I have to do this?
The files the import is relying on are both in the same directory?
The first import relies on C:\Program Files (x86)\Configuration Manager\Console\bin\Microsoft.ConfigurationManagement.ManagementProvider.dll
.
Why does one work and the other needs to be added?