title: PowerShell: Import-Module or Add-Type for .NET assemblies?
body: <p>I'm using PowerShell 5.1, Windows 10 x64.</p>
  <p>Which of these 2 cmdlets should I use to load .NET assemblies (in particular .NET Framework 4+ assemblies) into PowerShell? What's the core difference between them? I want to load assemblies for accessing types, creating objects, calling methods, etc.</p>
  <p>I haven't found any explicit statements in the documentation. These cmdlets are described like they are completely different things. MSDN documentation for <code>Import-Module</code> doesn't even contain examples for <code>.dll</code> assemblies loading -- only PowerShell modules. However <code>Import-Module</code> works with .NET Framework assemblies (<code>.dll</code> only, though): I can perfectly work with types from the imported assemblies, their referenced assemblies are resolved and loaded too. Why is that?</p>
  <p>In other words, from my experience I haven't yet found any differences between these 2 assemblies importing methods (at least for .NET Framework 4 <code>.dll</code> assemblies).</p>
  <p>This old blog post: <a href="https://devblogs.microsoft.com/scripting/using-net-framework-assemblies-in-windows-powershell/" rel="nofollow noreferrer">Using .NET Framework Assemblies in Windows PowerShell</a> even uses <code>Reflection.Assembly.LoadWithPartialName</code>! I believe this is because they load an assembly from the GAC and do not want to specify full path to it (I may be wrong, though).</p>
  <p>For my assemblies I know full path to them, so I can specify it in both <code>Import-Module</code> and <code>Add-Type</code>. Again, what's the difference and what should I use?</p>
  <p>Thanks!</p>