title: Call a static method of a custom class
body: <p>I am writing a <a href="/questions/tagged/powershell" class="post-tag" title="show questions tagged 'powershell'" rel="tag">powershell</a> script which use my own DLL in it:</p>
  
  <pre><code>[System.Reflection.Assembly]::LoadFile("E:\Group.School.dll")
  </code></pre>
  
  <p>I want to access a <strong>static</strong> method in <code>Student class</code>. That static method has been overloaded.    </p>
  
  <pre><code>Class Student
  {        
      public static sting GetData(string id)
      {
          ....
      }
  
      public static sting GetData(string fName, string lName)
      {
          ....
      }        
  }
  </code></pre>
  
  <p>From PowerShell I am going to access the <strong>first method</strong> like below:</p>
  
  <pre><code>$data = [Group.School.Student]::GetData
  $data.Invoke("myId") 
  </code></pre>
  
  <p>This gives me an exception saying</p>
  
  <blockquote>
    <p>Exception calling "Invoke" with "1" argument(s): "Exception calling "GetData" with "1" argument(s): "Object reference not set to an instance of an object.""</p>
  </blockquote>