title: How to load assemblies in PowerShell?
body: <p>The following PowerShell code</p>
  
  <pre><code>#Get a server object which corresponds to the default instance
  $srv = New-Object -TypeName Microsoft.SqlServer.Management.SMO.Server
  ... rest of the script ...
  </code></pre>
  
  <p>Gives the following error message: </p>
  
  <pre><code>New-Object : Cannot find type [Microsoft.SqlServer.Management.SMO.Server]: make sure 
  the assembly containing this type is loaded.
  At C:\Users\sortelyn\ ... \tools\sql_express_backup\backup.ps1:6  char:8
  + $srv = New-Object -TypeName Microsoft.SqlServer.Management.SMO.Server
  +        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  + CategoryInfo          : InvalidType: (:) [New-Object], PSArgumentException
  + FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand
  </code></pre>
  
  <p>Every answer on the Internet writes that I have to load the assembly - well sure I can read that from the error message :-) - the question is: </p>
  
  <p>How do you load the assembly and make the script work?</p>