title: How to check if PowerShell snap-in is already loaded before calling Add-PSSnapin
body: <p>I have a group of PowerShell scripts that sometimes get run together, sometimes one at a time. Each of the scripts requires that a certain snap-in be loaded.</p>
  
  <p>Right now each script is calling <code>Add-PSSnapin XYZ</code> at the beginning.</p>
  
  <p>Now if I run multiple scripts back-to-back the subsequent scripts throw:</p>
  
  <blockquote>
    <p>Cannot add Windows PowerShell snap-in XYZ because it is alerady added. Verify the name of the snap-in and try again.</p>
  </blockquote>
  
  <p>How can I have each script check to see if the snap-in is already loaded before calling Add-PSSnapin?</p>